* gdb.base/attach.exp (do_attach_tests): Matching pattern for
[external/binutils.git] / gdb / testsuite / gdb.mi / mi2-var-display.exp
1 # Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
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_gdb_test "200-break-insert $srcfile:$line_dct_end" \
46         "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\"\}" \
47         "break-insert operation"
48
49 mi_run_cmd
50 mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \
51         $line_dct_end { "" "disp=\"keep\"" } "run to main"
52
53 #####       #####
54 #               #
55 # Display tests #
56 #               #
57 #####       #####
58
59 # Test: c_variable-6.1
60 # Desc: create variable bar
61 mi_create_varobj bar bar "create local variable bar"
62
63 # Test: c_variable-6.2
64 # Desc: type of variable bar
65 mi_gdb_test "-var-info-type bar" \
66         "\\^done,type=\"int\"" \
67         "info type variable bar"
68
69 # Test: c_variable-6.3
70 # Desc: format of variable bar
71 mi_gdb_test "-var-show-format bar" \
72         "\\^done,format=\"natural\"" \
73         "show format variable bar"
74
75 # Test: c_variable-6.4
76 # Desc: value of variable bar
77 mi_gdb_test "-var-evaluate-expression bar" \
78         "\\^done,value=\"2121\"" \
79         "eval variable bar"
80
81 # Test: c_variable-6.5
82 # Desc: change format of bar to hex
83 mi_gdb_test "-var-set-format bar hexadecimal" \
84         "\\^done,format=\"hexadecimal\",value=\"0x849\"" \
85         "set format variable bar"
86
87 # Test: c_variable-6.6
88 # Desc: value of bar with new format
89 mi_gdb_test "-var-evaluate-expression bar" \
90         "\\^done,value=\"0x849\"" \
91         "eval variable bar with new format"
92
93 # Test: c_variable-6.7
94 # Desc: change value of bar
95 mi_gdb_test "-var-assign bar 3" \
96         "\\^done,value=\"0x3\"" \
97         "assing to variable bar"
98
99 mi_gdb_test "-var-set-format bar decimal" \
100         "\\^done,format=\"decimal\",value=\"3\"" \
101         "set format variable bar"
102
103 mi_gdb_test "-var-evaluate-expression bar" \
104         "\\^done,value=\"3\"" \
105         "eval variable bar with new value"
106
107 mi_gdb_test "-var-delete bar" \
108         "\\^done,ndeleted=\"1\"" \
109         "delete var bar"
110
111 # Test: c_variable-6.11
112 # Desc: create variable foo
113 mi_create_varobj foo foo "create local variable foo"
114
115 # Test: c_variable-6.12
116 # Desc: type of variable foo
117 mi_gdb_test "-var-info-type foo" \
118         "\\^done,type=\"int \\*\"" \
119         "info type variable foo"
120
121 # Test: c_variable-6.13
122 # Desc: format of variable foo
123 mi_gdb_test "-var-show-format foo" \
124         "\\^done,format=\"natural\"" \
125         "show format variable foo"
126
127 # Test: c_variable-6.14
128 # Desc: value of variable foo
129 mi_gdb_test "-var-evaluate-expression foo" \
130         "\\^done,value=\"$hex\"" \
131         "eval variable foo"
132
133 # Test: c_variable-6.15
134 # Desc: change format of var to octal
135 mi_gdb_test "-var-set-format foo octal" \
136         "\\^done,format=\"octal\",value=\"$octal\"" \
137         "set format variable foo"
138
139 mi_gdb_test "-var-show-format foo" \
140         "\\^done,format=\"octal\"" \
141         "show format variable foo"
142
143 # Test: c_variable-6.16
144 # Desc: value of foo with new format
145 mi_gdb_test "-var-evaluate-expression foo" \
146         "\\^done,value=\"\[0-7\]+\"" \
147         "eval variable foo"
148
149 # Test: c_variable-6.17
150 # Desc: change value of foo
151 mi_gdb_test "-var-assign foo 3" \
152         "\\^done,value=\"03\"" \
153         "assing to variable foo"
154
155 mi_gdb_test "-var-set-format foo decimal" \
156         "\\^done,format=\"decimal\",value=\"3\"" \
157         "set format variable foo"
158
159 # Test: c_variable-6.18
160 # Desc: check new value of foo
161 mi_gdb_test "-var-evaluate-expression foo" \
162         "\\^done,value=\"3\"" \
163         "eval variable foo"
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 foo in octal"
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 foo in decimal"
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 foo in natural"
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 int"}
221         {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
222         {weird.long_array long_array 10 "long int \\[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 int\\))?"}
226         {weird.func_ptr_ptr func_ptr_ptr 0 \
227                  "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"}
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"
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"
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 '\\\\\\\\0'\"" \
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"
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=\"0\"" \
291         "set format variable weird.func_ptr_ptr"
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 in "do_special_tests"
370
371 set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"]
372
373 mi_gdb_test "200-break-insert $line_dst_incr_a_2" \
374         "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_incr_a_2\",times=\"0\"\}" \
375         "break-insert operation"
376
377 mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \
378     ".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \
379     "continue to do_special_tests"
380
381 # Test: c_variable-7.10
382 # Desc: create union u
383 mi_create_varobj u u "create local variable u"
384
385 # Test: c_variable-7.11
386 # Desc: value of u
387 mi_gdb_test "-var-evaluate-expression u" \
388         "\\^done,value=\"\{\\.\\.\\.\}\"" \
389         "eval variable u"
390
391 # Test: c_variable-7.12
392 # Desc: type of u
393 mi_gdb_test "-var-info-type u" \
394         "\\^done,type=\"union named_union\"" \
395         "info type variable u"
396
397 # Test: c_variable-7.13
398 # Desc: is u editable
399 mi_gdb_test "-var-show-attributes u" \
400         "\\^done,attr=\"noneditable\"" \
401         "is u editable"
402
403 # Test: c_variable-7.14
404 # Desc: number of children of u
405 mi_gdb_test "-var-info-num-children u" \
406         "\\^done,numchild=\"2\"" \
407         "get number of children of u"
408
409 # Test: c_variable-7.15
410 # Desc: children of u
411 mi_list_varobj_children u {
412         {u.integer integer 0 int}
413         {u.char_ptr char_ptr 1 {char \*}}
414 } "get children of u"
415
416 # Test: c_variable-7.20
417 # Desc: create anonu
418 mi_create_varobj anonu anonu "create local variable anonu"
419
420 # Test: c_variable-7.21
421 # Desc: value of anonu
422 mi_gdb_test "-var-evaluate-expression anonu" \
423         "\\^done,value=\"\{\\.\\.\\.\}\"" \
424         "eval variable anonu"
425
426 # Test: c_variable-7.22
427 # Desc: type of anonu
428 mi_gdb_test "-var-info-type anonu" \
429         "\\^done,type=\"union \{\\.\\.\\.\}\"" \
430         "info type variable anonu"
431
432 # Test: c_variable-7.23
433 # Desc: is anonu editable
434 mi_gdb_test "-var-show-attributes anonu" \
435         "\\^done,attr=\"noneditable\"" \
436         "is anonu editable"
437
438 # Test: c_variable-7.24
439 # Desc: number of children of anonu
440 mi_gdb_test "-var-info-num-children anonu" \
441         "\\^done,numchild=\"3\"" \
442         "get number of children of anonu"
443
444 # Test: c_variable-7.25
445 # Desc: children of anonu
446 mi_list_varobj_children "anonu" {
447         {anonu.a a 0 int}
448         {anonu.b b 0 char}
449         {anonu.c c 0 "long int"}
450 } "get children of anonu"
451
452 # Test: c_variable-7.30
453 # Desc: create struct s
454 mi_create_varobj s s "create local variable s"
455
456
457 # Test: c_variable-7.31
458 # Desc: value of s
459 mi_gdb_test "-var-evaluate-expression s" \
460         "\\^done,value=\"\{\\.\\.\\.\}\"" \
461         "eval variable s"
462
463 # Test: c_variable-7.32
464 # Desc: type of s
465 mi_gdb_test "-var-info-type s" \
466         "\\^done,type=\"struct _simple_struct\"" \
467         "info type variable s"
468
469 # Test: c_variable-7.33
470 # Desc: is s editable
471 mi_gdb_test "-var-show-attributes s" \
472         "\\^done,attr=\"noneditable\"" \
473         "is s editable"
474
475 # Test: c_variable-7.34
476 # Desc: number of children of s
477 mi_gdb_test "-var-info-num-children s" \
478         "\\^done,numchild=\"6\"" \
479         "get number of children of s"
480
481 # Test: c_variable-7.35
482 # Desc: children of s
483 mi_list_varobj_children s {
484         {s.integer integer 0 int}
485         {s.unsigned_integer unsigned_integer 0 "unsigned int"}
486         {s.character character 0 char}
487         {s.signed_character signed_character 0 "signed char"}
488         {s.char_ptr char_ptr 1 {char \*}}
489         {s.array_of_10 array_of_10 10 {int \[10\]}}
490 } "get children of s"
491 #} {integer unsigned_integer character signed_character char_ptr array_of_10}
492
493 # Test: c_variable-7.40
494 # Desc: create anons
495 mi_create_varobj anons anons "create local variable anons"
496
497 # Test: c_variable-7.41
498 # Desc: value of anons
499 mi_gdb_test "-var-evaluate-expression anons" \
500         "\\^done,value=\"\{\\.\\.\\.\}\"" \
501         "eval variable anons"
502
503 # Test: c_variable-7.42
504 # Desc: type of anons
505 mi_gdb_test "-var-info-type anons" \
506         "\\^done,type=\"struct \{\\.\\.\\.\}\"" \
507         "info type variable anons"
508
509 # Test: c_variable-7.43
510 # Desc: is anons editable
511 mi_gdb_test "-var-show-attributes anons" \
512         "\\^done,attr=\"noneditable\"" \
513         "is anons editable"
514
515 # Test: c_variable-7.44
516 # Desc: number of children of anons
517 mi_gdb_test "-var-info-num-children anons" \
518         "\\^done,numchild=\"3\"" \
519         "get number of children of anons"
520
521 # Test: c_variable-7.45
522 # Desc: children of anons
523 mi_list_varobj_children anons {
524         {anons.a a 0 int}
525         {anons.b b 0 char}
526         {anons.c c 0 "long int"}
527 } "get children of anons"
528
529 # Test: c_variable-7.50
530 # Desc: create enum e
531 mi_create_varobj e e "create local variable e"
532
533 setup_xfail "*-*-*"
534 # Test: c_variable-7.51
535 # Desc: value of e
536 mi_gdb_test "-var-evaluate-expression e" \
537         "\\^done,value=\"FIXME\"" \
538         "eval variable e"
539 clear_xfail "*-*-*"
540
541 # Test: c_variable-7.52
542 # Desc: type of e
543 mi_gdb_test "-var-info-type e" \
544         "\\^done,type=\"enum foo\"" \
545         "info type variable e"
546
547 # Test: c_variable-7.53
548 # Desc: is e editable
549 mi_gdb_test "-var-show-attributes e" \
550         "\\^done,attr=\"editable\"" \
551         "is e editable"
552
553 # Test: c_variable-7.54
554 # Desc: number of children of e
555 mi_gdb_test "-var-info-num-children e" \
556         "\\^done,numchild=\"0\"" \
557         "get number of children of e"
558
559 # Test: c_variable-7.55
560 # Desc: children of e
561 mi_gdb_test "-var-list-children e" \
562         "\\^done,numchild=\"0\"" \
563         "get children of e"
564
565 # Test: c_variable-7.60
566 # Desc: create anone
567 mi_create_varobj anone anone "create local variable anone"
568
569 # Test: c_variable-7.61
570 # Desc: value of anone
571 mi_gdb_test "-var-evaluate-expression anone" \
572         "\\^done,value=\"A\"" \
573         "eval variable anone"
574
575 # Test: c_variable-7.70
576 # Desc: create anone
577 mi_gdb_test "-var-create anone * anone" \
578         "\\^error,msg=\"Duplicate variable object name\"" \
579         "create duplicate local variable anone"
580
581
582 # Test: c_variable-7.72
583 # Desc: type of anone
584 mi_gdb_test "-var-info-type anone" \
585         "\\^done,type=\"enum \{\\.\\.\\.\}\"" \
586         "info type variable anone"
587
588
589 # Test: c_variable-7.73
590 # Desc: is anone editable
591 mi_gdb_test "-var-show-attributes anone" \
592         "\\^done,attr=\"editable\"" \
593         "is anone editable"
594
595 # Test: c_variable-7.74
596 # Desc: number of children of anone
597 mi_gdb_test "-var-info-num-children anone" \
598         "\\^done,numchild=\"0\"" \
599         "get number of children of anone"
600
601 # Test: c_variable-7.75
602 # Desc: children of anone
603 mi_gdb_test "-var-list-children anone" \
604         "\\^done,numchild=\"0\"" \
605         "get children of anone"
606
607
608 # Record fp
609
610 send_gdb "p/x \$fp\n"
611 gdb_expect {
612     -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" { 
613         pass "print FP register"
614         set fp $expect_out(1,string) 
615     }
616 #    -re ".*" { fail "print FP register"}
617     timeout { fail "print FP register (timeout)"}
618 }
619
620 mi_continue_to "incr_a"
621
622 # Test: c_variable-7.81
623 # Desc: Create variables in different scopes
624 mi_gdb_test "-var-create a1 * a" \
625         "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \
626         "create local variable a1"
627
628 mi_gdb_test "-var-create a2 $fp a" \
629         "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \
630         "create variable a2 in different scope"
631
632 #gdbtk_test c_variable-7.81 {create variables in different scopes} {
633 #  set a1 [gdb_variable create -expr a]
634 #  set a2 [gdb_variable create -expr a -frame $fp]
635
636 #  set vals {}
637 #  lappend vals [$a1 value]
638 #  lappend vals [$a2 value]
639 #  set vals
640 #} {2 1}
641
642
643 mi_gdb_exit
644 return 0