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