Commit | Line | Data |
---|---|---|
0b302171 | 1 | # Copyright 1999-2005, 2007-2012 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 | ||
22 | load_lib mi-support.exp | |
b30bf9ee | 23 | set MIFLAGS "-i=mi" |
fb40c209 AC |
24 | |
25 | gdb_exit | |
26 | if [mi_gdb_start] { | |
27 | continue | |
28 | } | |
29 | ||
30 | set testfile "var-cmd" | |
31 | set srcfile ${testfile}.c | |
3788363d | 32 | set binfile ${objdir}/${subdir}/mi-var-display |
fb40c209 | 33 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { |
b60f0898 JB |
34 | untested mi-var-display.exp |
35 | return -1 | |
fb40c209 AC |
36 | } |
37 | ||
38 | mi_delete_breakpoints | |
39 | mi_gdb_reinitialize_dir $srcdir/$subdir | |
40 | mi_gdb_load ${binfile} | |
41 | ||
e1c2defa | 42 | set line_dct_end [gdb_get_line_number "{int a = 0;}"] |
469aff8e | 43 | |
d24317b4 VP |
44 | mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \ |
45 | "break-insert operation" | |
fb40c209 AC |
46 | |
47 | mi_run_cmd | |
18ac113b AR |
48 | mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \ |
49 | $line_dct_end { "" "disp=\"keep\"" } "run to main" | |
fb40c209 AC |
50 | |
51 | ##### ##### | |
52 | # # | |
53 | # Display tests # | |
54 | # # | |
55 | ##### ##### | |
56 | ||
57 | # Test: c_variable-6.1 | |
58 | # Desc: create variable bar | |
9e8e3afe | 59 | mi_create_varobj bar bar "create local variable bar" |
fb40c209 AC |
60 | |
61 | # Test: c_variable-6.2 | |
62 | # Desc: type of variable bar | |
63 | mi_gdb_test "-var-info-type bar" \ | |
64 | "\\^done,type=\"int\"" \ | |
65 | "info type variable bar" | |
66 | ||
67 | # Test: c_variable-6.3 | |
68 | # Desc: format of variable bar | |
69 | mi_gdb_test "-var-show-format bar" \ | |
70 | "\\^done,format=\"natural\"" \ | |
71 | "show format variable bar" | |
72 | ||
73 | # Test: c_variable-6.4 | |
74 | # Desc: value of variable bar | |
75 | mi_gdb_test "-var-evaluate-expression bar" \ | |
76 | "\\^done,value=\"2121\"" \ | |
77 | "eval variable bar" | |
78 | ||
79 | # Test: c_variable-6.5 | |
80 | # Desc: change format of bar to hex | |
81 | mi_gdb_test "-var-set-format bar hexadecimal" \ | |
7bf81d63 | 82 | "\\^done,format=\"hexadecimal\",value=\"0x849\"" \ |
fb40c209 AC |
83 | "set format variable bar" |
84 | ||
85 | # Test: c_variable-6.6 | |
86 | # Desc: value of bar with new format | |
87 | mi_gdb_test "-var-evaluate-expression bar" \ | |
88 | "\\^done,value=\"0x849\"" \ | |
89 | "eval variable bar with new format" | |
90 | ||
91 | # Test: c_variable-6.7 | |
92 | # Desc: change value of bar | |
93 | mi_gdb_test "-var-assign bar 3" \ | |
94 | "\\^done,value=\"0x3\"" \ | |
95 | "assing to variable bar" | |
96 | ||
97 | mi_gdb_test "-var-set-format bar decimal" \ | |
7bf81d63 | 98 | "\\^done,format=\"decimal\",value=\"3\"" \ |
fb40c209 AC |
99 | "set format variable bar" |
100 | ||
101 | mi_gdb_test "-var-evaluate-expression bar" \ | |
102 | "\\^done,value=\"3\"" \ | |
103 | "eval variable bar with new value" | |
104 | ||
105 | mi_gdb_test "-var-delete bar" \ | |
106 | "\\^done,ndeleted=\"1\"" \ | |
107 | "delete var bar" | |
108 | ||
109 | # Test: c_variable-6.11 | |
110 | # Desc: create variable foo | |
9e8e3afe | 111 | mi_create_varobj foo foo "create local variable foo" |
fb40c209 AC |
112 | |
113 | # Test: c_variable-6.12 | |
114 | # Desc: type of variable foo | |
115 | mi_gdb_test "-var-info-type foo" \ | |
116 | "\\^done,type=\"int \\*\"" \ | |
117 | "info type variable foo" | |
118 | ||
119 | # Test: c_variable-6.13 | |
120 | # Desc: format of variable foo | |
121 | mi_gdb_test "-var-show-format foo" \ | |
122 | "\\^done,format=\"natural\"" \ | |
123 | "show format variable foo" | |
124 | ||
125 | # Test: c_variable-6.14 | |
126 | # Desc: value of variable foo | |
127 | mi_gdb_test "-var-evaluate-expression foo" \ | |
128 | "\\^done,value=\"$hex\"" \ | |
129 | "eval variable foo" | |
130 | ||
131 | # Test: c_variable-6.15 | |
132 | # Desc: change format of var to octal | |
133 | mi_gdb_test "-var-set-format foo octal" \ | |
7bf81d63 | 134 | "\\^done,format=\"octal\",value=\"$octal\"" \ |
fb40c209 AC |
135 | "set format variable foo" |
136 | ||
137 | mi_gdb_test "-var-show-format foo" \ | |
138 | "\\^done,format=\"octal\"" \ | |
139 | "show format variable foo" | |
140 | ||
141 | # Test: c_variable-6.16 | |
142 | # Desc: value of foo with new format | |
143 | mi_gdb_test "-var-evaluate-expression foo" \ | |
144 | "\\^done,value=\"\[0-7\]+\"" \ | |
145 | "eval variable foo" | |
146 | ||
147 | # Test: c_variable-6.17 | |
148 | # Desc: change value of foo | |
149 | mi_gdb_test "-var-assign foo 3" \ | |
150 | "\\^done,value=\"03\"" \ | |
151 | "assing to variable foo" | |
152 | ||
153 | mi_gdb_test "-var-set-format foo decimal" \ | |
7bf81d63 | 154 | "\\^done,format=\"decimal\",value=\"3\"" \ |
fb40c209 AC |
155 | "set format variable foo" |
156 | ||
157 | # Test: c_variable-6.18 | |
158 | # Desc: check new value of foo | |
159 | mi_gdb_test "-var-evaluate-expression foo" \ | |
160 | "\\^done,value=\"3\"" \ | |
161 | "eval variable foo" | |
162 | ||
de051565 MK |
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 | ||
fb40c209 AC |
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 | |
9e8e3afe VP |
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" | |
fb40c209 AC |
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" \ | |
7bf81d63 | 235 | "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ |
fb40c209 AC |
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" \ | |
7bf81d63 | 243 | "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ |
fb40c209 AC |
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" \ | |
7bf81d63 | 253 | "\\^done,format=\"natural\",value=\"$hex\"" \ |
fb40c209 AC |
254 | "set format variable weird" |
255 | ||
256 | mi_gdb_test "-var-set-format weird.integer natural" \ | |
7bf81d63 | 257 | "\\^done,format=\"natural\",value=\"123\"" \ |
fb40c209 AC |
258 | "set format variable weird.integer" |
259 | ||
260 | mi_gdb_test "-var-set-format weird.character natural" \ | |
30b66ecc | 261 | "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \ |
fb40c209 AC |
262 | "set format variable weird.character" |
263 | ||
264 | mi_gdb_test "-var-set-format weird.char_ptr natural" \ | |
7bf81d63 | 265 | "\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \ |
fb40c209 AC |
266 | "set format variable weird.char_ptr" |
267 | ||
268 | mi_gdb_test "-var-set-format weird.long_int natural" \ | |
7bf81d63 | 269 | "\\^done,format=\"natural\",value=\"0\"" \ |
fb40c209 AC |
270 | "set format variable weird.long_int" |
271 | ||
272 | mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \ | |
7bf81d63 | 273 | "\\^done,format=\"natural\",value=\"$hex\"" \ |
fb40c209 AC |
274 | "set format variable weird.int_ptr_ptr" |
275 | ||
276 | mi_gdb_test "-var-set-format weird.long_array natural" \ | |
7bf81d63 | 277 | "\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \ |
fb40c209 AC |
278 | "set format variable weird.long_array" |
279 | ||
280 | mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ | |
7bf81d63 | 281 | "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ |
fb40c209 AC |
282 | "set format variable weird.func_ptr" |
283 | ||
284 | mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ | |
7bf81d63 | 285 | "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ |
fb40c209 AC |
286 | "set format variable weird.func_ptr_struct" |
287 | ||
288 | mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ | |
7bf81d63 | 289 | "\\^done,format=\"natural\",value=\"0\"" \ |
fb40c209 AC |
290 | "set format variable weird.func_ptr_ptr" |
291 | ||
292 | mi_gdb_test "-var-set-format weird.u1 natural" \ | |
7bf81d63 | 293 | "\\^done,format=\"natural\",value=\"\{...\}\"" \ |
fb40c209 AC |
294 | "set format variable weird.u1" |
295 | ||
296 | mi_gdb_test "-var-set-format weird.s2 natural" \ | |
7bf81d63 | 297 | "\\^done,format=\"natural\",value=\"\{...\}\"" \ |
fb40c209 AC |
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 | ||
6c2d1a6b | 368 | # Stop at the end of "do_special_tests" |
469aff8e | 369 | |
6c2d1a6b | 370 | set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"] |
469aff8e | 371 | |
d24317b4 VP |
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" | |
fb40c209 | 374 | |
18ac113b AR |
375 | mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \ |
376 | ".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \ | |
bb378428 | 377 | "continue to do_special_tests" |
fb40c209 AC |
378 | |
379 | # Test: c_variable-7.10 | |
380 | # Desc: create union u | |
9e8e3afe | 381 | mi_create_varobj u u "create local variable u" |
fb40c209 AC |
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 | |
9e8e3afe VP |
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" | |
fb40c209 AC |
413 | |
414 | # Test: c_variable-7.20 | |
415 | # Desc: create anonu | |
9e8e3afe | 416 | mi_create_varobj anonu anonu "create local variable anonu" |
fb40c209 AC |
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 | |
9e8e3afe VP |
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" | |
fb40c209 AC |
449 | |
450 | # Test: c_variable-7.30 | |
451 | # Desc: create struct s | |
9e8e3afe | 452 | mi_create_varobj s s "create local variable s" |
3fddb3ad | 453 | |
fb40c209 AC |
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 | |
9e8e3afe VP |
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" | |
fb40c209 AC |
489 | #} {integer unsigned_integer character signed_character char_ptr array_of_10} |
490 | ||
491 | # Test: c_variable-7.40 | |
492 | # Desc: create anons | |
9e8e3afe | 493 | mi_create_varobj anons anons "create local variable anons" |
fb40c209 AC |
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 | |
9e8e3afe VP |
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" | |
fb40c209 AC |
526 | |
527 | # Test: c_variable-7.50 | |
528 | # Desc: create enum e | |
9e8e3afe | 529 | mi_create_varobj e e "create local variable e" |
fb40c209 | 530 | |
fb40c209 AC |
531 | # Test: c_variable-7.51 |
532 | # Desc: value of e | |
533 | mi_gdb_test "-var-evaluate-expression e" \ | |
56767571 | 534 | "\\^done,value=\"bar\"" \ |
fb40c209 | 535 | "eval variable e" |
fb40c209 AC |
536 | |
537 | # Test: c_variable-7.52 | |
538 | # Desc: type of e | |
539 | mi_gdb_test "-var-info-type e" \ | |
540 | "\\^done,type=\"enum foo\"" \ | |
541 | "info type variable e" | |
542 | ||
543 | # Test: c_variable-7.53 | |
544 | # Desc: is e editable | |
545 | mi_gdb_test "-var-show-attributes e" \ | |
546 | "\\^done,attr=\"editable\"" \ | |
547 | "is e editable" | |
548 | ||
549 | # Test: c_variable-7.54 | |
550 | # Desc: number of children of e | |
551 | mi_gdb_test "-var-info-num-children e" \ | |
552 | "\\^done,numchild=\"0\"" \ | |
553 | "get number of children of e" | |
554 | ||
555 | # Test: c_variable-7.55 | |
556 | # Desc: children of e | |
557 | mi_gdb_test "-var-list-children e" \ | |
0cc7d26f | 558 | "\\^done,numchild=\"0\",has_more=\"0\"" \ |
fb40c209 AC |
559 | "get children of e" |
560 | ||
561 | # Test: c_variable-7.60 | |
562 | # Desc: create anone | |
9e8e3afe | 563 | mi_create_varobj anone anone "create local variable anone" |
fb40c209 | 564 | |
fb40c209 AC |
565 | # Test: c_variable-7.61 |
566 | # Desc: value of anone | |
567 | mi_gdb_test "-var-evaluate-expression anone" \ | |
568 | "\\^done,value=\"A\"" \ | |
569 | "eval variable anone" | |
fb40c209 AC |
570 | |
571 | # Test: c_variable-7.70 | |
572 | # Desc: create anone | |
573 | mi_gdb_test "-var-create anone * anone" \ | |
a13e061a | 574 | "\\^error,msg=\"Duplicate variable object name\"" \ |
fb40c209 AC |
575 | "create duplicate local variable anone" |
576 | ||
577 | ||
578 | # Test: c_variable-7.72 | |
579 | # Desc: type of anone | |
580 | mi_gdb_test "-var-info-type anone" \ | |
581 | "\\^done,type=\"enum \{\\.\\.\\.\}\"" \ | |
582 | "info type variable anone" | |
583 | ||
584 | ||
585 | # Test: c_variable-7.73 | |
586 | # Desc: is anone editable | |
587 | mi_gdb_test "-var-show-attributes anone" \ | |
588 | "\\^done,attr=\"editable\"" \ | |
589 | "is anone editable" | |
590 | ||
591 | # Test: c_variable-7.74 | |
592 | # Desc: number of children of anone | |
593 | mi_gdb_test "-var-info-num-children anone" \ | |
594 | "\\^done,numchild=\"0\"" \ | |
595 | "get number of children of anone" | |
596 | ||
597 | # Test: c_variable-7.75 | |
598 | # Desc: children of anone | |
599 | mi_gdb_test "-var-list-children anone" \ | |
0cc7d26f | 600 | "\\^done,numchild=\"0\",has_more=\"0\"" \ |
fb40c209 AC |
601 | "get children of anone" |
602 | ||
603 | ||
604 | # Record fp | |
833b0ca7 MP |
605 | if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] { |
606 | set fp $expect_out(3,string) | |
fb40c209 AC |
607 | } |
608 | ||
bb378428 | 609 | mi_continue_to "incr_a" |
fb40c209 AC |
610 | |
611 | # Test: c_variable-7.81 | |
612 | # Desc: Create variables in different scopes | |
3fddb3ad | 613 | mi_gdb_test "-var-create a1 * a" \ |
9e8e3afe | 614 | "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \ |
3fddb3ad | 615 | "create local variable a1" |
fb40c209 AC |
616 | |
617 | mi_gdb_test "-var-create a2 $fp a" \ | |
9e8e3afe | 618 | "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \ |
fb40c209 AC |
619 | "create variable a2 in different scope" |
620 | ||
621 | #gdbtk_test c_variable-7.81 {create variables in different scopes} { | |
622 | # set a1 [gdb_variable create -expr a] | |
623 | # set a2 [gdb_variable create -expr a -frame $fp] | |
624 | ||
625 | # set vals {} | |
626 | # lappend vals [$a1 value] | |
627 | # lappend vals [$a2 value] | |
628 | # set vals | |
629 | #} {2 1} | |
630 | ||
631 | ||
632 | mi_gdb_exit | |
633 | return 0 |