]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.mi/mi-var-display.exp
Set print symbol off in mi-var-display.exp
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-var-display.exp
CommitLineData
ecd75fc8 1# Copyright 1999-2014 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
4b48d439
KS
43mi_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
fb40c209
AC
47
48mi_run_cmd
18ac113b
AR
49mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \
50 $line_dct_end { "" "disp=\"keep\"" } "run to main"
fb40c209 51
4c122fc3
YQ
52# Prevent symbol on the address being printed.
53mi_gdb_test "-gdb-set print symbol off"
54
fb40c209
AC
55##### #####
56# #
57# Display tests #
58# #
59##### #####
60
61# Test: c_variable-6.1
62# Desc: create variable bar
9e8e3afe 63mi_create_varobj bar bar "create local variable bar"
fb40c209
AC
64
65# Test: c_variable-6.2
66# Desc: type of variable bar
67mi_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
73mi_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
79mi_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
85mi_gdb_test "-var-set-format bar hexadecimal" \
7bf81d63 86 "\\^done,format=\"hexadecimal\",value=\"0x849\"" \
5792e8e3 87 "set format variable bar in hex"
fb40c209
AC
88
89# Test: c_variable-6.6
90# Desc: value of bar with new format
91mi_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
97mi_gdb_test "-var-assign bar 3" \
98 "\\^done,value=\"0x3\"" \
99 "assing to variable bar"
100
101mi_gdb_test "-var-set-format bar decimal" \
7bf81d63 102 "\\^done,format=\"decimal\",value=\"3\"" \
5792e8e3 103 "set format variable bar in decimal"
fb40c209
AC
104
105mi_gdb_test "-var-evaluate-expression bar" \
106 "\\^done,value=\"3\"" \
107 "eval variable bar with new value"
108
109mi_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
9e8e3afe 115mi_create_varobj foo foo "create local variable foo"
fb40c209
AC
116
117# Test: c_variable-6.12
118# Desc: type of variable foo
119mi_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
125mi_gdb_test "-var-show-format foo" \
126 "\\^done,format=\"natural\"" \
5792e8e3 127 "show format variable foo in natural"
fb40c209
AC
128
129# Test: c_variable-6.14
130# Desc: value of variable foo
131mi_gdb_test "-var-evaluate-expression foo" \
132 "\\^done,value=\"$hex\"" \
5792e8e3 133 "eval variable foo in natural"
fb40c209
AC
134
135# Test: c_variable-6.15
136# Desc: change format of var to octal
137mi_gdb_test "-var-set-format foo octal" \
7bf81d63 138 "\\^done,format=\"octal\",value=\"$octal\"" \
5792e8e3 139 "set format variable foo in octal"
fb40c209
AC
140
141mi_gdb_test "-var-show-format foo" \
142 "\\^done,format=\"octal\"" \
5792e8e3 143 "show format variable foo in octal"
fb40c209
AC
144
145# Test: c_variable-6.16
146# Desc: value of foo with new format
147mi_gdb_test "-var-evaluate-expression foo" \
148 "\\^done,value=\"\[0-7\]+\"" \
5792e8e3 149 "eval variable foo in octal"
fb40c209
AC
150
151# Test: c_variable-6.17
152# Desc: change value of foo
153mi_gdb_test "-var-assign foo 3" \
154 "\\^done,value=\"03\"" \
155 "assing to variable foo"
156
157mi_gdb_test "-var-set-format foo decimal" \
7bf81d63 158 "\\^done,format=\"decimal\",value=\"3\"" \
5792e8e3 159 "set format variable foo decimal"
fb40c209
AC
160
161# Test: c_variable-6.18
162# Desc: check new value of foo
163mi_gdb_test "-var-evaluate-expression foo" \
164 "\\^done,value=\"3\"" \
5792e8e3 165 "eval variable foo in decimal"
fb40c209 166
de051565
MK
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
171mi_gdb_test "-var-evaluate-expression -f hex foo" \
172 "\\^done,value=\"0x3\"" \
173 "eval variable foo in hex"
174
175mi_gdb_test "-var-show-format foo" \
176 "\\^done,format=\"decimal\"" \
177 "show format variable foo after eval in hex"
178
179mi_gdb_test "-var-evaluate-expression -f octal foo" \
180 "\\^done,value=\"03\"" \
5792e8e3 181 "eval variable -f octal foo"
de051565
MK
182
183mi_gdb_test "-var-show-format foo" \
184 "\\^done,format=\"decimal\"" \
185 "show format variable foo after eval in octal"
186
187mi_gdb_test "-var-evaluate-expression -f decimal foo" \
188 "\\^done,value=\"3\"" \
5792e8e3 189 "eval variable -f decimal foo"
de051565
MK
190
191mi_gdb_test "-var-show-format foo" \
192 "\\^done,format=\"decimal\"" \
193 "show format variable foo after eval in decimal"
194
195mi_gdb_test "-var-evaluate-expression -f nat foo" \
196 "\\^done,value=\"0x3\"" \
5792e8e3 197 "eval variable -f nat foo"
de051565
MK
198
199mi_gdb_test "-var-show-format foo" \
200 "\\^done,format=\"decimal\"" \
201 "show format variable foo after eval in natural"
202
203mi_gdb_test "-var-evaluate-expression -f bin foo" \
204 "\\^done,value=\"11\"" \
205 "eval variable foo in binary"
206
207mi_gdb_test "-var-show-format foo" \
208 "\\^done,format=\"decimal\"" \
209 "show format variable foo after eval in binary"
210
fb40c209
AC
211mi_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
9e8e3afe
VP
217mi_create_varobj weird weird "create local variable weird"
218
219mi_list_varobj_children weird {
220 {weird.integer integer 0 int}
221 {weird.character character 0 char}
222 {weird.char_ptr char_ptr 1 "char \\*"}
bd69fc68 223 {weird.long_int long_int 0 "long"}
9e8e3afe 224 {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
bd69fc68 225 {weird.long_array long_array 10 "long \\[10\\]"}
9e8e3afe
VP
226 {weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
227 {weird.func_ptr_struct func_ptr_struct 0 \
bd69fc68 228 "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long\\))?"}
9e8e3afe 229 {weird.func_ptr_ptr func_ptr_ptr 0 \
bd69fc68 230 "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long)?\\)"}
9e8e3afe
VP
231 {weird.u1 u1 4 "union \\{\\.\\.\\.\\}"}
232 {weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
233} "get children local variable weird"
fb40c209
AC
234
235
236# Test: c_variable-6.23
237# Desc: change format of weird.func_ptr and weird.func_ptr_ptr
238mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
7bf81d63 239 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
5792e8e3 240 "set format variable weird.func_ptr in hex (1)"
fb40c209
AC
241
242mi_gdb_test "-var-show-format weird.func_ptr" \
243 "\\^done,format=\"hexadecimal\"" \
244 "show format variable weird.func_ptr"
245
246mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
7bf81d63 247 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
5792e8e3 248 "set format variable weird.func_ptr_ptr in hex"
fb40c209
AC
249
250mi_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
256mi_gdb_test "-var-set-format weird natural" \
7bf81d63 257 "\\^done,format=\"natural\",value=\"$hex\"" \
fb40c209
AC
258 "set format variable weird"
259
260mi_gdb_test "-var-set-format weird.integer natural" \
7bf81d63 261 "\\^done,format=\"natural\",value=\"123\"" \
fb40c209
AC
262 "set format variable weird.integer"
263
264mi_gdb_test "-var-set-format weird.character natural" \
30b66ecc 265 "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \
fb40c209
AC
266 "set format variable weird.character"
267
268mi_gdb_test "-var-set-format weird.char_ptr natural" \
7bf81d63 269 "\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \
fb40c209
AC
270 "set format variable weird.char_ptr"
271
272mi_gdb_test "-var-set-format weird.long_int natural" \
7bf81d63 273 "\\^done,format=\"natural\",value=\"0\"" \
fb40c209
AC
274 "set format variable weird.long_int"
275
276mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \
7bf81d63 277 "\\^done,format=\"natural\",value=\"$hex\"" \
fb40c209
AC
278 "set format variable weird.int_ptr_ptr"
279
280mi_gdb_test "-var-set-format weird.long_array natural" \
7bf81d63 281 "\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \
fb40c209
AC
282 "set format variable weird.long_array"
283
284mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
7bf81d63 285 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
5792e8e3 286 "set format variable weird.func_ptr in hex (2)"
fb40c209
AC
287
288mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \
7bf81d63 289 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
fb40c209
AC
290 "set format variable weird.func_ptr_struct"
291
292mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
1d51a733 293 "\\^done,format=\"natural\",value=\"0x0\"" \
5792e8e3 294 "set format variable weird.func_ptr_ptr in natural"
fb40c209
AC
295
296mi_gdb_test "-var-set-format weird.u1 natural" \
7bf81d63 297 "\\^done,format=\"natural\",value=\"\{...\}\"" \
fb40c209
AC
298 "set format variable weird.u1"
299
300mi_gdb_test "-var-set-format weird.s2 natural" \
7bf81d63 301 "\\^done,format=\"natural\",value=\"\{...\}\"" \
fb40c209
AC
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
361mi_gdb_test "-var-delete weird" \
362 "\\^done,ndeleted=\"12\"" \
363 "delete var weird"
364
365
366##### #####
367# #
368# Special Display Tests #
369# #
370##### #####
371
6c2d1a6b 372# Stop at the end of "do_special_tests"
469aff8e 373
6c2d1a6b 374set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"]
469aff8e 375
4b48d439
KS
376mi_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
fb40c209 380
18ac113b
AR
381mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \
382 ".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \
bb378428 383 "continue to do_special_tests"
fb40c209
AC
384
385# Test: c_variable-7.10
386# Desc: create union u
9e8e3afe 387mi_create_varobj u u "create local variable u"
fb40c209
AC
388
389# Test: c_variable-7.11
390# Desc: value of u
391mi_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
397mi_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
403mi_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
409mi_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
9e8e3afe
VP
415mi_list_varobj_children u {
416 {u.integer integer 0 int}
417 {u.char_ptr char_ptr 1 {char \*}}
418} "get children of u"
fb40c209
AC
419
420# Test: c_variable-7.20
421# Desc: create anonu
9e8e3afe 422mi_create_varobj anonu anonu "create local variable anonu"
fb40c209
AC
423
424# Test: c_variable-7.21
425# Desc: value of anonu
426mi_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
432mi_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
438mi_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
444mi_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
9e8e3afe
VP
450mi_list_varobj_children "anonu" {
451 {anonu.a a 0 int}
452 {anonu.b b 0 char}
bd69fc68 453 {anonu.c c 0 "long"}
9e8e3afe 454} "get children of anonu"
fb40c209
AC
455
456# Test: c_variable-7.30
457# Desc: create struct s
9e8e3afe 458mi_create_varobj s s "create local variable s"
3fddb3ad 459
fb40c209
AC
460
461# Test: c_variable-7.31
462# Desc: value of s
463mi_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
469mi_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
475mi_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
481mi_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
9e8e3afe
VP
487mi_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"
fb40c209
AC
495#} {integer unsigned_integer character signed_character char_ptr array_of_10}
496
497# Test: c_variable-7.40
498# Desc: create anons
9e8e3afe 499mi_create_varobj anons anons "create local variable anons"
fb40c209
AC
500
501# Test: c_variable-7.41
502# Desc: value of anons
503mi_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
509mi_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
515mi_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
521mi_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
9e8e3afe
VP
527mi_list_varobj_children anons {
528 {anons.a a 0 int}
529 {anons.b b 0 char}
bd69fc68 530 {anons.c c 0 "long"}
9e8e3afe 531} "get children of anons"
fb40c209
AC
532
533# Test: c_variable-7.50
534# Desc: create enum e
9e8e3afe 535mi_create_varobj e e "create local variable e"
fb40c209 536
fb40c209
AC
537# Test: c_variable-7.51
538# Desc: value of e
539mi_gdb_test "-var-evaluate-expression e" \
56767571 540 "\\^done,value=\"bar\"" \
fb40c209 541 "eval variable e"
fb40c209
AC
542
543# Test: c_variable-7.52
544# Desc: type of e
545mi_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
551mi_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
557mi_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
563mi_gdb_test "-var-list-children e" \
0cc7d26f 564 "\\^done,numchild=\"0\",has_more=\"0\"" \
fb40c209
AC
565 "get children of e"
566
567# Test: c_variable-7.60
568# Desc: create anone
9e8e3afe 569mi_create_varobj anone anone "create local variable anone"
fb40c209 570
fb40c209
AC
571# Test: c_variable-7.61
572# Desc: value of anone
573mi_gdb_test "-var-evaluate-expression anone" \
574 "\\^done,value=\"A\"" \
575 "eval variable anone"
fb40c209
AC
576
577# Test: c_variable-7.70
578# Desc: create anone
579mi_gdb_test "-var-create anone * anone" \
a13e061a 580 "\\^error,msg=\"Duplicate variable object name\"" \
fb40c209
AC
581 "create duplicate local variable anone"
582
583
584# Test: c_variable-7.72
585# Desc: type of anone
586mi_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
593mi_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
599mi_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
605mi_gdb_test "-var-list-children anone" \
0cc7d26f 606 "\\^done,numchild=\"0\",has_more=\"0\"" \
fb40c209
AC
607 "get children of anone"
608
609
610# Record fp
833b0ca7
MP
611if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] {
612 set fp $expect_out(3,string)
fb40c209
AC
613}
614
bb378428 615mi_continue_to "incr_a"
fb40c209
AC
616
617# Test: c_variable-7.81
618# Desc: Create variables in different scopes
3fddb3ad 619mi_gdb_test "-var-create a1 * a" \
9e8e3afe 620 "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \
3fddb3ad 621 "create local variable a1"
fb40c209 622
3a7341d8
MR
623if { [info exists fp] } {
624 mi_gdb_test "-var-create a2 $fp a" \
9e8e3afe 625 "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \
fb40c209 626 "create variable a2 in different scope"
3a7341d8
MR
627} else {
628 untested "create variable a2 in different scope"
629}
fb40c209
AC
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
642mi_gdb_exit
643return 0