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