1 # Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009
2 # Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Test essential Machine interface (MI) operations
19 # Verify that, using the MI, we can create, update, delete variables.
23 load_lib mi-support.exp
31 set testfile "var-cmd"
32 set srcfile ${testfile}.c
33 set binfile ${objdir}/${subdir}/mi-var-cmd
34 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
35 untested mi-var-cmd.exp
40 mi_gdb_reinitialize_dir $srcdir/$subdir
41 mi_gdb_load ${binfile}
46 # Variable Creation tests #
50 # Test: c_variable-1.1
51 # Desc: Create global variable
53 mi_create_varobj "global_simple" "global_simple" "create global variable"
55 # Test: c_variable-1.2
56 # Desc: Create non-existent variable
58 mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \
59 "112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
60 "create non-existent variable"
62 # Test: c_variable-1.3
63 # Desc: Create out of scope variable
65 mi_gdb_test "113-var-create argc * argc" \
66 "113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
67 "create out of scope variable"
69 mi_runto do_locals_tests
71 set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"]
73 mi_continue_to_line $line_dlt_first_real "step to real start of do_locals_test"
76 # Test: c_variable-1.4
77 # Desc: create local variables
79 mi_create_varobj_checked linteger linteger int "create local variable linteger"
81 mi_create_varobj_checked lpinteger lpinteger {int \*} "create local variable lpinteger"
83 mi_create_varobj_checked lcharacter lcharacter\[0\] char "create local variable lcharacter"
85 mi_create_varobj_checked lpcharacter lpcharacter {char \*} "create local variable lpcharacter"
87 mi_create_varobj_checked llong llong "long int" "create local variable llong"
89 mi_create_varobj_checked lplong lplong {long int \*} "create local variable lplong"
91 mi_create_varobj_checked lfloat lfloat float "create local variable lfloat"
93 mi_create_varobj_checked lpfloat lpfloat {float \*} "create local variable lpfloat"
95 mi_create_varobj_checked ldouble ldouble double "create local variable ldouble"
97 mi_create_varobj_checked lpdouble lpdouble {double \*} "create local variable lpdouble"
99 mi_create_varobj_checked lsimple lsimple "struct _simple_struct" "create local variable lsimple"
101 mi_create_varobj_checked lpsimple lpsimple {struct _simple_struct \*} "create local variable lpsimple"
103 mi_create_varobj_checked func func {void \(\*\)\((void|)\)} "create local variable func"
105 # Test: c_variable-1.5
106 # Desc: create lsimple.character
107 mi_create_varobj_checked lsimple.character lsimple.character "char" \
108 "create lsimple.character"
110 # Test: c_variable-1.6
111 # Desc: create lpsimple->integer
112 mi_create_varobj_checked lsimple->integer lsimple->integer "int" \
113 "create lsimple->integer"
115 # Test: c_variable-1.7
116 # Desc: create lsimple.integer
117 mi_create_varobj_checked lsimple.integer lsimple.integer "int" \
118 "create lsimple.integer"
121 # Test: c_variable-1.9
122 # Desc: create type name
123 # Type names (like int, long, etc..) are all proper expressions to gdb.
124 # make sure variable code does not allow users to create variables, though.
125 mi_gdb_test "-var-create int * int" \
126 "&\"Attempt to use a type name as an expression.\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
132 # Value changed tests #
136 # Test: c_variable-2.1
137 # Desc: check whether values changed at do_block_tests
138 mi_gdb_test "-var-update *" \
139 "\\^done,changelist=\\\[\\\]" \
142 # Step over "linteger = 1234;"
143 set line_dlt_linteger [gdb_get_line_number "lpinteger = &linteger;"]
144 mi_step_to "do_locals_tests" "" "var-cmd.c" $line_dlt_linteger "step at do_locals_test"
146 # Test: c_variable-2.2
147 # Desc: check whether only linteger changed values
148 mi_gdb_test "-var-update *" \
149 "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
150 "update all vars: linteger changed"
152 # Step over "lpinteger = &linteger;"
153 mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests (2)"
155 # Test: c_variable-2.3
156 # Desc: check whether only lpinteger changed
157 mi_gdb_test "-var-update *" \
158 "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
159 "update all vars: lpinteger changed"
161 # Step over "lcharacter = 'a';"
162 mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests (3)"
164 # Test: c_variable-2.4
165 # Desc: check whether only lcharacter changed
166 mi_gdb_test "-var-update *" \
167 "\\^done,changelist=\\\[\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
168 "update all vars: lcharacter changed"
170 # Step over "lpcharacter = &lcharacter;"
171 mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests (4)"
173 # Test: c_variable-2.5
174 # Desc: check whether only lpcharacter changed
175 mi_gdb_test "-var-update *" \
176 "\\^done,changelist=\\\[\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
177 "update all vars: lpcharacter changed"
185 # ldouble = 2.718281828459045;
186 # lpdouble = &ldouble;
187 # lsimple.integer = 1234;
188 # lsimple.unsigned_integer = 255;
189 # lsimple.character = 'a';
191 mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
192 "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests (5)"
194 # Test: c_variable-2.6
195 # Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
196 # lsimple.unsigned_character lsimple.integer lsimple.character changed
197 mi_gdb_test "-var-update *" \
198 "\\^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\"\}\\\]" \
199 "update all vars: many changed"
202 # lsimple.signed_character = 21;
203 # lsimple.char_ptr = &lcharacter;
204 # lpsimple = &lsimple;
207 set line_dlt_4321 [gdb_get_line_number "linteger = 4321;"]
209 mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
210 "var-cmd.c" $line_dlt_4321 "" "step at do_locals_tests (6)"
212 # Test: c_variable-2.7
213 # Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed
214 mi_gdb_test "-var-update *" \
215 "\\^done,changelist=\\\[\{name=\"func\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lpsimple\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
216 "update all vars: func and lpsimple changed"
223 # ldouble = 5.498548281828172;
224 # lsimple.integer = 255;
225 # lsimple.unsigned_integer = 4321;
226 # lsimple.character = 'b';
228 mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
229 "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests (7)"
231 # Test: c_variable-2.8
232 # Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
233 # lpsimple.integer lsimple.character changed
234 # Note: this test also checks that lpsimple->integer and lsimple.integer have
235 # changed (they are the same)
236 mi_gdb_test "-var-update *" \
237 "\\^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=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
238 "update all vars: lsimple and others changed"
243 # Test assignment to variables. More tests on assignment are in other files.
246 mi_gdb_test "-var-assign global_simple 0" \
247 "\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \
248 "assign to global_simple"
250 mi_gdb_test "-var-assign linteger 3333" \
251 "\\^done,value=\"3333\"" \
254 # Allow lpcharacter to update, optionally. Because it points to a
255 # char variable instead of a zero-terminated string, if linteger is
256 # directly after it in memory the printed characters may appear to
258 set lpchar_update "\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\},"
259 mi_gdb_test "-var-update *" \
260 "\\^done,changelist=\\\[($lpchar_update)?\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
261 "update all vars: linteger changed after assign"
263 mi_gdb_test "-var-assign linteger 3333" \
264 "\\^done,value=\"3333\"" \
265 "assign to linteger again, same value"
267 mi_gdb_test "-var-update *" \
268 "\\^done,changelist=\\\[\\\]" \
269 "update all vars: linteger not changed after same assign"
271 mi_gdb_test "-var-evaluate-expression linteger" \
272 "\\^done,value=\"3333\"" \
275 mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \
276 "\\^done,value=\"$hex\"" \
277 "assign to lpinteger"
279 mi_gdb_test "-var-update *" \
280 "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
281 "update all vars: lpinteger changed after assign"
283 mi_gdb_test "-var-update *" \
284 "\\^done,changelist=\\\[\\\]" \
285 "update all vars: no changes on second update"
287 mi_gdb_test "-var-evaluate-expression lpinteger" \
288 "\\^done,value=\"$hex\"" \
291 # reset the values to the original ones so that the rest of the file doesn't suffer.
293 mi_gdb_test "-var-assign linteger 4321" \
294 "\\^done,value=\"4321\"" \
297 mi_gdb_test "-var-assign lpinteger &linteger" \
298 "\\^done,value=\"$hex\"" \
299 "assign to lpinteger"
301 mi_gdb_test "-var-assign lcharacter 'z'" \
302 "\\^done,value=\"122 'z'\"" \
303 "assign to lcharacter"
305 mi_gdb_test "-var-evaluate-expression lcharacter" \
306 "\\^done,value=\"122 'z'\"" \
309 mi_gdb_test "-var-assign llong 1313L" \
310 "\\^done,value=\"1313\"" \
312 mi_gdb_test "-var-evaluate-expression llong" \
313 "\\^done,value=\"1313\"" \
315 mi_gdb_test "-var-assign llong 1212L" \
316 "\\^done,value=\"1212\"" \
319 mi_gdb_test "-var-assign lplong &llong+4" \
320 "\\^done,value=\"$hex\"" \
322 mi_gdb_test "-var-evaluate-expression lplong" \
323 "\\^done,value=\"$hex\"" \
325 mi_gdb_test "-var-assign lplong &llong" \
326 "\\^done,value=\"$hex\"" \
329 mi_gdb_test "-var-assign lfloat 3.4567" \
330 "\\^done,value=\"3.45.*\"" \
332 mi_gdb_test "-var-evaluate-expression lfloat" \
333 "\\^done,value=\"3.45.*\"" \
335 mi_gdb_test "-var-assign lfloat 1.2345" \
336 "\\^done,value=\"1.23.*\"" \
339 mi_gdb_test "-var-assign lpfloat &lfloat+4" \
340 "\\^done,value=\"$hex\"" \
343 mi_gdb_test "-var-assign ldouble 5.333318284590435" \
344 "\\^done,value=\"5.333318284590435\"" \
347 mi_gdb_test "-var-assign func do_block_tests" \
348 "\\^done,value=\"$hex <do_block_tests>\"" \
351 mi_gdb_test "-var-assign lsimple.character 'd'" \
352 "\\^done,value=\"100 'd'\"" \
353 "assign to lsimple.character"
355 mi_gdb_test "-var-assign lsimple->integer 222" \
356 "\\^done,value=\"222\"" \
357 "assign to lsimple->integer"
359 mi_gdb_test "-var-assign lsimple.integer 333" \
360 "\\^done,value=\"333\"" \
361 "assign to lsimple.integer"
363 mi_gdb_test "-var-update *" \
364 "\\^done,changelist=.*" \
367 # Check that assignment of function and array values
368 # promotes the assigned value to function pointer/data
369 # pointer before comparing with the existing value,
370 # and does not incorrectly make the value as changed.
371 mi_gdb_test "-var-assign func do_block_tests" \
372 "\\^done,value=\"$hex <do_block_tests>\"" \
373 "assign same value to func"
375 mi_gdb_test "-var-update *" \
376 "\\^done,changelist=\\\[\\\]" \
377 "assign same value to func (update)"
379 mi_gdb_test "-var-create array_ptr * array_ptr" \
380 "\\^done,name=\"array_ptr\",numchild=\"1\",value=\"$hex\",type=\"int \\*\"" \
381 "create global variable array_ptr"
383 mi_gdb_test "-var-assign array_ptr array2" \
384 "\\^done,value=\"$hex\"" \
385 "assign array to pointer"
387 mi_gdb_test "-var-update *" \
388 "\\^done,changelist=\\\[\{name=\"array_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
389 "assign array to pointer (update)"
391 mi_gdb_test "-var-assign array_ptr array2" \
392 "\\^done,value=\"$hex\"" \
393 "assign same array to pointer"
395 mi_gdb_test "-var-update *" \
396 "\\^done,changelist=\\\[\\\]" \
397 "assign same array to pointer (update)"
401 # End of assign tests
404 set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"]
406 mi_continue_to subroutine1
408 # Test: c_variable-2.10
409 # Desc: create variable for locals i,l in subroutine1
410 mi_create_varobj_checked i i int "create i"
412 mi_create_varobj_checked l l {long int \*} "create l"
414 # Test: c_variable-2.11
415 # Desc: create do_locals_tests local in subroutine1
416 mi_gdb_test "-var-create linteger * linteger" \
417 "\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
420 mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
421 "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1"
423 # Test: c_variable-2.12
424 # Desc: change global_simple.integer
425 # Note: This also tests whether we are reporting changes in structs properly.
426 # gdb normally would say that global_simple has changed, but we
427 # special case that, since it is not what a human expects to
431 mi_gdb_test "-var-update *" \
432 "\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \
433 "update all vars: changed FIXME"
436 mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
437 "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)"
439 # Test: c_variable-2.13
440 # Desc: change subroutine1 local i
441 mi_gdb_test "-var-update *" \
442 "\\^done,changelist=\\\[\{name=\"i\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
443 "update all vars: i changed"
445 mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
446 "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)"
448 # Test: c_variable-2.14
449 # Desc: change do_locals_tests local llong
450 mi_gdb_test "-var-update *" \
451 "\\^done,changelist=\\\[\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
452 "update all vars: llong changed"
454 set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"]
455 mi_next_to "do_locals_tests" "" "var-cmd.c" \
456 [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1"
458 # Test: c_variable-2.15
459 # Desc: check for out of scope subroutine1 locals
460 mi_gdb_test "-var-update *" \
461 "\\^done,changelist=\\\[\{name=\"l\",in_scope=\"false\"\,type_changed=\"false\"},\{name=\"i\",in_scope=\"false\",type_changed=\"false\"\}\\\]" \
462 "update all vars: all now out of scope"
464 # Done with locals/globals tests. Erase all variables
465 #delete_all_variables
466 mi_gdb_test "-var-delete global_simple" \
467 "\\^done,ndeleted=\"1\"" \
470 mi_gdb_test "-var-delete linteger" \
471 "\\^done,ndeleted=\"1\"" \
472 "delete var linteger"
474 mi_gdb_test "-var-delete lpinteger" \
475 "\\^done,ndeleted=\"1\"" \
476 "delete var lpinteger"
478 mi_gdb_test "-var-delete lcharacter" \
479 "\\^done,ndeleted=\"1\"" \
480 "delete var lcharacter"
482 mi_gdb_test "-var-delete lpcharacter" \
483 "\\^done,ndeleted=\"1\"" \
484 "delete var lpcharacter"
486 mi_gdb_test "-var-delete llong" \
487 "\\^done,ndeleted=\"1\"" \
490 mi_gdb_test "-var-delete lplong" \
491 "\\^done,ndeleted=\"1\"" \
494 mi_gdb_test "-var-delete lfloat" \
495 "\\^done,ndeleted=\"1\"" \
498 mi_gdb_test "-var-delete lpfloat" \
499 "\\^done,ndeleted=\"1\"" \
502 mi_gdb_test "-var-delete ldouble" \
503 "\\^done,ndeleted=\"1\"" \
506 mi_gdb_test "-var-delete lpdouble" \
507 "\\^done,ndeleted=\"1\"" \
508 "delete var lpdouble"
510 mi_gdb_test "-var-delete lsimple" \
511 "\\^done,ndeleted=\"1\"" \
514 mi_gdb_test "-var-delete lpsimple" \
515 "\\^done,ndeleted=\"1\"" \
516 "delete var lpsimple"
518 mi_gdb_test "-var-delete func" \
519 "\\^done,ndeleted=\"1\"" \
522 mi_gdb_test "-var-delete lsimple.character" \
523 "\\^done,ndeleted=\"1\"" \
524 "delete var lsimple.character"
526 mi_gdb_test "-var-delete lsimple->integer" \
527 "\\^done,ndeleted=\"1\"" \
528 "delete var lsimple->integer"
530 mi_gdb_test "-var-delete lsimple.integer" \
531 "\\^done,ndeleted=\"1\"" \
532 "delete var lsimple.integer"
534 mi_gdb_test "-var-delete i" \
535 "\\^done,ndeleted=\"1\"" \
538 mi_gdb_test "-var-delete l" \
539 "\\^done,ndeleted=\"1\"" \
542 # Test whether we can follow the name of a variable through multiple
544 mi_continue_to do_special_tests
546 mi_gdb_test "-var-create selected_a @ a" \
547 {\^done,name="selected_a",numchild="0",value=\".*\",type="int".*} \
550 mi_continue_to incr_a
552 mi_gdb_test "-var-update selected_a" \
553 "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"char\",new_num_children=\"0\"\}\\\]" \
554 "update selected_a in incr_a"
556 mi_next "step a line in incr_a"
557 mi_next "return from incr_a to do_special_tests"
559 mi_gdb_test "-var-update selected_a" \
560 "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"int\",new_num_children=\"0\"\}\\\]" \
561 "update selected_a in do_special_tests"
563 mi_gdb_test "-file-exec-and-symbols ${binfile}" "\\^done" \
564 "floating varobj invalidation"
566 mi_delete_varobj selected_a "delete selected_a"
567 mi_delete_varobj array_ptr "delete array_ptr"
569 proc set_frozen {varobjs flag} {
571 mi_gdb_test "-var-set-frozen $v $flag" \
573 "-var-set-frozen $v $flag"
577 mi_prepare_inline_tests $srcfile
578 mi_run_inline_test frozen
580 # Since the inline test framework does not really work with
581 # function calls, first to inline tests and then do the reminder
583 mi_run_inline_test floating
584 set do_at_tests_callee_breakpoint [gdb_get_line_number "breakpoint inside callee"]
585 mi_gdb_test "-break-insert var-cmd.c:$do_at_tests_callee_breakpoint" ".*" \
586 "inside breakpoint inside callee"
587 mi_execute_to "exec-continue" "breakpoint-hit" do_at_tests_callee "" ".*" ".*" \
588 { "" "disp=\"keep\"" } \
589 "continue to where i is initialized"
591 mi_varobj_update F {F} "update F inside callee"
592 mi_check_varobj_value F 7 "check F inside callee"
594 # Test whether bad varobjs crash GDB.
596 # A varobj we fail to read during -var-update should be considered
598 mi_gdb_test "-var-create null_ptr * **0" \
599 {\^done,name="null_ptr",numchild="0",value=".*",type="int"} \
602 # Allow this to succeed, if address zero is readable, although it
603 # will not test what it was meant to. Most important is that GDB
605 mi_gdb_test "-var-update null_ptr" \
606 {\^done,changelist=\[.*\]} \
609 mi_gdb_test "-var-delete null_ptr" \
610 "\\^done,ndeleted=\"1\"" \
613 # When we fail to read a varobj created from a named variable,
614 # we evaluate its type instead. Make sure that doesn't blow
615 # up by trying to read it again. We can use _end when not running
616 # the program to simulate an unreadable variable, if this platform
617 # provides _end, but cope if it's missing.
620 {&"kill\\n".*\^done} \
621 "kill program before endvar"
623 mi_gdb_test "-var-create endvar * _end" \
624 {(\^done,name="endvar",numchild="0",value=".*",type=".*"|&".*unable to.*".*\^error,msg=".*")} \
627 # Allow this to succeed whether the value is readable, unreadable, or
628 # missing. Most important is that GDB does not crash.
629 mi_gdb_test "-var-update endvar" \
630 {(\^done,changelist=\[.*\]|^".*".*\^error,msg=".*not found")} \
633 mi_gdb_test "-var-delete endvar" \
634 "\\^done,ndeleted=\"1\"" \
637 mi_delete_breakpoints
639 mi_runto do_locals_tests
641 mi_create_varobj "L" "lsimple" "in-and-out-of-scope: create varobj"
642 mi_check_varobj_value "L" "{...}" "in-and-out-of-scope: check initial value"
646 mi_gdb_test "-var-update L" \
647 {\^done,changelist=\[{name="L",in_scope="false",type_changed="false"}\]} \
648 "in-and-out-of-scope: out of scope now"
650 mi_gdb_test "-var-update L" \
651 {\^done,changelist=\[]} \
652 "in-and-out-of-scope: out of scope now, not changed"
654 mi_continue_to do_locals_tests
656 mi_gdb_test "-var-update L" \
657 {\^done,changelist=\[{name="L",in_scope="true",type_changed="false"}\]} \
658 "in-and-out-of-scope: in scope now"
660 mi_gdb_test "-var-update L" \
661 {\^done,changelist=\[\]} \
662 "in-and-out-of-scope: in scope now, not changed"