2004-08-17 Michael Chastain <mec.gnu@mindspring.com>
[external/binutils.git] / gdb / testsuite / gdb.mi / mi-var-cmd.exp
1 # Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
2 #
3 # This Program Is Free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # Test essential Machine interface (MI) operations
18 #
19 # Verify that, using the MI, we can create, update, delete variables.
20 #
21
22
23 load_lib mi-support.exp
24 set MIFLAGS "-i=mi"
25
26 gdb_exit
27 if [mi_gdb_start] {
28     continue
29 }
30
31 set testfile "var-cmd"
32 set srcfile ${testfile}.c
33 set binfile ${objdir}/${subdir}/${testfile}
34 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
35     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
36 }
37
38 mi_delete_breakpoints
39 mi_gdb_reinitialize_dir $srcdir/$subdir
40 mi_gdb_load ${binfile}
41
42
43 #####                   #####
44 #                           #
45 #  Variable Creation tests  #
46 #                           #
47 #####                   #####
48
49 # Test:  c_variable-1.1
50 # Desc:  Create global variable
51
52 mi_gdb_test "111-var-create global_simple * global_simple" \
53         "111\\^done,name=\"global_simple\",numchild=\"6\",type=\"simpleton\"" \
54         "create global variable"
55
56 # Test: c_variable-1.2
57 # Desc: Create non-existent variable
58
59 mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \
60         "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
61         "create non-existent variable"
62
63 # Test: c_variable-1.3
64 # Desc: Create out of scope variable
65
66 mi_gdb_test "113-var-create argc * argc" \
67         "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
68         "create out of scope variable"
69
70 mi_runto do_locals_tests
71
72 # Test: c_variable-1.4
73 # Desc: create local variables
74
75 mi_gdb_test "-var-create linteger * linteger" \
76         "\\^done,name=\"linteger\",numchild=\"0\",type=\"int\"" \
77         "create local variable linteger"
78
79 mi_gdb_test "-var-create lpinteger * lpinteger" \
80         "\\^done,name=\"lpinteger\",numchild=\"1\",type=\"int \\*\"" \
81         "create local variable lpinteger"
82
83 mi_gdb_test "-var-create lcharacter * lcharacter" \
84         "\\^done,name=\"lcharacter\",numchild=\"0\",type=\"char\"" \
85         "create local variablelcharacter "
86
87 mi_gdb_test "-var-create lpcharacter * lpcharacter" \
88         "\\^done,name=\"lpcharacter\",numchild=\"1\",type=\"char \\*\"" \
89         "create local variable lpcharacter"
90
91 mi_gdb_test "-var-create llong * llong" \
92         "\\^done,name=\"llong\",numchild=\"0\",type=\"long int\"" \
93         "create local variable llong"
94
95 mi_gdb_test "-var-create lplong * lplong" \
96         "\\^done,name=\"lplong\",numchild=\"1\",type=\"long int \\*\"" \
97         "create local variable lplong"
98
99 mi_gdb_test "-var-create lfloat * lfloat" \
100         "\\^done,name=\"lfloat\",numchild=\"0\",type=\"float\"" \
101         "create local variable lfloat"
102
103 mi_gdb_test "-var-create lpfloat * lpfloat" \
104         "\\^done,name=\"lpfloat\",numchild=\"1\",type=\"float \\*\"" \
105         "create local variable lpfloat"
106
107 mi_gdb_test "-var-create ldouble * ldouble" \
108         "\\^done,name=\"ldouble\",numchild=\"0\",type=\"double\"" \
109         "create local variable ldouble"
110
111 mi_gdb_test "-var-create lpdouble * lpdouble" \
112         "\\^done,name=\"lpdouble\",numchild=\"1\",type=\"double \\*\"" \
113         "create local variable lpdouble"
114
115 mi_gdb_test "-var-create lsimple * lsimple" \
116         "\\^done,name=\"lsimple\",numchild=\"6\",type=\"struct _simple_struct\"" \
117         "create local variable lsimple"
118
119 mi_gdb_test "-var-create lpsimple * lpsimple" \
120         "\\^done,name=\"lpsimple\",numchild=\"6\",type=\"struct _simple_struct \\*\"" \
121         "create local variable lpsimple"
122
123 mi_gdb_test "-var-create func * func" \
124         "\\^done,name=\"func\",numchild=\"0\",type=\"void \\(\\*\\)\\((void|)\\)\"" \
125         "create local variable func"
126
127 # Test: c_variable-1.5
128 # Desc: create lsimple.character
129 mi_gdb_test "-var-create lsimple.character * lsimple.character" \
130         "\\^done,name=\"lsimple.character\",numchild=\"0\",type=\"char\"" \
131         "create lsimple.character"
132
133 # Test: c_variable-1.6
134 # Desc: create lpsimple->integer
135 mi_gdb_test "-var-create lsimple->integer * lsimple->integer" \
136         "\\^done,name=\"lsimple->integer\",numchild=\"0\",type=\"int\"" \
137         "create lsimple->integer"
138
139 # Test: c_variable-1.7
140 # Desc: ceate lsimple.integer
141 mi_gdb_test "-var-create lsimple.integer * lsimple.integer" \
142         "\\^done,name=\"lsimple.integer\",numchild=\"0\",type=\"int\"" \
143         "create lsimple->integer"
144
145
146 # Test: c_variable-1.9
147 # Desc: create type name
148 #    Type names (like int, long, etc..) are all proper expressions to gdb.
149 #    make sure variable code does not allow users to create variables, though.
150 mi_gdb_test "-var-create int * int" \
151         "&\"Attempt to use a type name as an expression.mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
152         "create int"
153
154
155 #####             #####
156 #                     #
157 # Value changed tests #
158 #                     #
159 #####             #####
160
161 # Test: c_variable-2.1
162 # Desc: check whether values changed at do_block_tests
163 mi_gdb_test "-var-update *" \
164         "\\^done,changelist=\\\[\\\]" \
165         "update all vars"
166
167 # Step over "linteger = 1234;"
168 set line_dlt_linteger [gdb_get_line_number "lpinteger = &linteger;"]
169 mi_step_to "do_locals_tests" "" "var-cmd.c" $line_dlt_linteger "step at do_locals_test"
170
171 # Test: c_variable-2.2
172 # Desc: check whether only linteger changed values
173 mi_gdb_test "-var-update *" \
174         "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
175         "update all vars: linteger changed"
176
177 # Step over "lpinteger = &linteger;"
178 mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests (2)"
179
180 # Test: c_variable-2.3
181 # Desc: check whether only lpinteger changed
182 mi_gdb_test "-var-update *" \
183         "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
184         "update all vars: lpinteger changed"
185
186 # Step over "lcharacter = 'a';"
187 mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests (3)"
188
189 # Test: c_variable-2.4
190 # Desc: check whether only lcharacter changed
191 mi_gdb_test "-var-update *" \
192         "\\^done,changelist=\\\[\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
193         "update all vars: lcharacter changed"
194
195 # Step over "lpcharacter = &lcharacter;"
196 mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests (4)"
197
198 # Test: c_variable-2.5
199 # Desc: check whether only lpcharacter changed
200 mi_gdb_test "-var-update *" \
201         "\\^done,changelist=\\\[\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
202         "update all vars: lpcharacter changed"
203
204
205 # Step over:
206 #  llong = 2121L;
207 #  lplong = &llong;
208 #  lfloat = 2.1;
209 #  lpfloat = &lfloat;
210 #  ldouble = 2.718281828459045;
211 #  lpdouble = &ldouble;
212 #  lsimple.integer = 1234;
213 #  lsimple.unsigned_integer = 255;
214 #  lsimple.character = 'a';
215
216 mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
217         "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests (5)"
218
219 # Test: c_variable-2.6
220 # Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
221 #       lsimple.unsigned_character lsimple.integer lsimple.character changed
222 mi_gdb_test "-var-update *" \
223         "\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lpdouble\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lpfloat\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lplong\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
224         "update all vars: many changed"
225
226 # Step over:
227 #  lsimple.signed_character = 21;
228 #  lsimple.char_ptr = &lcharacter;
229 #  lpsimple = &lsimple;
230 #  func = nothing;
231
232 set line_dlt_4321 [gdb_get_line_number "linteger = 4321;"]
233
234 mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
235         "var-cmd.c" $line_dlt_4321 "" "step at do_locals_tests (6)"
236
237 # Test: c_variable-2.7
238 # Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed
239 mi_gdb_test "-var-update *" \
240         "\\^done,changelist=\\\[\{name=\"func\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lpsimple\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
241         "update all vars: func and lpsimple changed"
242
243 # Step over
244 #  linteger = 4321;
245 #  lcharacter = 'b';
246 #  llong = 1212L;
247 #  lfloat = 1.2;
248 #  ldouble = 5.498548281828172;
249 #  lsimple.integer = 255;
250 #  lsimple.unsigned_integer = 4321;
251 #  lsimple.character = 'b';
252
253 mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
254         "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests (7)"
255
256 # Test: c_variable-2.8
257 # Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
258 #       lpsimple.integer lsimple.character changed
259 # Note: this test also checks that lpsimple->integer and lsimple.integer have
260 #       changed (they are the same)
261 mi_gdb_test "-var-update *" \
262         "\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
263         "update all vars: func and lpsimple changed"
264
265
266 ### 
267 #
268 # Test assignment to variables. More tests on assignment are in other files.
269 #
270 ###
271 mi_gdb_test "-var-assign global_simple 0" \
272         "&\"mi_cmd_var_assign: Variable object is not editable\\\\n\".*\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \
273         "assign to global_simple"
274
275 mi_gdb_test "-var-assign linteger 3333" \
276         "\\^done,value=\"3333\"" \
277         "assign to linteger"
278
279 mi_gdb_test "-var-update *" \
280         "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
281         "update all vars: linteger changed after assign"
282
283 mi_gdb_test "-var-assign linteger 3333" \
284         "\\^done,value=\"3333\"" \
285         "assign to linteger again, same value"
286
287 mi_gdb_test "-var-update *" \
288         "\\^done,changelist=\\\[\\\]" \
289         "update all vars: linteger not changed after same assign"
290
291 mi_gdb_test "-var-evaluate-expression linteger" \
292         "\\^done,value=\"3333\"" \
293         "eval linteger"
294
295 mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \
296         "\\^done,value=\"$hex\"" \
297         "assign to lpinteger"
298
299 mi_gdb_test "-var-update *" \
300         "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
301         "update all vars: lpinteger changed after assign"
302
303 mi_gdb_test "-var-update *" \
304         "\\^done,changelist=\\\[\\\]" \
305         "update all vars: no changes on second update"
306
307 mi_gdb_test "-var-evaluate-expression lpinteger" \
308         "\\^done,value=\"$hex\"" \
309         "eval lpinteger"
310
311 # reset the values to the original ones so that the rest of the file doesn't suffer.
312
313 mi_gdb_test "-var-assign linteger 4321" \
314         "\\^done,value=\"4321\"" \
315         "assign to linteger"
316
317 mi_gdb_test "-var-assign lpinteger &linteger" \
318         "\\^done,value=\"$hex\"" \
319         "assign to lpinteger"
320
321 mi_gdb_test "-var-assign lcharacter 'z'" \
322         "\\^done,value=\"122 'z'\"" \
323         "assign to lcharacter"
324
325 mi_gdb_test "-var-evaluate-expression lcharacter" \
326         "\\^done,value=\"122 'z'\"" \
327         "eval lcharacter"
328
329 mi_gdb_test "-var-assign llong 1313L" \
330         "\\^done,value=\"1313\"" \
331         "assign to llong"
332 mi_gdb_test "-var-evaluate-expression llong" \
333         "\\^done,value=\"1313\"" \
334         "eval llong"
335 mi_gdb_test "-var-assign llong 1212L" \
336         "\\^done,value=\"1212\"" \
337         "assign to llong"
338
339 mi_gdb_test "-var-assign lplong &llong+4" \
340         "\\^done,value=\"$hex\"" \
341         "assign to lplong"
342 mi_gdb_test "-var-evaluate-expression lplong" \
343         "\\^done,value=\"$hex\"" \
344         "eval lplong"
345 mi_gdb_test "-var-assign lplong &llong" \
346         "\\^done,value=\"$hex\"" \
347         "assign to lplong"
348
349 mi_gdb_test "-var-assign lfloat 3.4567" \
350         "\\^done,value=\"3.45.*\"" \
351         "assign to lfloat"
352 mi_gdb_test "-var-evaluate-expression lfloat" \
353         "\\^done,value=\"3.45.*\"" \
354         "eval lfloat"
355 mi_gdb_test "-var-assign lfloat 1.2345" \
356         "\\^done,value=\"1.23.*\"" \
357         "assign to lfloat"
358
359 mi_gdb_test "-var-assign lpfloat &lfloat+4" \
360         "\\^done,value=\"$hex\"" \
361         "assign to lpfloat"
362
363 mi_gdb_test "-var-assign ldouble 5.333318284590435" \
364         "\\^done,value=\"5.333318284590435\"" \
365         "assign to ldouble"
366
367 mi_gdb_test "-var-assign func do_block_tests" \
368         "\\^done,value=\"$hex <do_block_tests>\"" \
369         "assign to func"
370
371 mi_gdb_test "-var-assign lsimple.character 'd'" \
372         "\\^done,value=\"100 'd'\"" \
373         "assign to lsimple.character"
374
375 mi_gdb_test "-var-assign  lsimple->integer 222" \
376         "\\^done,value=\"222\"" \
377         "assign to lsimple->integer"
378
379 mi_gdb_test "-var-assign lsimple.integer 333" \
380         "\\^done,value=\"333\"" \
381         "assign to lsimple.integer"
382
383 ######
384 # End of assign tests 
385 #####
386
387 set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"]
388
389 mi_gdb_test "-break-insert subroutine1" \
390         "\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"$line_subroutine1_body\",times=\"0\"\}" \
391         "break-insert subroutine1"
392 mi_continue_to "2" "subroutine1" \
393         "\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \
394         "var-cmd.c" $line_subroutine1_body "continue to subroutine1"
395
396 # Test: c_variable-2.10
397 # Desc: create variable for locals i,l in subroutine1
398 mi_gdb_test "-var-create i  * i" \
399         "\\^done,name=\"i\",numchild=\"0\",type=\"int\"" \
400         "create i"
401
402 mi_gdb_test "-var-create l * l" \
403         "\\^done,name=\"l\",numchild=\"1\",type=\"long int \\*\"" \
404         "create l"
405
406 # Test: c_variable-2.11
407 # Desc: create do_locals_tests local in subroutine1
408 mi_gdb_test "-var-create linteger * linteger" \
409         "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
410         "create linteger"
411
412 mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
413         "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1"
414
415 # Test: c_variable-2.12
416 # Desc: change global_simple.integer
417 # Note: This also tests whether we are reporting changes in structs properly.
418 #       gdb normally would say that global_simple has changed, but we
419 #       special case that, since it is not what a human expects to
420 #       see.
421
422 setup_xfail *-*-*
423 mi_gdb_test "-var-update *" \
424         "\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \
425         "update all vars: changed FIXME"
426 clear_xfail *-*-*
427
428 mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
429         "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)"
430
431 # Test: c_variable-2.13
432 # Desc: change subroutine1 local i
433 mi_gdb_test "-var-update *" \
434         "\\^done,changelist=\\\[\{name=\"i\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
435         "update all vars: i changed"
436
437 mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
438         "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)"
439
440 # Test: c_variable-2.14
441 # Desc: change do_locals_tests local llong
442 mi_gdb_test "-var-update *" \
443         "\\^done,changelist=\\\[\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
444         "update all vars: llong changed"
445
446 set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"]
447 mi_next_to "do_locals_tests" "" "var-cmd.c" \
448   [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1"
449
450 # Test: c_variable-2.15
451 # Desc: check for out of scope subroutine1 locals
452 mi_gdb_test "-var-update *" \
453         "\\^done,changelist=\\\[\{name=\"l\",in_scope=\"false\"\},\{name=\"i\",in_scope=\"false\"\}\\\]" \
454         "update all vars: all now out of scope"
455
456 # Done with locals/globals tests. Erase all variables
457 #delete_all_variables
458 mi_gdb_test "-var-delete global_simple" \
459         "\\^done,ndeleted=\"1\"" \
460         "delete var"
461
462 mi_gdb_test "-var-delete linteger" \
463         "\\^done,ndeleted=\"1\"" \
464         "delete var linteger"
465
466 mi_gdb_test "-var-delete lpinteger" \
467         "\\^done,ndeleted=\"1\"" \
468         "delete var lpinteger"
469
470 mi_gdb_test "-var-delete lcharacter" \
471         "\\^done,ndeleted=\"1\"" \
472         "delete var lcharacter"
473
474 mi_gdb_test "-var-delete lpcharacter" \
475         "\\^done,ndeleted=\"1\"" \
476         "delete var lpcharacter"
477
478 mi_gdb_test "-var-delete llong" \
479         "\\^done,ndeleted=\"1\"" \
480         "delete var llong"
481
482 mi_gdb_test "-var-delete lplong" \
483         "\\^done,ndeleted=\"1\"" \
484         "delete var lplong"
485
486 mi_gdb_test "-var-delete lfloat" \
487         "\\^done,ndeleted=\"1\"" \
488         "delete var lfloat"
489
490 mi_gdb_test "-var-delete lpfloat" \
491         "\\^done,ndeleted=\"1\"" \
492         "delete var lpfloat"
493
494 mi_gdb_test "-var-delete ldouble" \
495         "\\^done,ndeleted=\"1\"" \
496         "delete var ldouble"
497
498 mi_gdb_test "-var-delete lpdouble" \
499         "\\^done,ndeleted=\"1\"" \
500         "delete var lpdouble"
501
502 mi_gdb_test "-var-delete lsimple" \
503         "\\^done,ndeleted=\"1\"" \
504         "delete var lsimple"
505
506 mi_gdb_test "-var-delete lpsimple" \
507         "\\^done,ndeleted=\"1\"" \
508         "delete var lpsimple"
509
510 mi_gdb_test "-var-delete func" \
511         "\\^done,ndeleted=\"1\"" \
512         "delete var func"
513
514 mi_gdb_test "-var-delete lsimple.character" \
515         "\\^done,ndeleted=\"1\"" \
516         "delete var lsimple.character"
517
518 mi_gdb_test "-var-delete  lsimple->integer" \
519         "\\^done,ndeleted=\"1\"" \
520         "delete var  lsimple->integer"
521
522 mi_gdb_test "-var-delete lsimple.integer" \
523         "\\^done,ndeleted=\"1\"" \
524         "delete var lsimple.integer"
525
526 mi_gdb_test "-var-delete i" \
527         "\\^done,ndeleted=\"1\"" \
528         "delete var i"
529
530 mi_gdb_test "-var-delete l" \
531         "\\^done,ndeleted=\"1\"" \
532         "delete var l"
533
534 # Test whether we can follow the name of a variable through multiple
535 # stack frames.
536 mi_gdb_test "-break-insert do_special_tests" \
537   {\^done,bkpt=.*} \
538   "set breakpoint at do_special_tests"
539
540 mi_continue_to {.*} do_special_tests {.*} {.*var-cmd.c} {.*} {stop in do_special_tests}
541
542 mi_gdb_test "-var-create selected_a @ a" \
543   {\^done,name="selected_a",numchild="0",type="int"} \
544   "create selected_a"
545
546 mi_gdb_test "-break-insert incr_a" \
547   {\^done,bkpt=.*} \
548   "set breakpoint at incr_a"
549
550 mi_continue_to {.*} incr_a {.*} {.*var-cmd.c} {.*} {stop in incr_a}
551
552 mi_gdb_test "-var-update selected_a" \
553         "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"char\",new_num_children=\"0\"\}\\\]" \
554         "update selected_a in incr_a"
555
556 mi_next "step a line in incr_a"
557 mi_next "return from incr_a to do_special_tests"
558
559 mi_gdb_test "-var-update selected_a" \
560         "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"int\",new_num_children=\"0\"\}\\\]" \
561         "update selected_a in do_special_tests"
562
563 mi_gdb_exit
564 return 0