1 # Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2007
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 2 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, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # Test essential Machine interface (MI) operations
20 # Verify that, using the MI, we can create, update, delete variables.
24 load_lib mi-support.exp
32 set testfile "var-cmd"
33 set srcfile ${testfile}.c
34 set binfile ${objdir}/${subdir}/${testfile}
35 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
36 untested mi-var-cmd.exp
41 mi_gdb_reinitialize_dir $srcdir/$subdir
42 mi_gdb_load ${binfile}
47 # Variable Creation tests #
51 # Test: c_variable-1.1
52 # Desc: Create global variable
54 mi_gdb_test "111-var-create global_simple * global_simple" \
55 "111\\^done,name=\"global_simple\",numchild=\"6\",type=\"simpleton\"" \
56 "create global variable"
58 # Test: c_variable-1.2
59 # Desc: Create non-existent variable
61 mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \
62 "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
63 "create non-existent variable"
65 # Test: c_variable-1.3
66 # Desc: Create out of scope variable
68 mi_gdb_test "113-var-create argc * argc" \
69 "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
70 "create out of scope variable"
72 mi_runto do_locals_tests
74 # Test: c_variable-1.4
75 # Desc: create local variables
77 mi_gdb_test "-var-create linteger * linteger" \
78 "\\^done,name=\"linteger\",numchild=\"0\",type=\"int\"" \
79 "create local variable linteger"
81 mi_gdb_test "-var-create lpinteger * lpinteger" \
82 "\\^done,name=\"lpinteger\",numchild=\"1\",type=\"int \\*\"" \
83 "create local variable lpinteger"
85 mi_gdb_test "-var-create lcharacter * lcharacter" \
86 "\\^done,name=\"lcharacter\",numchild=\"0\",type=\"char\"" \
87 "create local variablelcharacter "
89 mi_gdb_test "-var-create lpcharacter * lpcharacter" \
90 "\\^done,name=\"lpcharacter\",numchild=\"1\",type=\"char \\*\"" \
91 "create local variable lpcharacter"
93 mi_gdb_test "-var-create llong * llong" \
94 "\\^done,name=\"llong\",numchild=\"0\",type=\"long int\"" \
95 "create local variable llong"
97 mi_gdb_test "-var-create lplong * lplong" \
98 "\\^done,name=\"lplong\",numchild=\"1\",type=\"long int \\*\"" \
99 "create local variable lplong"
101 mi_gdb_test "-var-create lfloat * lfloat" \
102 "\\^done,name=\"lfloat\",numchild=\"0\",type=\"float\"" \
103 "create local variable lfloat"
105 mi_gdb_test "-var-create lpfloat * lpfloat" \
106 "\\^done,name=\"lpfloat\",numchild=\"1\",type=\"float \\*\"" \
107 "create local variable lpfloat"
109 mi_gdb_test "-var-create ldouble * ldouble" \
110 "\\^done,name=\"ldouble\",numchild=\"0\",type=\"double\"" \
111 "create local variable ldouble"
113 mi_gdb_test "-var-create lpdouble * lpdouble" \
114 "\\^done,name=\"lpdouble\",numchild=\"1\",type=\"double \\*\"" \
115 "create local variable lpdouble"
117 mi_gdb_test "-var-create lsimple * lsimple" \
118 "\\^done,name=\"lsimple\",numchild=\"6\",type=\"struct _simple_struct\"" \
119 "create local variable lsimple"
121 mi_gdb_test "-var-create lpsimple * lpsimple" \
122 "\\^done,name=\"lpsimple\",numchild=\"6\",type=\"struct _simple_struct \\*\"" \
123 "create local variable lpsimple"
125 mi_gdb_test "-var-create func * func" \
126 "\\^done,name=\"func\",numchild=\"0\",type=\"void \\(\\*\\)\\((void|)\\)\"" \
127 "create local variable func"
129 # Test: c_variable-1.5
130 # Desc: create lsimple.character
131 mi_gdb_test "-var-create lsimple.character * lsimple.character" \
132 "\\^done,name=\"lsimple.character\",numchild=\"0\",type=\"char\"" \
133 "create lsimple.character"
135 # Test: c_variable-1.6
136 # Desc: create lpsimple->integer
137 mi_gdb_test "-var-create lsimple->integer * lsimple->integer" \
138 "\\^done,name=\"lsimple->integer\",numchild=\"0\",type=\"int\"" \
139 "create lsimple->integer"
141 # Test: c_variable-1.7
142 # Desc: ceate lsimple.integer
143 mi_gdb_test "-var-create lsimple.integer * lsimple.integer" \
144 "\\^done,name=\"lsimple.integer\",numchild=\"0\",type=\"int\"" \
145 "create lsimple->integer"
148 # Test: c_variable-1.9
149 # Desc: create type name
150 # Type names (like int, long, etc..) are all proper expressions to gdb.
151 # make sure variable code does not allow users to create variables, though.
152 mi_gdb_test "-var-create int * int" \
153 "&\"Attempt to use a type name as an expression.\\\\n\".*&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
159 # Value changed tests #
163 # Test: c_variable-2.1
164 # Desc: check whether values changed at do_block_tests
165 mi_gdb_test "-var-update *" \
166 "\\^done,changelist=\\\[\\\]" \
169 # Step over "linteger = 1234;"
170 set line_dlt_linteger [gdb_get_line_number "lpinteger = &linteger;"]
171 mi_step_to "do_locals_tests" "" "var-cmd.c" $line_dlt_linteger "step at do_locals_test"
173 # Test: c_variable-2.2
174 # Desc: check whether only linteger changed values
175 mi_gdb_test "-var-update *" \
176 "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
177 "update all vars: linteger changed"
179 # Step over "lpinteger = &linteger;"
180 mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests (2)"
182 # Test: c_variable-2.3
183 # Desc: check whether only lpinteger changed
184 mi_gdb_test "-var-update *" \
185 "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
186 "update all vars: lpinteger changed"
188 # Step over "lcharacter = 'a';"
189 mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests (3)"
191 # Test: c_variable-2.4
192 # Desc: check whether only lcharacter changed
193 mi_gdb_test "-var-update *" \
194 "\\^done,changelist=\\\[\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
195 "update all vars: lcharacter changed"
197 # Step over "lpcharacter = &lcharacter;"
198 mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests (4)"
200 # Test: c_variable-2.5
201 # Desc: check whether only lpcharacter changed
202 mi_gdb_test "-var-update *" \
203 "\\^done,changelist=\\\[\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
204 "update all vars: lpcharacter changed"
212 # ldouble = 2.718281828459045;
213 # lpdouble = &ldouble;
214 # lsimple.integer = 1234;
215 # lsimple.unsigned_integer = 255;
216 # lsimple.character = 'a';
218 mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
219 "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests (5)"
221 # Test: c_variable-2.6
222 # Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
223 # lsimple.unsigned_character lsimple.integer lsimple.character changed
224 mi_gdb_test "-var-update *" \
225 "\\^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\"\}\\\]" \
226 "update all vars: many changed"
229 # lsimple.signed_character = 21;
230 # lsimple.char_ptr = &lcharacter;
231 # lpsimple = &lsimple;
234 set line_dlt_4321 [gdb_get_line_number "linteger = 4321;"]
236 mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
237 "var-cmd.c" $line_dlt_4321 "" "step at do_locals_tests (6)"
239 # Test: c_variable-2.7
240 # Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed
241 mi_gdb_test "-var-update *" \
242 "\\^done,changelist=\\\[\{name=\"func\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lpsimple\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
243 "update all vars: func and lpsimple changed"
250 # ldouble = 5.498548281828172;
251 # lsimple.integer = 255;
252 # lsimple.unsigned_integer = 4321;
253 # lsimple.character = 'b';
255 mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
256 "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests (7)"
258 # Test: c_variable-2.8
259 # Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
260 # lpsimple.integer lsimple.character changed
261 # Note: this test also checks that lpsimple->integer and lsimple.integer have
262 # changed (they are the same)
263 mi_gdb_test "-var-update *" \
264 "\\^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\"\}\\\]" \
265 "update all vars: lsimple and others changed"
270 # Test assignment to variables. More tests on assignment are in other files.
273 mi_gdb_test "-var-assign global_simple 0" \
274 "&\"mi_cmd_var_assign: Variable object is not editable\\\\n\".*\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \
275 "assign to global_simple"
277 mi_gdb_test "-var-assign linteger 3333" \
278 "\\^done,value=\"3333\"" \
281 # Allow lpcharacter to update, optionally. Because it points to a
282 # char variable instead of a zero-terminated string, if linteger is
283 # directly after it in memory the printed characters may appear to
285 set lpchar_update "\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\},"
286 mi_gdb_test "-var-update *" \
287 "\\^done,changelist=\\\[($lpchar_update)?\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
288 "update all vars: linteger changed after assign"
290 mi_gdb_test "-var-assign linteger 3333" \
291 "\\^done,value=\"3333\"" \
292 "assign to linteger again, same value"
294 mi_gdb_test "-var-update *" \
295 "\\^done,changelist=\\\[\\\]" \
296 "update all vars: linteger not changed after same assign"
298 mi_gdb_test "-var-evaluate-expression linteger" \
299 "\\^done,value=\"3333\"" \
302 mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \
303 "\\^done,value=\"$hex\"" \
304 "assign to lpinteger"
306 mi_gdb_test "-var-update *" \
307 "\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
308 "update all vars: lpinteger changed after assign"
310 mi_gdb_test "-var-update *" \
311 "\\^done,changelist=\\\[\\\]" \
312 "update all vars: no changes on second update"
314 mi_gdb_test "-var-evaluate-expression lpinteger" \
315 "\\^done,value=\"$hex\"" \
318 # reset the values to the original ones so that the rest of the file doesn't suffer.
320 mi_gdb_test "-var-assign linteger 4321" \
321 "\\^done,value=\"4321\"" \
324 mi_gdb_test "-var-assign lpinteger &linteger" \
325 "\\^done,value=\"$hex\"" \
326 "assign to lpinteger"
328 mi_gdb_test "-var-assign lcharacter 'z'" \
329 "\\^done,value=\"122 'z'\"" \
330 "assign to lcharacter"
332 mi_gdb_test "-var-evaluate-expression lcharacter" \
333 "\\^done,value=\"122 'z'\"" \
336 mi_gdb_test "-var-assign llong 1313L" \
337 "\\^done,value=\"1313\"" \
339 mi_gdb_test "-var-evaluate-expression llong" \
340 "\\^done,value=\"1313\"" \
342 mi_gdb_test "-var-assign llong 1212L" \
343 "\\^done,value=\"1212\"" \
346 mi_gdb_test "-var-assign lplong &llong+4" \
347 "\\^done,value=\"$hex\"" \
349 mi_gdb_test "-var-evaluate-expression lplong" \
350 "\\^done,value=\"$hex\"" \
352 mi_gdb_test "-var-assign lplong &llong" \
353 "\\^done,value=\"$hex\"" \
356 mi_gdb_test "-var-assign lfloat 3.4567" \
357 "\\^done,value=\"3.45.*\"" \
359 mi_gdb_test "-var-evaluate-expression lfloat" \
360 "\\^done,value=\"3.45.*\"" \
362 mi_gdb_test "-var-assign lfloat 1.2345" \
363 "\\^done,value=\"1.23.*\"" \
366 mi_gdb_test "-var-assign lpfloat &lfloat+4" \
367 "\\^done,value=\"$hex\"" \
370 mi_gdb_test "-var-assign ldouble 5.333318284590435" \
371 "\\^done,value=\"5.333318284590435\"" \
374 mi_gdb_test "-var-assign func do_block_tests" \
375 "\\^done,value=\"$hex <do_block_tests>\"" \
378 mi_gdb_test "-var-assign lsimple.character 'd'" \
379 "\\^done,value=\"100 'd'\"" \
380 "assign to lsimple.character"
382 mi_gdb_test "-var-assign lsimple->integer 222" \
383 "\\^done,value=\"222\"" \
384 "assign to lsimple->integer"
386 mi_gdb_test "-var-assign lsimple.integer 333" \
387 "\\^done,value=\"333\"" \
388 "assign to lsimple.integer"
390 mi_gdb_test "-var-update *" \
391 "\\^done,changelist=.*" \
394 # Check that assignment of function and array values
395 # promotes the assigned value to function pointer/data
396 # pointer before comparing with the existing value,
397 # and does not incorrectly make the value as changed.
398 mi_gdb_test "-var-assign func do_block_tests" \
399 "\\^done,value=\"$hex <do_block_tests>\"" \
400 "assign same value to func"
402 mi_gdb_test "-var-update *" \
403 "\\^done,changelist=\\\[\\\]" \
404 "assign same value to func (update)"
406 mi_gdb_test "-var-create array_ptr * array_ptr" \
407 "\\^done,name=\"array_ptr\",numchild=\"1\",type=\"int \\*\"" \
408 "create global variable array_ptr"
410 mi_gdb_test "-var-assign array_ptr array2" \
411 "\\^done,value=\"$hex\"" \
412 "assign array to pointer"
414 mi_gdb_test "-var-update *" \
415 "\\^done,changelist=\\\[\{name=\"array_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
416 "assign array to pointer (update)"
418 mi_gdb_test "-var-assign array_ptr array2" \
419 "\\^done,value=\"$hex\"" \
420 "assign same array to pointer"
422 mi_gdb_test "-var-update *" \
423 "\\^done,changelist=\\\[\\\]" \
424 "assign same array to pointer (update)"
428 # End of assign tests
431 set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"]
433 mi_continue_to subroutine1
435 # Test: c_variable-2.10
436 # Desc: create variable for locals i,l in subroutine1
437 mi_gdb_test "-var-create i * i" \
438 "\\^done,name=\"i\",numchild=\"0\",type=\"int\"" \
441 mi_gdb_test "-var-create l * l" \
442 "\\^done,name=\"l\",numchild=\"1\",type=\"long int \\*\"" \
445 # Test: c_variable-2.11
446 # Desc: create do_locals_tests local in subroutine1
447 mi_gdb_test "-var-create linteger * linteger" \
448 "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
451 mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
452 "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1"
454 # Test: c_variable-2.12
455 # Desc: change global_simple.integer
456 # Note: This also tests whether we are reporting changes in structs properly.
457 # gdb normally would say that global_simple has changed, but we
458 # special case that, since it is not what a human expects to
462 mi_gdb_test "-var-update *" \
463 "\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \
464 "update all vars: changed FIXME"
467 mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
468 "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)"
470 # Test: c_variable-2.13
471 # Desc: change subroutine1 local i
472 mi_gdb_test "-var-update *" \
473 "\\^done,changelist=\\\[\{name=\"i\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
474 "update all vars: i changed"
476 mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
477 "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)"
479 # Test: c_variable-2.14
480 # Desc: change do_locals_tests local llong
481 mi_gdb_test "-var-update *" \
482 "\\^done,changelist=\\\[\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
483 "update all vars: llong changed"
485 set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"]
486 mi_next_to "do_locals_tests" "" "var-cmd.c" \
487 [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1"
489 # Test: c_variable-2.15
490 # Desc: check for out of scope subroutine1 locals
491 mi_gdb_test "-var-update *" \
492 "\\^done,changelist=\\\[\{name=\"l\",in_scope=\"false\"\},\{name=\"i\",in_scope=\"false\"\}\\\]" \
493 "update all vars: all now out of scope"
495 # Done with locals/globals tests. Erase all variables
496 #delete_all_variables
497 mi_gdb_test "-var-delete global_simple" \
498 "\\^done,ndeleted=\"1\"" \
501 mi_gdb_test "-var-delete linteger" \
502 "\\^done,ndeleted=\"1\"" \
503 "delete var linteger"
505 mi_gdb_test "-var-delete lpinteger" \
506 "\\^done,ndeleted=\"1\"" \
507 "delete var lpinteger"
509 mi_gdb_test "-var-delete lcharacter" \
510 "\\^done,ndeleted=\"1\"" \
511 "delete var lcharacter"
513 mi_gdb_test "-var-delete lpcharacter" \
514 "\\^done,ndeleted=\"1\"" \
515 "delete var lpcharacter"
517 mi_gdb_test "-var-delete llong" \
518 "\\^done,ndeleted=\"1\"" \
521 mi_gdb_test "-var-delete lplong" \
522 "\\^done,ndeleted=\"1\"" \
525 mi_gdb_test "-var-delete lfloat" \
526 "\\^done,ndeleted=\"1\"" \
529 mi_gdb_test "-var-delete lpfloat" \
530 "\\^done,ndeleted=\"1\"" \
533 mi_gdb_test "-var-delete ldouble" \
534 "\\^done,ndeleted=\"1\"" \
537 mi_gdb_test "-var-delete lpdouble" \
538 "\\^done,ndeleted=\"1\"" \
539 "delete var lpdouble"
541 mi_gdb_test "-var-delete lsimple" \
542 "\\^done,ndeleted=\"1\"" \
545 mi_gdb_test "-var-delete lpsimple" \
546 "\\^done,ndeleted=\"1\"" \
547 "delete var lpsimple"
549 mi_gdb_test "-var-delete func" \
550 "\\^done,ndeleted=\"1\"" \
553 mi_gdb_test "-var-delete lsimple.character" \
554 "\\^done,ndeleted=\"1\"" \
555 "delete var lsimple.character"
557 mi_gdb_test "-var-delete lsimple->integer" \
558 "\\^done,ndeleted=\"1\"" \
559 "delete var lsimple->integer"
561 mi_gdb_test "-var-delete lsimple.integer" \
562 "\\^done,ndeleted=\"1\"" \
563 "delete var lsimple.integer"
565 mi_gdb_test "-var-delete i" \
566 "\\^done,ndeleted=\"1\"" \
569 mi_gdb_test "-var-delete l" \
570 "\\^done,ndeleted=\"1\"" \
573 # Test whether we can follow the name of a variable through multiple
575 mi_continue_to do_special_tests
577 mi_gdb_test "-var-create selected_a @ a" \
578 {\^done,name="selected_a",numchild="0",type="int"} \
581 mi_continue_to incr_a
583 mi_gdb_test "-var-update selected_a" \
584 "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"char\",new_num_children=\"0\"\}\\\]" \
585 "update selected_a in incr_a"
587 mi_next "step a line in incr_a"
588 mi_next "return from incr_a to do_special_tests"
590 mi_gdb_test "-var-update selected_a" \
591 "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"int\",new_num_children=\"0\"\}\\\]" \
592 "update selected_a in do_special_tests"
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",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",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\"" \