daily update
[external/binutils.git] / gdb / testsuite / gdb.mi / mi2-var-display.exp
1 # Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
2 # Free Software Foundation, Inc.
3 #
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 3 of the License, or
7 # (at your option) any later version.
8 #
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.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Test essential Machine interface (MI) operations
18 #
19 # Verify that, using the MI, we can create, update, delete variables.
20 #
21
22
23 load_lib mi-support.exp
24 set MIFLAGS "-i=mi2"
25
26 gdb_exit
27 if [mi_gdb_start] {
28     continue
29 }
30
31 set testfile "var-cmd"
32 set srcfile ${testfile}.c
33 set binfile ${objdir}/${subdir}/${testfile}
34 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
35     untested mi2-var-display.exp
36     return -1
37 }
38
39 mi_delete_breakpoints
40 mi_gdb_reinitialize_dir $srcdir/$subdir
41 mi_gdb_load ${binfile}
42
43 set line_dct_end [gdb_get_line_number "{int a = 0;}"]
44
45 mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \
46     "break-insert operation"
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"
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"
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"
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"
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"
137
138 mi_gdb_test "-var-show-format foo" \
139         "\\^done,format=\"octal\"" \
140         "show format variable foo"
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"
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"
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"
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 '\\\\\\\\0'\"" \
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=\"0\"" \
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 in "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 setup_xfail "*-*-*"
532 # Test: c_variable-7.51
533 # Desc: value of e
534 mi_gdb_test "-var-evaluate-expression e" \
535         "\\^done,value=\"FIXME\"" \
536         "eval variable e"
537 clear_xfail "*-*-*"
538
539 # Test: c_variable-7.52
540 # Desc: type of e
541 mi_gdb_test "-var-info-type e" \
542         "\\^done,type=\"enum foo\"" \
543         "info type variable e"
544
545 # Test: c_variable-7.53
546 # Desc: is e editable
547 mi_gdb_test "-var-show-attributes e" \
548         "\\^done,attr=\"editable\"" \
549         "is e editable"
550
551 # Test: c_variable-7.54
552 # Desc: number of children of e
553 mi_gdb_test "-var-info-num-children e" \
554         "\\^done,numchild=\"0\"" \
555         "get number of children of e"
556
557 # Test: c_variable-7.55
558 # Desc: children of e
559 mi_gdb_test "-var-list-children e" \
560         "\\^done,numchild=\"0\"" \
561         "get children of e"
562
563 # Test: c_variable-7.60
564 # Desc: create anone
565 mi_create_varobj anone anone "create local variable anone"
566
567 # Test: c_variable-7.61
568 # Desc: value of anone
569 mi_gdb_test "-var-evaluate-expression anone" \
570         "\\^done,value=\"A\"" \
571         "eval variable anone"
572
573 # Test: c_variable-7.70
574 # Desc: create anone
575 mi_gdb_test "-var-create anone * anone" \
576         "\\^error,msg=\"Duplicate variable object name\"" \
577         "create duplicate local variable anone"
578
579
580 # Test: c_variable-7.72
581 # Desc: type of anone
582 mi_gdb_test "-var-info-type anone" \
583         "\\^done,type=\"enum \{\\.\\.\\.\}\"" \
584         "info type variable anone"
585
586
587 # Test: c_variable-7.73
588 # Desc: is anone editable
589 mi_gdb_test "-var-show-attributes anone" \
590         "\\^done,attr=\"editable\"" \
591         "is anone editable"
592
593 # Test: c_variable-7.74
594 # Desc: number of children of anone
595 mi_gdb_test "-var-info-num-children anone" \
596         "\\^done,numchild=\"0\"" \
597         "get number of children of anone"
598
599 # Test: c_variable-7.75
600 # Desc: children of anone
601 mi_gdb_test "-var-list-children anone" \
602         "\\^done,numchild=\"0\"" \
603         "get children of anone"
604
605
606 # Record fp
607
608 send_gdb "p/x \$fp\n"
609 gdb_expect {
610     -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" { 
611         pass "print FP register"
612         set fp $expect_out(1,string) 
613     }
614 #    -re ".*" { fail "print FP register"}
615     timeout { fail "print FP register (timeout)"}
616 }
617
618 mi_continue_to "incr_a"
619
620 # Test: c_variable-7.81
621 # Desc: Create variables in different scopes
622 mi_gdb_test "-var-create a1 * a" \
623         "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \
624         "create local variable a1"
625
626 mi_gdb_test "-var-create a2 $fp a" \
627         "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \
628         "create variable a2 in different scope"
629
630 #gdbtk_test c_variable-7.81 {create variables in different scopes} {
631 #  set a1 [gdb_variable create -expr a]
632 #  set a2 [gdb_variable create -expr a -frame $fp]
633
634 #  set vals {}
635 #  lappend vals [$a1 value]
636 #  lappend vals [$a2 value]
637 #  set vals
638 #} {2 1}
639
640
641 mi_gdb_exit
642 return 0