]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - 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
CommitLineData
8acc9f48 1# Copyright 1999-2013 Free Software Foundation, Inc.
fb40c209 2#
e22f8b7c 3# This program is free software; you can redistribute it and/or modify
fb40c209 4# it under the terms of the GNU General Public License as published by
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
fb40c209
AC
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
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
fb40c209 15
fb40c209
AC
16# Test essential Machine interface (MI) operations
17#
18# Verify that, using the MI, we can create, update, delete variables.
19#
20
21
22load_lib mi-support.exp
b30bf9ee 23set MIFLAGS "-i=mi"
fb40c209
AC
24
25gdb_exit
26if [mi_gdb_start] {
27 continue
28}
29
298a9cf0
TT
30standard_testfile var-cmd.c
31
9357e021 32if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
b60f0898
JB
33 untested mi-var-display.exp
34 return -1
fb40c209
AC
35}
36
37mi_delete_breakpoints
38mi_gdb_reinitialize_dir $srcdir/$subdir
39mi_gdb_load ${binfile}
40
e1c2defa 41set line_dct_end [gdb_get_line_number "{int a = 0;}"]
469aff8e 42
d24317b4
VP
43mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \
44 "break-insert operation"
fb40c209
AC
45
46mi_run_cmd
18ac113b
AR
47mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \
48 $line_dct_end { "" "disp=\"keep\"" } "run to main"
fb40c209
AC
49
50##### #####
51# #
52# Display tests #
53# #
54##### #####
55
56# Test: c_variable-6.1
57# Desc: create variable bar
9e8e3afe 58mi_create_varobj bar bar "create local variable bar"
fb40c209
AC
59
60# Test: c_variable-6.2
61# Desc: type of variable bar
62mi_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
68mi_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
74mi_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
80mi_gdb_test "-var-set-format bar hexadecimal" \
7bf81d63 81 "\\^done,format=\"hexadecimal\",value=\"0x849\"" \
fb40c209
AC
82 "set format variable bar"
83
84# Test: c_variable-6.6
85# Desc: value of bar with new format
86mi_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
92mi_gdb_test "-var-assign bar 3" \
93 "\\^done,value=\"0x3\"" \
94 "assing to variable bar"
95
96mi_gdb_test "-var-set-format bar decimal" \
7bf81d63 97 "\\^done,format=\"decimal\",value=\"3\"" \
fb40c209
AC
98 "set format variable bar"
99
100mi_gdb_test "-var-evaluate-expression bar" \
101 "\\^done,value=\"3\"" \
102 "eval variable bar with new value"
103
104mi_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
9e8e3afe 110mi_create_varobj foo foo "create local variable foo"
fb40c209
AC
111
112# Test: c_variable-6.12
113# Desc: type of variable foo
114mi_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
120mi_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
126mi_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
132mi_gdb_test "-var-set-format foo octal" \
7bf81d63 133 "\\^done,format=\"octal\",value=\"$octal\"" \
fb40c209
AC
134 "set format variable foo"
135
136mi_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
142mi_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
148mi_gdb_test "-var-assign foo 3" \
149 "\\^done,value=\"03\"" \
150 "assing to variable foo"
151
152mi_gdb_test "-var-set-format foo decimal" \
7bf81d63 153 "\\^done,format=\"decimal\",value=\"3\"" \
fb40c209
AC
154 "set format variable foo"
155
156# Test: c_variable-6.18
157# Desc: check new value of foo
158mi_gdb_test "-var-evaluate-expression foo" \
159 "\\^done,value=\"3\"" \
160 "eval variable foo"
161
de051565
MK
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
166mi_gdb_test "-var-evaluate-expression -f hex foo" \
167 "\\^done,value=\"0x3\"" \
168 "eval variable foo in hex"
169
170mi_gdb_test "-var-show-format foo" \
171 "\\^done,format=\"decimal\"" \
172 "show format variable foo after eval in hex"
173
174mi_gdb_test "-var-evaluate-expression -f octal foo" \
175 "\\^done,value=\"03\"" \
176 "eval variable foo in octal"
177
178mi_gdb_test "-var-show-format foo" \
179 "\\^done,format=\"decimal\"" \
180 "show format variable foo after eval in octal"
181
182mi_gdb_test "-var-evaluate-expression -f decimal foo" \
183 "\\^done,value=\"3\"" \
184 "eval variable foo in decimal"
185
186mi_gdb_test "-var-show-format foo" \
187 "\\^done,format=\"decimal\"" \
188 "show format variable foo after eval in decimal"
189
190mi_gdb_test "-var-evaluate-expression -f nat foo" \
191 "\\^done,value=\"0x3\"" \
192 "eval variable foo in natural"
193
194mi_gdb_test "-var-show-format foo" \
195 "\\^done,format=\"decimal\"" \
196 "show format variable foo after eval in natural"
197
198mi_gdb_test "-var-evaluate-expression -f bin foo" \
199 "\\^done,value=\"11\"" \
200 "eval variable foo in binary"
201
202mi_gdb_test "-var-show-format foo" \
203 "\\^done,format=\"decimal\"" \
204 "show format variable foo after eval in binary"
205
fb40c209
AC
206mi_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
9e8e3afe
VP
212mi_create_varobj weird weird "create local variable weird"
213
214mi_list_varobj_children weird {
215 {weird.integer integer 0 int}
216 {weird.character character 0 char}
217 {weird.char_ptr char_ptr 1 "char \\*"}
bd69fc68 218 {weird.long_int long_int 0 "long"}
9e8e3afe 219 {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
bd69fc68 220 {weird.long_array long_array 10 "long \\[10\\]"}
9e8e3afe
VP
221 {weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
222 {weird.func_ptr_struct func_ptr_struct 0 \
bd69fc68 223 "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long\\))?"}
9e8e3afe 224 {weird.func_ptr_ptr func_ptr_ptr 0 \
bd69fc68 225 "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long)?\\)"}
9e8e3afe
VP
226 {weird.u1 u1 4 "union \\{\\.\\.\\.\\}"}
227 {weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
228} "get children local variable weird"
fb40c209
AC
229
230
231# Test: c_variable-6.23
232# Desc: change format of weird.func_ptr and weird.func_ptr_ptr
233mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
7bf81d63 234 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
fb40c209
AC
235 "set format variable weird.func_ptr"
236
237mi_gdb_test "-var-show-format weird.func_ptr" \
238 "\\^done,format=\"hexadecimal\"" \
239 "show format variable weird.func_ptr"
240
241mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
7bf81d63 242 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
fb40c209
AC
243 "set format variable weird.func_ptr_ptr"
244
245mi_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
251mi_gdb_test "-var-set-format weird natural" \
7bf81d63 252 "\\^done,format=\"natural\",value=\"$hex\"" \
fb40c209
AC
253 "set format variable weird"
254
255mi_gdb_test "-var-set-format weird.integer natural" \
7bf81d63 256 "\\^done,format=\"natural\",value=\"123\"" \
fb40c209
AC
257 "set format variable weird.integer"
258
259mi_gdb_test "-var-set-format weird.character natural" \
30b66ecc 260 "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \
fb40c209
AC
261 "set format variable weird.character"
262
263mi_gdb_test "-var-set-format weird.char_ptr natural" \
7bf81d63 264 "\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \
fb40c209
AC
265 "set format variable weird.char_ptr"
266
267mi_gdb_test "-var-set-format weird.long_int natural" \
7bf81d63 268 "\\^done,format=\"natural\",value=\"0\"" \
fb40c209
AC
269 "set format variable weird.long_int"
270
271mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \
7bf81d63 272 "\\^done,format=\"natural\",value=\"$hex\"" \
fb40c209
AC
273 "set format variable weird.int_ptr_ptr"
274
275mi_gdb_test "-var-set-format weird.long_array natural" \
7bf81d63 276 "\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \
fb40c209
AC
277 "set format variable weird.long_array"
278
279mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
7bf81d63 280 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
fb40c209
AC
281 "set format variable weird.func_ptr"
282
283mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \
7bf81d63 284 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
fb40c209
AC
285 "set format variable weird.func_ptr_struct"
286
287mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
1d51a733 288 "\\^done,format=\"natural\",value=\"0x0\"" \
fb40c209
AC
289 "set format variable weird.func_ptr_ptr"
290
291mi_gdb_test "-var-set-format weird.u1 natural" \
7bf81d63 292 "\\^done,format=\"natural\",value=\"\{...\}\"" \
fb40c209
AC
293 "set format variable weird.u1"
294
295mi_gdb_test "-var-set-format weird.s2 natural" \
7bf81d63 296 "\\^done,format=\"natural\",value=\"\{...\}\"" \
fb40c209
AC
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
356mi_gdb_test "-var-delete weird" \
357 "\\^done,ndeleted=\"12\"" \
358 "delete var weird"
359
360
361##### #####
362# #
363# Special Display Tests #
364# #
365##### #####
366
6c2d1a6b 367# Stop at the end of "do_special_tests"
469aff8e 368
6c2d1a6b 369set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"]
469aff8e 370
d24317b4
VP
371mi_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"
fb40c209 373
18ac113b
AR
374mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \
375 ".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \
bb378428 376 "continue to do_special_tests"
fb40c209
AC
377
378# Test: c_variable-7.10
379# Desc: create union u
9e8e3afe 380mi_create_varobj u u "create local variable u"
fb40c209
AC
381
382# Test: c_variable-7.11
383# Desc: value of u
384mi_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
390mi_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
396mi_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
402mi_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
9e8e3afe
VP
408mi_list_varobj_children u {
409 {u.integer integer 0 int}
410 {u.char_ptr char_ptr 1 {char \*}}
411} "get children of u"
fb40c209
AC
412
413# Test: c_variable-7.20
414# Desc: create anonu
9e8e3afe 415mi_create_varobj anonu anonu "create local variable anonu"
fb40c209
AC
416
417# Test: c_variable-7.21
418# Desc: value of anonu
419mi_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
425mi_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
431mi_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
437mi_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
9e8e3afe
VP
443mi_list_varobj_children "anonu" {
444 {anonu.a a 0 int}
445 {anonu.b b 0 char}
bd69fc68 446 {anonu.c c 0 "long"}
9e8e3afe 447} "get children of anonu"
fb40c209
AC
448
449# Test: c_variable-7.30
450# Desc: create struct s
9e8e3afe 451mi_create_varobj s s "create local variable s"
3fddb3ad 452
fb40c209
AC
453
454# Test: c_variable-7.31
455# Desc: value of s
456mi_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
462mi_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
468mi_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
474mi_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
9e8e3afe
VP
480mi_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"
fb40c209
AC
488#} {integer unsigned_integer character signed_character char_ptr array_of_10}
489
490# Test: c_variable-7.40
491# Desc: create anons
9e8e3afe 492mi_create_varobj anons anons "create local variable anons"
fb40c209
AC
493
494# Test: c_variable-7.41
495# Desc: value of anons
496mi_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
502mi_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
508mi_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
514mi_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
9e8e3afe
VP
520mi_list_varobj_children anons {
521 {anons.a a 0 int}
522 {anons.b b 0 char}
bd69fc68 523 {anons.c c 0 "long"}
9e8e3afe 524} "get children of anons"
fb40c209
AC
525
526# Test: c_variable-7.50
527# Desc: create enum e
9e8e3afe 528mi_create_varobj e e "create local variable e"
fb40c209 529
fb40c209
AC
530# Test: c_variable-7.51
531# Desc: value of e
532mi_gdb_test "-var-evaluate-expression e" \
56767571 533 "\\^done,value=\"bar\"" \
fb40c209 534 "eval variable e"
fb40c209
AC
535
536# Test: c_variable-7.52
537# Desc: type of e
538mi_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
544mi_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
550mi_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
556mi_gdb_test "-var-list-children e" \
0cc7d26f 557 "\\^done,numchild=\"0\",has_more=\"0\"" \
fb40c209
AC
558 "get children of e"
559
560# Test: c_variable-7.60
561# Desc: create anone
9e8e3afe 562mi_create_varobj anone anone "create local variable anone"
fb40c209 563
fb40c209
AC
564# Test: c_variable-7.61
565# Desc: value of anone
566mi_gdb_test "-var-evaluate-expression anone" \
567 "\\^done,value=\"A\"" \
568 "eval variable anone"
fb40c209
AC
569
570# Test: c_variable-7.70
571# Desc: create anone
572mi_gdb_test "-var-create anone * anone" \
a13e061a 573 "\\^error,msg=\"Duplicate variable object name\"" \
fb40c209
AC
574 "create duplicate local variable anone"
575
576
577# Test: c_variable-7.72
578# Desc: type of anone
579mi_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
586mi_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
592mi_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
598mi_gdb_test "-var-list-children anone" \
0cc7d26f 599 "\\^done,numchild=\"0\",has_more=\"0\"" \
fb40c209
AC
600 "get children of anone"
601
602
603# Record fp
833b0ca7
MP
604if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] {
605 set fp $expect_out(3,string)
fb40c209
AC
606}
607
bb378428 608mi_continue_to "incr_a"
fb40c209
AC
609
610# Test: c_variable-7.81
611# Desc: Create variables in different scopes
3fddb3ad 612mi_gdb_test "-var-create a1 * a" \
9e8e3afe 613 "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \
3fddb3ad 614 "create local variable a1"
fb40c209 615
3a7341d8
MR
616if { [info exists fp] } {
617 mi_gdb_test "-var-create a2 $fp a" \
9e8e3afe 618 "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \
fb40c209 619 "create variable a2 in different scope"
3a7341d8
MR
620} else {
621 untested "create variable a2 in different scope"
622}
fb40c209
AC
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
635mi_gdb_exit
636return 0