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