1 # Copyright 1999, 2000, 2001, 2002, 2003, 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 mi2-var-display.exp
41 mi_gdb_reinitialize_dir $srcdir/$subdir
42 mi_gdb_load ${binfile}
44 set line_dct_end [gdb_get_line_number "{int a = 0;}"]
46 mi_gdb_test "200-break-insert $srcfile:$line_dct_end" \
47 "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_end\",times=\"0\"\}" \
48 "break-insert operation"
51 # The running part has been checked already by mi_run_cmd
53 -re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dct_end\"\}\r\n$mi_gdb_prompt$" {
54 pass "run to do_children_tests"
56 -re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"}
57 timeout {fail "run to do_children_tests (timeout 2)"}
66 # Test: c_variable-6.1
67 # Desc: create variable bar
68 mi_gdb_test "-var-create bar * bar" \
69 "\\^done,name=\"bar\",numchild=\"0\",type=\"int\"" \
70 "create local variable bar"
72 # Test: c_variable-6.2
73 # Desc: type of variable bar
74 mi_gdb_test "-var-info-type bar" \
75 "\\^done,type=\"int\"" \
76 "info type variable bar"
78 # Test: c_variable-6.3
79 # Desc: format of variable bar
80 mi_gdb_test "-var-show-format bar" \
81 "\\^done,format=\"natural\"" \
82 "show format variable bar"
84 # Test: c_variable-6.4
85 # Desc: value of variable bar
86 mi_gdb_test "-var-evaluate-expression bar" \
87 "\\^done,value=\"2121\"" \
90 # Test: c_variable-6.5
91 # Desc: change format of bar to hex
92 mi_gdb_test "-var-set-format bar hexadecimal" \
93 "\\^done,format=\"hexadecimal\"" \
94 "set format variable bar"
96 # Test: c_variable-6.6
97 # Desc: value of bar with new format
98 mi_gdb_test "-var-evaluate-expression bar" \
99 "\\^done,value=\"0x849\"" \
100 "eval variable bar with new format"
102 # Test: c_variable-6.7
103 # Desc: change value of bar
104 mi_gdb_test "-var-assign bar 3" \
105 "\\^done,value=\"0x3\"" \
106 "assing to variable bar"
108 mi_gdb_test "-var-set-format bar decimal" \
109 "\\^done,format=\"decimal\"" \
110 "set format variable bar"
112 mi_gdb_test "-var-evaluate-expression bar" \
113 "\\^done,value=\"3\"" \
114 "eval variable bar with new value"
116 mi_gdb_test "-var-delete bar" \
117 "\\^done,ndeleted=\"1\"" \
120 # Test: c_variable-6.11
121 # Desc: create variable foo
122 mi_gdb_test "-var-create foo * foo" \
123 "\\^done,name=\"foo\",numchild=\"1\",type=\"int \\*\"" \
124 "create local variable foo"
126 # Test: c_variable-6.12
127 # Desc: type of variable foo
128 mi_gdb_test "-var-info-type foo" \
129 "\\^done,type=\"int \\*\"" \
130 "info type variable foo"
132 # Test: c_variable-6.13
133 # Desc: format of variable foo
134 mi_gdb_test "-var-show-format foo" \
135 "\\^done,format=\"natural\"" \
136 "show format variable foo"
138 # Test: c_variable-6.14
139 # Desc: value of variable foo
140 mi_gdb_test "-var-evaluate-expression foo" \
141 "\\^done,value=\"$hex\"" \
144 # Test: c_variable-6.15
145 # Desc: change format of var to octal
146 mi_gdb_test "-var-set-format foo octal" \
147 "\\^done,format=\"octal\"" \
148 "set format variable foo"
150 mi_gdb_test "-var-show-format foo" \
151 "\\^done,format=\"octal\"" \
152 "show format variable foo"
154 # Test: c_variable-6.16
155 # Desc: value of foo with new format
156 mi_gdb_test "-var-evaluate-expression foo" \
157 "\\^done,value=\"\[0-7\]+\"" \
160 # Test: c_variable-6.17
161 # Desc: change value of foo
162 mi_gdb_test "-var-assign foo 3" \
163 "\\^done,value=\"03\"" \
164 "assing to variable foo"
166 mi_gdb_test "-var-set-format foo decimal" \
167 "\\^done,format=\"decimal\"" \
168 "set format variable foo"
170 # Test: c_variable-6.18
171 # Desc: check new value of foo
172 mi_gdb_test "-var-evaluate-expression foo" \
173 "\\^done,value=\"3\"" \
176 mi_gdb_test "-var-delete foo" \
177 "\\^done,ndeleted=\"1\"" \
180 # Test: c_variable-6.21
181 # Desc: create variable weird and children
182 mi_gdb_test "-var-create weird * weird" \
183 "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \
184 "create local variable weird"
186 mi_gdb_test "-var-list-children weird" \
187 "\\^done,numchild=\"11\",children=\\\[child=\{name=\"weird.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"weird.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child={name=\"weird.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"weird.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"weird.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"weird.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void|)\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\\\]" \
188 "get children local variable weird"
191 # Test: c_variable-6.23
192 # Desc: change format of weird.func_ptr and weird.func_ptr_ptr
193 mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
194 "\\^done,format=\"hexadecimal\"" \
195 "set format variable weird.func_ptr"
197 mi_gdb_test "-var-show-format weird.func_ptr" \
198 "\\^done,format=\"hexadecimal\"" \
199 "show format variable weird.func_ptr"
201 mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
202 "\\^done,format=\"hexadecimal\"" \
203 "set format variable weird.func_ptr_ptr"
205 mi_gdb_test "-var-show-format weird.func_ptr_ptr" \
206 "\\^done,format=\"hexadecimal\"" \
207 "show format variable weird.func_ptr_ptr"
209 # Test: c_variable-6.24
210 # Desc: format of weird and children
211 mi_gdb_test "-var-set-format weird natural" \
212 "\\^done,format=\"natural\"" \
213 "set format variable weird"
215 mi_gdb_test "-var-set-format weird.integer natural" \
216 "\\^done,format=\"natural\"" \
217 "set format variable weird.integer"
219 mi_gdb_test "-var-set-format weird.character natural" \
220 "\\^done,format=\"natural\"" \
221 "set format variable weird.character"
223 mi_gdb_test "-var-set-format weird.char_ptr natural" \
224 "\\^done,format=\"natural\"" \
225 "set format variable weird.char_ptr"
227 mi_gdb_test "-var-set-format weird.long_int natural" \
228 "\\^done,format=\"natural\"" \
229 "set format variable weird.long_int"
231 mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \
232 "\\^done,format=\"natural\"" \
233 "set format variable weird.int_ptr_ptr"
235 mi_gdb_test "-var-set-format weird.long_array natural" \
236 "\\^done,format=\"natural\"" \
237 "set format variable weird.long_array"
239 mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
240 "\\^done,format=\"hexadecimal\"" \
241 "set format variable weird.func_ptr"
243 mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \
244 "\\^done,format=\"hexadecimal\"" \
245 "set format variable weird.func_ptr_struct"
247 mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
248 "\\^done,format=\"natural\"" \
249 "set format variable weird.func_ptr_ptr"
251 mi_gdb_test "-var-set-format weird.u1 natural" \
252 "\\^done,format=\"natural\"" \
253 "set format variable weird.u1"
255 mi_gdb_test "-var-set-format weird.s2 natural" \
256 "\\^done,format=\"natural\"" \
257 "set format variable weird.s2"
259 # Test: c_variable-6.25
260 # Desc: value of weird and children
261 #gdbtk_test c_variable-6.25 {value of weird and children} {
263 # foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] {
264 # lappend values [value $v $f]
268 #} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1}
270 # Test: c_variable-6.26
271 # Desc: change format of weird and children to octal
272 #gdbtk_test c_variable-6.26 {change format of weird and children to octal} {
274 # foreach v [lsort [array names var]] {
275 # $var($v) format octal
276 # lappend formats [$var($v) format]
280 #} {octal octal octal octal octal octal octal octal octal octal octal octal}
282 # Test: c_variable-6.27
283 # Desc: value of weird and children with new format
284 #gdbtk_test c_variable-6.27 {value of foo with new format} {
286 # foreach v [lsort [array names var]] {
287 # lappend values [value $v o]
291 #} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1}
293 # Test: c_variable-6.30
294 # Desc: create more children of weird
295 #gdbtk_test c_variable-6.30 {create more children of weird} {
296 # foreach v [array names var] {
300 # # Do it twice to get more children
301 # foreach v [array names var] {
305 # lsort [array names var]
306 #} {weird weird.char_ptr weird.character weird.func_ptr weird.func_ptr_ptr weird.func_ptr_struct weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.integer weird.long_array weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.long_int weird.s2 weird.s2.g weird.s2.h weird.s2.i weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9 weird.s2.u2 weird.s2.u2.f weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.u1 weird.u1.a weird.u1.b weird.u1.c weird.u1.d}
308 # Test: c_variable-6.31
309 # Desc: check that all children of weird change
310 # Ok, obviously things like weird.s2 and weird.u1 will not change!
311 #gdbtk_test *c_variable-6.31 {check that all children of weird change (ops, we are now reporting array names as changed in this case - seems harmless though)} {
312 # $var(weird) value 0x2121
314 #} {{weird.integer weird.character weird.char_ptr weird.long_int weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.func_ptr weird.func_ptr_struct weird.func_ptr_ptr weird.u1.a weird.u1.b weird.u1.c weird.u1.d weird.s2.u2.f weird.s2.g weird.s2.h weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9} {weird.s2.i weird.s2.u2 weird weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.s2 weird.long_array weird.u1} {}}
316 mi_gdb_test "-var-delete weird" \
317 "\\^done,ndeleted=\"12\"" \
323 # Special Display Tests #
327 # Stop in "do_special_tests"
329 set line_dst_a_1 [gdb_get_line_number "a = 1;"]
331 mi_gdb_test "200-break-insert do_special_tests" \
332 "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_a_1\",times=\"0\"\}" \
333 "break-insert operation"
335 send_gdb "-exec-continue\n"
337 -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dst_a_1\"\}\r\n$mi_gdb_prompt$" {
338 pass "continue to do_special_tests"
341 fail "continue to do_special_tests (timeout)"
345 # Test: c_variable-7.10
346 # Desc: create union u
347 mi_gdb_test "-var-create u * u" \
348 "\\^done,name=\"u\",numchild=\"2\",type=\"union named_union\"" \
349 "create local variable u"
351 # Test: c_variable-7.11
353 mi_gdb_test "-var-evaluate-expression u" \
354 "\\^done,value=\"\{\\.\\.\\.\}\"" \
357 # Test: c_variable-7.12
359 mi_gdb_test "-var-info-type u" \
360 "\\^done,type=\"union named_union\"" \
361 "info type variable u"
363 # Test: c_variable-7.13
364 # Desc: is u editable
365 mi_gdb_test "-var-show-attributes u" \
366 "\\^done,attr=\"noneditable\"" \
369 # Test: c_variable-7.14
370 # Desc: number of children of u
371 mi_gdb_test "-var-info-num-children u" \
372 "\\^done,numchild=\"2\"" \
373 "get number of children of u"
375 # Test: c_variable-7.15
376 # Desc: children of u
377 mi_gdb_test "-var-list-children u" \
378 "\\^done,numchild=\"2\",children=\\\[child=\{name=\"u.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"u.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\}\\\]" \
381 # Test: c_variable-7.20
383 mi_gdb_test "-var-create anonu * anonu" \
384 "\\^done,name=\"anonu\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"" \
385 "create local variable anonu"
387 # Test: c_variable-7.21
388 # Desc: value of anonu
389 mi_gdb_test "-var-evaluate-expression anonu" \
390 "\\^done,value=\"\{\\.\\.\\.\}\"" \
391 "eval variable anonu"
393 # Test: c_variable-7.22
394 # Desc: type of anonu
395 mi_gdb_test "-var-info-type anonu" \
396 "\\^done,type=\"union \{\\.\\.\\.\}\"" \
397 "info type variable anonu"
399 # Test: c_variable-7.23
400 # Desc: is anonu editable
401 mi_gdb_test "-var-show-attributes anonu" \
402 "\\^done,attr=\"noneditable\"" \
405 # Test: c_variable-7.24
406 # Desc: number of children of anonu
407 mi_gdb_test "-var-info-num-children anonu" \
408 "\\^done,numchild=\"3\"" \
409 "get number of children of anonu"
411 # Test: c_variable-7.25
412 # Desc: children of anonu
413 mi_gdb_test "-var-list-children anonu" \
414 "\\^done,numchild=\"3\",children=\\\[child=\{name=\"anonu.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"anonu.b\",exp=\"b\",numchild=\"0\",type=\"char\"\},child=\{name=\"anonu.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\}\\\]" \
415 "get children of anonu"
417 # Test: c_variable-7.30
418 # Desc: create struct s
419 mi_gdb_test "-var-create s * s" \
420 "\\^done,name=\"s\",numchild=\"6\",type=\"struct _simple_struct\"" \
421 "create local variable s"
424 # Test: c_variable-7.31
426 mi_gdb_test "-var-evaluate-expression s" \
427 "\\^done,value=\"\{\\.\\.\\.\}\"" \
430 # Test: c_variable-7.32
432 mi_gdb_test "-var-info-type s" \
433 "\\^done,type=\"struct _simple_struct\"" \
434 "info type variable s"
436 # Test: c_variable-7.33
437 # Desc: is s editable
438 mi_gdb_test "-var-show-attributes s" \
439 "\\^done,attr=\"noneditable\"" \
442 # Test: c_variable-7.34
443 # Desc: number of children of s
444 mi_gdb_test "-var-info-num-children s" \
445 "\\^done,numchild=\"6\"" \
446 "get number of children of s"
448 # Test: c_variable-7.35
449 # Desc: children of s
450 mi_gdb_test "-var-list-children s" \
451 "\\^done,numchild=\"6\",children=\\\[child=\{name=\"s.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"s.unsigned_integer\",exp=\"unsigned_integer\",numchild=\"0\",type=\"unsigned int\"\},child=\{name=\"s.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child=\{name=\"s.signed_character\",exp=\"signed_character\",numchild=\"0\",type=\"signed char\"\},child=\{name=\"s.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"s.array_of_10\",exp=\"array_of_10\",numchild=\"10\",type=\"int \\\[10\\\]\"\}\\\]" \
453 #} {integer unsigned_integer character signed_character char_ptr array_of_10}
455 # Test: c_variable-7.40
457 mi_gdb_test "-var-create anons * anons" \
458 "\\^done,name=\"anons\",numchild=\"3\",type=\"struct \{\\.\\.\\.\}\"" \
459 "create local variable anons"
461 # Test: c_variable-7.41
462 # Desc: value of anons
463 mi_gdb_test "-var-evaluate-expression anons" \
464 "\\^done,value=\"\{\\.\\.\\.\}\"" \
465 "eval variable anons"
467 # Test: c_variable-7.42
468 # Desc: type of anons
469 mi_gdb_test "-var-info-type anons" \
470 "\\^done,type=\"struct \{\\.\\.\\.\}\"" \
471 "info type variable anons"
473 # Test: c_variable-7.43
474 # Desc: is anons editable
475 mi_gdb_test "-var-show-attributes anons" \
476 "\\^done,attr=\"noneditable\"" \
479 # Test: c_variable-7.44
480 # Desc: number of children of anons
481 mi_gdb_test "-var-info-num-children anons" \
482 "\\^done,numchild=\"3\"" \
483 "get number of children of anons"
485 # Test: c_variable-7.45
486 # Desc: children of anons
487 mi_gdb_test "-var-list-children anons" \
488 "\\^done,numchild=\"3\",children=\\\[child=\{name=\"anons.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"anons.b\",exp=\"b\",numchild=\"0\",type=\"char\"\},child=\{name=\"anons.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\}\\\]" \
489 "get children of anons"
492 # Test: c_variable-7.50
493 # Desc: create enum e
494 mi_gdb_test "-var-create e * e" \
495 "\\^done,name=\"e\",numchild=\"0\",type=\"enum foo\"" \
496 "create local variable e"
499 # Test: c_variable-7.51
501 mi_gdb_test "-var-evaluate-expression e" \
502 "\\^done,value=\"FIXME\"" \
506 # Test: c_variable-7.52
508 mi_gdb_test "-var-info-type e" \
509 "\\^done,type=\"enum foo\"" \
510 "info type variable e"
512 # Test: c_variable-7.53
513 # Desc: is e editable
514 mi_gdb_test "-var-show-attributes e" \
515 "\\^done,attr=\"editable\"" \
518 # Test: c_variable-7.54
519 # Desc: number of children of e
520 mi_gdb_test "-var-info-num-children e" \
521 "\\^done,numchild=\"0\"" \
522 "get number of children of e"
524 # Test: c_variable-7.55
525 # Desc: children of e
526 mi_gdb_test "-var-list-children e" \
527 "\\^done,numchild=\"0\"" \
530 # Test: c_variable-7.60
532 mi_gdb_test "-var-create anone * anone" \
533 "\\^done,name=\"anone\",numchild=\"0\",type=\"enum \{\\.\\.\\.\}\"" \
534 "create local variable anone"
537 # Test: c_variable-7.61
538 # Desc: value of anone
539 mi_gdb_test "-var-evaluate-expression anone" \
540 "\\^done,value=\"A\"" \
541 "eval variable anone"
545 # Test: c_variable-7.70
547 mi_gdb_test "-var-create anone * anone" \
548 "&\"Duplicate variable object name\\\\n\".*\\^error,msg=\"Duplicate variable object name\"" \
549 "create duplicate local variable anone"
552 # Test: c_variable-7.72
553 # Desc: type of anone
554 mi_gdb_test "-var-info-type anone" \
555 "\\^done,type=\"enum \{\\.\\.\\.\}\"" \
556 "info type variable anone"
559 # Test: c_variable-7.73
560 # Desc: is anone editable
561 mi_gdb_test "-var-show-attributes anone" \
562 "\\^done,attr=\"editable\"" \
565 # Test: c_variable-7.74
566 # Desc: number of children of anone
567 mi_gdb_test "-var-info-num-children anone" \
568 "\\^done,numchild=\"0\"" \
569 "get number of children of anone"
571 # Test: c_variable-7.75
572 # Desc: children of anone
573 mi_gdb_test "-var-list-children anone" \
574 "\\^done,numchild=\"0\"" \
575 "get children of anone"
580 send_gdb "p/x \$fp\n"
582 -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" {
583 pass "print FP register"
584 set fp $expect_out(1,string)
586 # -re ".*" { fail "print FP register"}
587 timeout { fail "print FP register (timeout)"}
590 set line_incr_a_b_a [gdb_get_line_number "b = a;"]
592 mi_gdb_test "200-break-insert incr_a" \
593 "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"$line_incr_a_b_a\",times=\"0\"\}" \
594 "break-insert operation"
595 send_gdb "-exec-continue\n"
597 -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"2\.*\"\}\\\],file=\".*var-cmd.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_incr_a_b_a\"\}\r\n$mi_gdb_prompt$" {
598 pass "continue to incr_a"
600 -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"([expr $line_incr_a_b_a - 2]|[expr $line_incr_a_b_a - 1]|$line_incr_a_b_a)\"\}\r\n$mi_gdb_prompt$" {
601 fail "continue to incr_a (compiler debug info incorrect)"
603 -re "\\^running\r\n${mi_gdb_prompt}.*\r\n$mi_gdb_prompt$" {
604 fail "continue to incr_a (unknown output)"
607 fail "continue to incr_a (timeout)"
611 # Test: c_variable-7.81
612 # Desc: Create variables in different scopes
613 mi_gdb_test "-var-create a1 * a" \
614 "\\^done,name=\"a1\",numchild=\"0\",type=\"char\"" \
615 "create local variable a1"
617 mi_gdb_test "-var-create a2 $fp a" \
618 "\\^done,name=\"a2\",numchild=\"0\",type=\"int\"" \
619 "create variable a2 in different scope"
621 #gdbtk_test c_variable-7.81 {create variables in different scopes} {
622 # set a1 [gdb_variable create -expr a]
623 # set a2 [gdb_variable create -expr a -frame $fp]
626 # lappend vals [$a1 value]
627 # lappend vals [$a2 value]