]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.mi/mi-var-display.exp
Make test messages in gdb.mi/mi-var-display.exp unique
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-var-display.exp
1 # Copyright 1999-2014 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 3 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, see <http://www.gnu.org/licenses/>.
15
16 # Test essential Machine interface (MI) operations
17 #
18 # Verify that, using the MI, we can create, update, delete variables.
19 #
20
21
22 load_lib mi-support.exp
23 set MIFLAGS "-i=mi"
24
25 gdb_exit
26 if [mi_gdb_start] {
27 continue
28 }
29
30 standard_testfile var-cmd.c
31
32 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
33 untested mi-var-display.exp
34 return -1
35 }
36
37 mi_delete_breakpoints
38 mi_gdb_reinitialize_dir $srcdir/$subdir
39 mi_gdb_load ${binfile}
40
41 set line_dct_end [gdb_get_line_number "{int a = 0;}"]
42
43 mi_create_breakpoint "$srcfile:$line_dct_end" \
44 "break-insert operation" \
45 -number 1 -func do_children_tests -file ".*var-cmd.c" \
46 -line $line_dct_end
47
48 mi_run_cmd
49 mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \
50 $line_dct_end { "" "disp=\"keep\"" } "run to main"
51
52 ##### #####
53 # #
54 # Display tests #
55 # #
56 ##### #####
57
58 # Test: c_variable-6.1
59 # Desc: create variable bar
60 mi_create_varobj bar bar "create local variable bar"
61
62 # Test: c_variable-6.2
63 # Desc: type of variable bar
64 mi_gdb_test "-var-info-type bar" \
65 "\\^done,type=\"int\"" \
66 "info type variable bar"
67
68 # Test: c_variable-6.3
69 # Desc: format of variable bar
70 mi_gdb_test "-var-show-format bar" \
71 "\\^done,format=\"natural\"" \
72 "show format variable bar"
73
74 # Test: c_variable-6.4
75 # Desc: value of variable bar
76 mi_gdb_test "-var-evaluate-expression bar" \
77 "\\^done,value=\"2121\"" \
78 "eval variable bar"
79
80 # Test: c_variable-6.5
81 # Desc: change format of bar to hex
82 mi_gdb_test "-var-set-format bar hexadecimal" \
83 "\\^done,format=\"hexadecimal\",value=\"0x849\"" \
84 "set format variable bar in hex"
85
86 # Test: c_variable-6.6
87 # Desc: value of bar with new format
88 mi_gdb_test "-var-evaluate-expression bar" \
89 "\\^done,value=\"0x849\"" \
90 "eval variable bar with new format"
91
92 # Test: c_variable-6.7
93 # Desc: change value of bar
94 mi_gdb_test "-var-assign bar 3" \
95 "\\^done,value=\"0x3\"" \
96 "assing to variable bar"
97
98 mi_gdb_test "-var-set-format bar decimal" \
99 "\\^done,format=\"decimal\",value=\"3\"" \
100 "set format variable bar in decimal"
101
102 mi_gdb_test "-var-evaluate-expression bar" \
103 "\\^done,value=\"3\"" \
104 "eval variable bar with new value"
105
106 mi_gdb_test "-var-delete bar" \
107 "\\^done,ndeleted=\"1\"" \
108 "delete var bar"
109
110 # Test: c_variable-6.11
111 # Desc: create variable foo
112 mi_create_varobj foo foo "create local variable foo"
113
114 # Test: c_variable-6.12
115 # Desc: type of variable foo
116 mi_gdb_test "-var-info-type foo" \
117 "\\^done,type=\"int \\*\"" \
118 "info type variable foo"
119
120 # Test: c_variable-6.13
121 # Desc: format of variable foo
122 mi_gdb_test "-var-show-format foo" \
123 "\\^done,format=\"natural\"" \
124 "show format variable foo in natural"
125
126 # Test: c_variable-6.14
127 # Desc: value of variable foo
128 mi_gdb_test "-var-evaluate-expression foo" \
129 "\\^done,value=\"$hex\"" \
130 "eval variable foo in natural"
131
132 # Test: c_variable-6.15
133 # Desc: change format of var to octal
134 mi_gdb_test "-var-set-format foo octal" \
135 "\\^done,format=\"octal\",value=\"$octal\"" \
136 "set format variable foo in octal"
137
138 mi_gdb_test "-var-show-format foo" \
139 "\\^done,format=\"octal\"" \
140 "show format variable foo in octal"
141
142 # Test: c_variable-6.16
143 # Desc: value of foo with new format
144 mi_gdb_test "-var-evaluate-expression foo" \
145 "\\^done,value=\"\[0-7\]+\"" \
146 "eval variable foo in octal"
147
148 # Test: c_variable-6.17
149 # Desc: change value of foo
150 mi_gdb_test "-var-assign foo 3" \
151 "\\^done,value=\"03\"" \
152 "assing to variable foo"
153
154 mi_gdb_test "-var-set-format foo decimal" \
155 "\\^done,format=\"decimal\",value=\"3\"" \
156 "set format variable foo decimal"
157
158 # Test: c_variable-6.18
159 # Desc: check new value of foo
160 mi_gdb_test "-var-evaluate-expression foo" \
161 "\\^done,value=\"3\"" \
162 "eval variable foo in decimal"
163
164
165 # Test: c_variable-6.19
166 # Desc: check optional format parameter of var-evaluate-expression
167 # and check that current format is not changed
168 mi_gdb_test "-var-evaluate-expression -f hex foo" \
169 "\\^done,value=\"0x3\"" \
170 "eval variable foo in hex"
171
172 mi_gdb_test "-var-show-format foo" \
173 "\\^done,format=\"decimal\"" \
174 "show format variable foo after eval in hex"
175
176 mi_gdb_test "-var-evaluate-expression -f octal foo" \
177 "\\^done,value=\"03\"" \
178 "eval variable -f octal foo"
179
180 mi_gdb_test "-var-show-format foo" \
181 "\\^done,format=\"decimal\"" \
182 "show format variable foo after eval in octal"
183
184 mi_gdb_test "-var-evaluate-expression -f decimal foo" \
185 "\\^done,value=\"3\"" \
186 "eval variable -f decimal foo"
187
188 mi_gdb_test "-var-show-format foo" \
189 "\\^done,format=\"decimal\"" \
190 "show format variable foo after eval in decimal"
191
192 mi_gdb_test "-var-evaluate-expression -f nat foo" \
193 "\\^done,value=\"0x3\"" \
194 "eval variable -f nat foo"
195
196 mi_gdb_test "-var-show-format foo" \
197 "\\^done,format=\"decimal\"" \
198 "show format variable foo after eval in natural"
199
200 mi_gdb_test "-var-evaluate-expression -f bin foo" \
201 "\\^done,value=\"11\"" \
202 "eval variable foo in binary"
203
204 mi_gdb_test "-var-show-format foo" \
205 "\\^done,format=\"decimal\"" \
206 "show format variable foo after eval in binary"
207
208 mi_gdb_test "-var-delete foo" \
209 "\\^done,ndeleted=\"1\"" \
210 "delete var foo"
211
212 # Test: c_variable-6.21
213 # Desc: create variable weird and children
214 mi_create_varobj weird weird "create local variable weird"
215
216 mi_list_varobj_children weird {
217 {weird.integer integer 0 int}
218 {weird.character character 0 char}
219 {weird.char_ptr char_ptr 1 "char \\*"}
220 {weird.long_int long_int 0 "long"}
221 {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
222 {weird.long_array long_array 10 "long \\[10\\]"}
223 {weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
224 {weird.func_ptr_struct func_ptr_struct 0 \
225 "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long\\))?"}
226 {weird.func_ptr_ptr func_ptr_ptr 0 \
227 "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long)?\\)"}
228 {weird.u1 u1 4 "union \\{\\.\\.\\.\\}"}
229 {weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
230 } "get children local variable weird"
231
232
233 # Test: c_variable-6.23
234 # Desc: change format of weird.func_ptr and weird.func_ptr_ptr
235 mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
236 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
237 "set format variable weird.func_ptr in hex (1)"
238
239 mi_gdb_test "-var-show-format weird.func_ptr" \
240 "\\^done,format=\"hexadecimal\"" \
241 "show format variable weird.func_ptr"
242
243 mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
244 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
245 "set format variable weird.func_ptr_ptr in hex"
246
247 mi_gdb_test "-var-show-format weird.func_ptr_ptr" \
248 "\\^done,format=\"hexadecimal\"" \
249 "show format variable weird.func_ptr_ptr"
250
251 # Test: c_variable-6.24
252 # Desc: format of weird and children
253 mi_gdb_test "-var-set-format weird natural" \
254 "\\^done,format=\"natural\",value=\"$hex\"" \
255 "set format variable weird"
256
257 mi_gdb_test "-var-set-format weird.integer natural" \
258 "\\^done,format=\"natural\",value=\"123\"" \
259 "set format variable weird.integer"
260
261 mi_gdb_test "-var-set-format weird.character natural" \
262 "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \
263 "set format variable weird.character"
264
265 mi_gdb_test "-var-set-format weird.char_ptr natural" \
266 "\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \
267 "set format variable weird.char_ptr"
268
269 mi_gdb_test "-var-set-format weird.long_int natural" \
270 "\\^done,format=\"natural\",value=\"0\"" \
271 "set format variable weird.long_int"
272
273 mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \
274 "\\^done,format=\"natural\",value=\"$hex\"" \
275 "set format variable weird.int_ptr_ptr"
276
277 mi_gdb_test "-var-set-format weird.long_array natural" \
278 "\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \
279 "set format variable weird.long_array"
280
281 mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
282 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
283 "set format variable weird.func_ptr in hex (2)"
284
285 mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \
286 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
287 "set format variable weird.func_ptr_struct"
288
289 mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
290 "\\^done,format=\"natural\",value=\"0x0\"" \
291 "set format variable weird.func_ptr_ptr in natural"
292
293 mi_gdb_test "-var-set-format weird.u1 natural" \
294 "\\^done,format=\"natural\",value=\"\{...\}\"" \
295 "set format variable weird.u1"
296
297 mi_gdb_test "-var-set-format weird.s2 natural" \
298 "\\^done,format=\"natural\",value=\"\{...\}\"" \
299 "set format variable weird.s2"
300
301 # Test: c_variable-6.25
302 # Desc: value of weird and children
303 #gdbtk_test c_variable-6.25 {value of weird and children} {
304 # set values {}
305 # foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] {
306 # lappend values [value $v $f]
307 # }
308
309 # set values
310 #} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1}
311
312 # Test: c_variable-6.26
313 # Desc: change format of weird and children to octal
314 #gdbtk_test c_variable-6.26 {change format of weird and children to octal} {
315 # set formats {}
316 # foreach v [lsort [array names var]] {
317 # $var($v) format octal
318 # lappend formats [$var($v) format]
319 # }
320
321 # set formats
322 #} {octal octal octal octal octal octal octal octal octal octal octal octal}
323
324 # Test: c_variable-6.27
325 # Desc: value of weird and children with new format
326 #gdbtk_test c_variable-6.27 {value of foo with new format} {
327 # set values {}
328 # foreach v [lsort [array names var]] {
329 # lappend values [value $v o]
330 # }
331
332 # set values
333 #} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1}
334
335 # Test: c_variable-6.30
336 # Desc: create more children of weird
337 #gdbtk_test c_variable-6.30 {create more children of weird} {
338 # foreach v [array names var] {
339 # get_children $v
340 # }
341
342 # # Do it twice to get more children
343 # foreach v [array names var] {
344 # get_children $v
345 # }
346
347 # lsort [array names var]
348 #} {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}
349
350 # Test: c_variable-6.31
351 # Desc: check that all children of weird change
352 # Ok, obviously things like weird.s2 and weird.u1 will not change!
353 #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)} {
354 # $var(weird) value 0x2121
355 # check_update
356 #} {{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} {}}
357
358 mi_gdb_test "-var-delete weird" \
359 "\\^done,ndeleted=\"12\"" \
360 "delete var weird"
361
362
363 ##### #####
364 # #
365 # Special Display Tests #
366 # #
367 ##### #####
368
369 # Stop at the end of "do_special_tests"
370
371 set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"]
372
373 mi_create_breakpoint "$line_dst_incr_a_2" \
374 "break-insert operation 2" \
375 -number 2 -func do_special_tests -file ".*var-cmd.c" \
376 -line $line_dst_incr_a_2
377
378 mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \
379 ".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \
380 "continue to do_special_tests"
381
382 # Test: c_variable-7.10
383 # Desc: create union u
384 mi_create_varobj u u "create local variable u"
385
386 # Test: c_variable-7.11
387 # Desc: value of u
388 mi_gdb_test "-var-evaluate-expression u" \
389 "\\^done,value=\"\{\\.\\.\\.\}\"" \
390 "eval variable u"
391
392 # Test: c_variable-7.12
393 # Desc: type of u
394 mi_gdb_test "-var-info-type u" \
395 "\\^done,type=\"union named_union\"" \
396 "info type variable u"
397
398 # Test: c_variable-7.13
399 # Desc: is u editable
400 mi_gdb_test "-var-show-attributes u" \
401 "\\^done,attr=\"noneditable\"" \
402 "is u editable"
403
404 # Test: c_variable-7.14
405 # Desc: number of children of u
406 mi_gdb_test "-var-info-num-children u" \
407 "\\^done,numchild=\"2\"" \
408 "get number of children of u"
409
410 # Test: c_variable-7.15
411 # Desc: children of u
412 mi_list_varobj_children u {
413 {u.integer integer 0 int}
414 {u.char_ptr char_ptr 1 {char \*}}
415 } "get children of u"
416
417 # Test: c_variable-7.20
418 # Desc: create anonu
419 mi_create_varobj anonu anonu "create local variable anonu"
420
421 # Test: c_variable-7.21
422 # Desc: value of anonu
423 mi_gdb_test "-var-evaluate-expression anonu" \
424 "\\^done,value=\"\{\\.\\.\\.\}\"" \
425 "eval variable anonu"
426
427 # Test: c_variable-7.22
428 # Desc: type of anonu
429 mi_gdb_test "-var-info-type anonu" \
430 "\\^done,type=\"union \{\\.\\.\\.\}\"" \
431 "info type variable anonu"
432
433 # Test: c_variable-7.23
434 # Desc: is anonu editable
435 mi_gdb_test "-var-show-attributes anonu" \
436 "\\^done,attr=\"noneditable\"" \
437 "is anonu editable"
438
439 # Test: c_variable-7.24
440 # Desc: number of children of anonu
441 mi_gdb_test "-var-info-num-children anonu" \
442 "\\^done,numchild=\"3\"" \
443 "get number of children of anonu"
444
445 # Test: c_variable-7.25
446 # Desc: children of anonu
447 mi_list_varobj_children "anonu" {
448 {anonu.a a 0 int}
449 {anonu.b b 0 char}
450 {anonu.c c 0 "long"}
451 } "get children of anonu"
452
453 # Test: c_variable-7.30
454 # Desc: create struct s
455 mi_create_varobj s s "create local variable s"
456
457
458 # Test: c_variable-7.31
459 # Desc: value of s
460 mi_gdb_test "-var-evaluate-expression s" \
461 "\\^done,value=\"\{\\.\\.\\.\}\"" \
462 "eval variable s"
463
464 # Test: c_variable-7.32
465 # Desc: type of s
466 mi_gdb_test "-var-info-type s" \
467 "\\^done,type=\"struct _simple_struct\"" \
468 "info type variable s"
469
470 # Test: c_variable-7.33
471 # Desc: is s editable
472 mi_gdb_test "-var-show-attributes s" \
473 "\\^done,attr=\"noneditable\"" \
474 "is s editable"
475
476 # Test: c_variable-7.34
477 # Desc: number of children of s
478 mi_gdb_test "-var-info-num-children s" \
479 "\\^done,numchild=\"6\"" \
480 "get number of children of s"
481
482 # Test: c_variable-7.35
483 # Desc: children of s
484 mi_list_varobj_children s {
485 {s.integer integer 0 int}
486 {s.unsigned_integer unsigned_integer 0 "unsigned int"}
487 {s.character character 0 char}
488 {s.signed_character signed_character 0 "signed char"}
489 {s.char_ptr char_ptr 1 {char \*}}
490 {s.array_of_10 array_of_10 10 {int \[10\]}}
491 } "get children of s"
492 #} {integer unsigned_integer character signed_character char_ptr array_of_10}
493
494 # Test: c_variable-7.40
495 # Desc: create anons
496 mi_create_varobj anons anons "create local variable anons"
497
498 # Test: c_variable-7.41
499 # Desc: value of anons
500 mi_gdb_test "-var-evaluate-expression anons" \
501 "\\^done,value=\"\{\\.\\.\\.\}\"" \
502 "eval variable anons"
503
504 # Test: c_variable-7.42
505 # Desc: type of anons
506 mi_gdb_test "-var-info-type anons" \
507 "\\^done,type=\"struct \{\\.\\.\\.\}\"" \
508 "info type variable anons"
509
510 # Test: c_variable-7.43
511 # Desc: is anons editable
512 mi_gdb_test "-var-show-attributes anons" \
513 "\\^done,attr=\"noneditable\"" \
514 "is anons editable"
515
516 # Test: c_variable-7.44
517 # Desc: number of children of anons
518 mi_gdb_test "-var-info-num-children anons" \
519 "\\^done,numchild=\"3\"" \
520 "get number of children of anons"
521
522 # Test: c_variable-7.45
523 # Desc: children of anons
524 mi_list_varobj_children anons {
525 {anons.a a 0 int}
526 {anons.b b 0 char}
527 {anons.c c 0 "long"}
528 } "get children of anons"
529
530 # Test: c_variable-7.50
531 # Desc: create enum e
532 mi_create_varobj e e "create local variable e"
533
534 # Test: c_variable-7.51
535 # Desc: value of e
536 mi_gdb_test "-var-evaluate-expression e" \
537 "\\^done,value=\"bar\"" \
538 "eval variable e"
539
540 # Test: c_variable-7.52
541 # Desc: type of e
542 mi_gdb_test "-var-info-type e" \
543 "\\^done,type=\"enum foo\"" \
544 "info type variable e"
545
546 # Test: c_variable-7.53
547 # Desc: is e editable
548 mi_gdb_test "-var-show-attributes e" \
549 "\\^done,attr=\"editable\"" \
550 "is e editable"
551
552 # Test: c_variable-7.54
553 # Desc: number of children of e
554 mi_gdb_test "-var-info-num-children e" \
555 "\\^done,numchild=\"0\"" \
556 "get number of children of e"
557
558 # Test: c_variable-7.55
559 # Desc: children of e
560 mi_gdb_test "-var-list-children e" \
561 "\\^done,numchild=\"0\",has_more=\"0\"" \
562 "get children of e"
563
564 # Test: c_variable-7.60
565 # Desc: create anone
566 mi_create_varobj anone anone "create local variable anone"
567
568 # Test: c_variable-7.61
569 # Desc: value of anone
570 mi_gdb_test "-var-evaluate-expression anone" \
571 "\\^done,value=\"A\"" \
572 "eval variable anone"
573
574 # Test: c_variable-7.70
575 # Desc: create anone
576 mi_gdb_test "-var-create anone * anone" \
577 "\\^error,msg=\"Duplicate variable object name\"" \
578 "create duplicate local variable anone"
579
580
581 # Test: c_variable-7.72
582 # Desc: type of anone
583 mi_gdb_test "-var-info-type anone" \
584 "\\^done,type=\"enum \{\\.\\.\\.\}\"" \
585 "info type variable anone"
586
587
588 # Test: c_variable-7.73
589 # Desc: is anone editable
590 mi_gdb_test "-var-show-attributes anone" \
591 "\\^done,attr=\"editable\"" \
592 "is anone editable"
593
594 # Test: c_variable-7.74
595 # Desc: number of children of anone
596 mi_gdb_test "-var-info-num-children anone" \
597 "\\^done,numchild=\"0\"" \
598 "get number of children of anone"
599
600 # Test: c_variable-7.75
601 # Desc: children of anone
602 mi_gdb_test "-var-list-children anone" \
603 "\\^done,numchild=\"0\",has_more=\"0\"" \
604 "get children of anone"
605
606
607 # Record fp
608 if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] {
609 set fp $expect_out(3,string)
610 }
611
612 mi_continue_to "incr_a"
613
614 # Test: c_variable-7.81
615 # Desc: Create variables in different scopes
616 mi_gdb_test "-var-create a1 * a" \
617 "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \
618 "create local variable a1"
619
620 if { [info exists fp] } {
621 mi_gdb_test "-var-create a2 $fp a" \
622 "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \
623 "create variable a2 in different scope"
624 } else {
625 untested "create variable a2 in different scope"
626 }
627
628 #gdbtk_test c_variable-7.81 {create variables in different scopes} {
629 # set a1 [gdb_variable create -expr a]
630 # set a2 [gdb_variable create -expr a -frame $fp]
631
632 # set vals {}
633 # lappend vals [$a1 value]
634 # lappend vals [$a2 value]
635 # set vals
636 #} {2 1}
637
638
639 mi_gdb_exit
640 return 0