OLD | NEW |
| (Empty) |
1 # Copyright 1999-2005, 2007-2012 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=mi2" | |
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 {deb
ug}] != "" } { | |
33 untested mi2-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-cm
d.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 # Test: c_variable-6.19 | |
163 # Desc: check optional format parameter of var-evaluate-expression | |
164 # and check that current format is not changed | |
165 mi_gdb_test "-var-evaluate-expression -f hex foo" \ | |
166 "\\^done,value=\"0x3\"" \ | |
167 "eval variable foo in hex" | |
168 | |
169 mi_gdb_test "-var-show-format foo" \ | |
170 "\\^done,format=\"decimal\"" \ | |
171 "show format variable foo after eval in hex" | |
172 | |
173 mi_gdb_test "-var-evaluate-expression -f octal foo" \ | |
174 "\\^done,value=\"03\"" \ | |
175 "eval variable foo in octal" | |
176 | |
177 mi_gdb_test "-var-show-format foo" \ | |
178 "\\^done,format=\"decimal\"" \ | |
179 "show format variable foo after eval in octal" | |
180 | |
181 mi_gdb_test "-var-evaluate-expression -f decimal foo" \ | |
182 "\\^done,value=\"3\"" \ | |
183 "eval variable foo in decimal" | |
184 | |
185 mi_gdb_test "-var-show-format foo" \ | |
186 "\\^done,format=\"decimal\"" \ | |
187 "show format variable foo after eval in decimal" | |
188 | |
189 mi_gdb_test "-var-evaluate-expression -f nat foo" \ | |
190 "\\^done,value=\"0x3\"" \ | |
191 "eval variable foo in natural" | |
192 | |
193 mi_gdb_test "-var-show-format foo" \ | |
194 "\\^done,format=\"decimal\"" \ | |
195 "show format variable foo after eval in natural" | |
196 | |
197 mi_gdb_test "-var-evaluate-expression -f bin foo" \ | |
198 "\\^done,value=\"11\"" \ | |
199 "eval variable foo in binary" | |
200 | |
201 mi_gdb_test "-var-show-format foo" \ | |
202 "\\^done,format=\"decimal\"" \ | |
203 "show format variable foo after eval in binary" | |
204 | |
205 mi_gdb_test "-var-delete foo" \ | |
206 "\\^done,ndeleted=\"1\"" \ | |
207 "delete var foo" | |
208 | |
209 # Test: c_variable-6.21 | |
210 # Desc: create variable weird and children | |
211 mi_create_varobj weird weird "create local variable weird" | |
212 | |
213 mi_list_varobj_children weird { | |
214 {weird.integer integer 0 int} | |
215 {weird.character character 0 char} | |
216 {weird.char_ptr char_ptr 1 "char \\*"} | |
217 {weird.long_int long_int 0 "long int"} | |
218 {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"} | |
219 {weird.long_array long_array 10 "long int \\[10\\]"} | |
220 {weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"} | |
221 {weird.func_ptr_struct func_ptr_struct 0 \ | |
222 "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"
} | |
223 {weird.func_ptr_ptr func_ptr_ptr 0 \ | |
224 "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\
\)"} | |
225 {weird.u1 u1 4 "union \\{\\.\\.\\.\\}"} | |
226 {weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"} | |
227 } "get children local variable weird" | |
228 | |
229 | |
230 # Test: c_variable-6.23 | |
231 # Desc: change format of weird.func_ptr and weird.func_ptr_ptr | |
232 mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ | |
233 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ | |
234 "set format variable weird.func_ptr" | |
235 | |
236 mi_gdb_test "-var-show-format weird.func_ptr" \ | |
237 "\\^done,format=\"hexadecimal\"" \ | |
238 "show format variable weird.func_ptr" | |
239 | |
240 mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \ | |
241 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ | |
242 "set format variable weird.func_ptr_ptr" | |
243 | |
244 mi_gdb_test "-var-show-format weird.func_ptr_ptr" \ | |
245 "\\^done,format=\"hexadecimal\"" \ | |
246 "show format variable weird.func_ptr_ptr" | |
247 | |
248 # Test: c_variable-6.24 | |
249 # Desc: format of weird and children | |
250 mi_gdb_test "-var-set-format weird natural" \ | |
251 "\\^done,format=\"natural\",value=\"$hex\"" \ | |
252 "set format variable weird" | |
253 | |
254 mi_gdb_test "-var-set-format weird.integer natural" \ | |
255 "\\^done,format=\"natural\",value=\"123\"" \ | |
256 "set format variable weird.integer" | |
257 | |
258 mi_gdb_test "-var-set-format weird.character natural" \ | |
259 "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \ | |
260 "set format variable weird.character" | |
261 | |
262 mi_gdb_test "-var-set-format weird.char_ptr natural" \ | |
263 "\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \ | |
264 "set format variable weird.char_ptr" | |
265 | |
266 mi_gdb_test "-var-set-format weird.long_int natural" \ | |
267 "\\^done,format=\"natural\",value=\"0\"" \ | |
268 "set format variable weird.long_int" | |
269 | |
270 mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \ | |
271 "\\^done,format=\"natural\",value=\"$hex\"" \ | |
272 "set format variable weird.int_ptr_ptr" | |
273 | |
274 mi_gdb_test "-var-set-format weird.long_array natural" \ | |
275 "\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \ | |
276 "set format variable weird.long_array" | |
277 | |
278 mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ | |
279 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ | |
280 "set format variable weird.func_ptr" | |
281 | |
282 mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ | |
283 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ | |
284 "set format variable weird.func_ptr_struct" | |
285 | |
286 mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ | |
287 "\\^done,format=\"natural\",value=\"0x0\"" \ | |
288 "set format variable weird.func_ptr_ptr" | |
289 | |
290 mi_gdb_test "-var-set-format weird.u1 natural" \ | |
291 "\\^done,format=\"natural\",value=\"\{...\}\"" \ | |
292 "set format variable weird.u1" | |
293 | |
294 mi_gdb_test "-var-set-format weird.s2 natural" \ | |
295 "\\^done,format=\"natural\",value=\"\{...\}\"" \ | |
296 "set format variable weird.s2" | |
297 | |
298 # Test: c_variable-6.25 | |
299 # Desc: value of weird and children | |
300 #gdbtk_test c_variable-6.25 {value of weird and children} { | |
301 # set values {} | |
302 # foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] { | |
303 # lappend values [value $v $f] | |
304 # } | |
305 | |
306 # set values | |
307 #} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} | |
308 | |
309 # Test: c_variable-6.26 | |
310 # Desc: change format of weird and children to octal | |
311 #gdbtk_test c_variable-6.26 {change format of weird and children to octal} { | |
312 # set formats {} | |
313 # foreach v [lsort [array names var]] { | |
314 # $var($v) format octal | |
315 # lappend formats [$var($v) format] | |
316 # } | |
317 | |
318 # set formats | |
319 #} {octal octal octal octal octal octal octal octal octal octal octal octal} | |
320 | |
321 # Test: c_variable-6.27 | |
322 # Desc: value of weird and children with new format | |
323 #gdbtk_test c_variable-6.27 {value of foo with new format} { | |
324 # set values {} | |
325 # foreach v [lsort [array names var]] { | |
326 # lappend values [value $v o] | |
327 # } | |
328 | |
329 # set values | |
330 #} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} | |
331 | |
332 # Test: c_variable-6.30 | |
333 # Desc: create more children of weird | |
334 #gdbtk_test c_variable-6.30 {create more children of weird} { | |
335 # foreach v [array names var] { | |
336 # get_children $v | |
337 # } | |
338 | |
339 # # Do it twice to get more children | |
340 # foreach v [array names var] { | |
341 # get_children $v | |
342 # } | |
343 | |
344 # lsort [array names var] | |
345 #} {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 wei
rd.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.l
ong_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.u1s
1 weird.s2.u2.u1s2 weird.u1 weird.u1.a weird.u1.b weird.u1.c weird.u1.d} | |
346 | |
347 # Test: c_variable-6.31 | |
348 # Desc: check that all children of weird change | |
349 # Ok, obviously things like weird.s2 and weird.u1 will not change! | |
350 #gdbtk_test *c_variable-6.31 {check that all children of weird change (ops, we a
re now reporting array names as changed in this case - seems harmless though)} { | |
351 # $var(weird) value 0x2121 | |
352 # check_update | |
353 #} {{weird.integer weird.character weird.char_ptr weird.long_int weird.int_ptr_p
tr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr w
eird.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.lon
g_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} {}} | |
354 | |
355 mi_gdb_test "-var-delete weird" \ | |
356 "\\^done,ndeleted=\"12\"" \ | |
357 "delete var weird" | |
358 | |
359 | |
360 ##### ##### | |
361 # # | |
362 # Special Display Tests # | |
363 # # | |
364 ##### ##### | |
365 | |
366 # Stop in "do_special_tests" | |
367 | |
368 set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"] | |
369 | |
370 mi_create_breakpoint "$line_dst_incr_a_2" 2 keep do_special_tests ".*var-cmd.c"
$line_dst_incr_a_2 $hex \ | |
371 "break-insert operation 2" | |
372 | |
373 mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \ | |
374 ".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \ | |
375 "continue to do_special_tests" | |
376 | |
377 # Test: c_variable-7.10 | |
378 # Desc: create union u | |
379 mi_create_varobj u u "create local variable u" | |
380 | |
381 # Test: c_variable-7.11 | |
382 # Desc: value of u | |
383 mi_gdb_test "-var-evaluate-expression u" \ | |
384 "\\^done,value=\"\{\\.\\.\\.\}\"" \ | |
385 "eval variable u" | |
386 | |
387 # Test: c_variable-7.12 | |
388 # Desc: type of u | |
389 mi_gdb_test "-var-info-type u" \ | |
390 "\\^done,type=\"union named_union\"" \ | |
391 "info type variable u" | |
392 | |
393 # Test: c_variable-7.13 | |
394 # Desc: is u editable | |
395 mi_gdb_test "-var-show-attributes u" \ | |
396 "\\^done,attr=\"noneditable\"" \ | |
397 "is u editable" | |
398 | |
399 # Test: c_variable-7.14 | |
400 # Desc: number of children of u | |
401 mi_gdb_test "-var-info-num-children u" \ | |
402 "\\^done,numchild=\"2\"" \ | |
403 "get number of children of u" | |
404 | |
405 # Test: c_variable-7.15 | |
406 # Desc: children of u | |
407 mi_list_varobj_children u { | |
408 {u.integer integer 0 int} | |
409 {u.char_ptr char_ptr 1 {char \*}} | |
410 } "get children of u" | |
411 | |
412 # Test: c_variable-7.20 | |
413 # Desc: create anonu | |
414 mi_create_varobj anonu anonu "create local variable anonu" | |
415 | |
416 # Test: c_variable-7.21 | |
417 # Desc: value of anonu | |
418 mi_gdb_test "-var-evaluate-expression anonu" \ | |
419 "\\^done,value=\"\{\\.\\.\\.\}\"" \ | |
420 "eval variable anonu" | |
421 | |
422 # Test: c_variable-7.22 | |
423 # Desc: type of anonu | |
424 mi_gdb_test "-var-info-type anonu" \ | |
425 "\\^done,type=\"union \{\\.\\.\\.\}\"" \ | |
426 "info type variable anonu" | |
427 | |
428 # Test: c_variable-7.23 | |
429 # Desc: is anonu editable | |
430 mi_gdb_test "-var-show-attributes anonu" \ | |
431 "\\^done,attr=\"noneditable\"" \ | |
432 "is anonu editable" | |
433 | |
434 # Test: c_variable-7.24 | |
435 # Desc: number of children of anonu | |
436 mi_gdb_test "-var-info-num-children anonu" \ | |
437 "\\^done,numchild=\"3\"" \ | |
438 "get number of children of anonu" | |
439 | |
440 # Test: c_variable-7.25 | |
441 # Desc: children of anonu | |
442 mi_list_varobj_children "anonu" { | |
443 {anonu.a a 0 int} | |
444 {anonu.b b 0 char} | |
445 {anonu.c c 0 "long int"} | |
446 } "get children of anonu" | |
447 | |
448 # Test: c_variable-7.30 | |
449 # Desc: create struct s | |
450 mi_create_varobj s s "create local variable s" | |
451 | |
452 | |
453 # Test: c_variable-7.31 | |
454 # Desc: value of s | |
455 mi_gdb_test "-var-evaluate-expression s" \ | |
456 "\\^done,value=\"\{\\.\\.\\.\}\"" \ | |
457 "eval variable s" | |
458 | |
459 # Test: c_variable-7.32 | |
460 # Desc: type of s | |
461 mi_gdb_test "-var-info-type s" \ | |
462 "\\^done,type=\"struct _simple_struct\"" \ | |
463 "info type variable s" | |
464 | |
465 # Test: c_variable-7.33 | |
466 # Desc: is s editable | |
467 mi_gdb_test "-var-show-attributes s" \ | |
468 "\\^done,attr=\"noneditable\"" \ | |
469 "is s editable" | |
470 | |
471 # Test: c_variable-7.34 | |
472 # Desc: number of children of s | |
473 mi_gdb_test "-var-info-num-children s" \ | |
474 "\\^done,numchild=\"6\"" \ | |
475 "get number of children of s" | |
476 | |
477 # Test: c_variable-7.35 | |
478 # Desc: children of s | |
479 mi_list_varobj_children s { | |
480 {s.integer integer 0 int} | |
481 {s.unsigned_integer unsigned_integer 0 "unsigned int"} | |
482 {s.character character 0 char} | |
483 {s.signed_character signed_character 0 "signed char"} | |
484 {s.char_ptr char_ptr 1 {char \*}} | |
485 {s.array_of_10 array_of_10 10 {int \[10\]}} | |
486 } "get children of s" | |
487 #} {integer unsigned_integer character signed_character char_ptr array_of_10} | |
488 | |
489 # Test: c_variable-7.40 | |
490 # Desc: create anons | |
491 mi_create_varobj anons anons "create local variable anons" | |
492 | |
493 # Test: c_variable-7.41 | |
494 # Desc: value of anons | |
495 mi_gdb_test "-var-evaluate-expression anons" \ | |
496 "\\^done,value=\"\{\\.\\.\\.\}\"" \ | |
497 "eval variable anons" | |
498 | |
499 # Test: c_variable-7.42 | |
500 # Desc: type of anons | |
501 mi_gdb_test "-var-info-type anons" \ | |
502 "\\^done,type=\"struct \{\\.\\.\\.\}\"" \ | |
503 "info type variable anons" | |
504 | |
505 # Test: c_variable-7.43 | |
506 # Desc: is anons editable | |
507 mi_gdb_test "-var-show-attributes anons" \ | |
508 "\\^done,attr=\"noneditable\"" \ | |
509 "is anons editable" | |
510 | |
511 # Test: c_variable-7.44 | |
512 # Desc: number of children of anons | |
513 mi_gdb_test "-var-info-num-children anons" \ | |
514 "\\^done,numchild=\"3\"" \ | |
515 "get number of children of anons" | |
516 | |
517 # Test: c_variable-7.45 | |
518 # Desc: children of anons | |
519 mi_list_varobj_children anons { | |
520 {anons.a a 0 int} | |
521 {anons.b b 0 char} | |
522 {anons.c c 0 "long int"} | |
523 } "get children of anons" | |
524 | |
525 # Test: c_variable-7.50 | |
526 # Desc: create enum e | |
527 mi_create_varobj e e "create local variable e" | |
528 | |
529 # Test: c_variable-7.51 | |
530 # Desc: value of e | |
531 mi_gdb_test "-var-evaluate-expression e" \ | |
532 "\\^done,value=\"bar\"" \ | |
533 "eval variable e" | |
534 | |
535 # Test: c_variable-7.52 | |
536 # Desc: type of e | |
537 mi_gdb_test "-var-info-type e" \ | |
538 "\\^done,type=\"enum foo\"" \ | |
539 "info type variable e" | |
540 | |
541 # Test: c_variable-7.53 | |
542 # Desc: is e editable | |
543 mi_gdb_test "-var-show-attributes e" \ | |
544 "\\^done,attr=\"editable\"" \ | |
545 "is e editable" | |
546 | |
547 # Test: c_variable-7.54 | |
548 # Desc: number of children of e | |
549 mi_gdb_test "-var-info-num-children e" \ | |
550 "\\^done,numchild=\"0\"" \ | |
551 "get number of children of e" | |
552 | |
553 # Test: c_variable-7.55 | |
554 # Desc: children of e | |
555 mi_gdb_test "-var-list-children e" \ | |
556 "\\^done,numchild=\"0\",has_more=\"0\"" \ | |
557 "get children of e" | |
558 | |
559 # Test: c_variable-7.60 | |
560 # Desc: create anone | |
561 mi_create_varobj anone anone "create local variable anone" | |
562 | |
563 # Test: c_variable-7.61 | |
564 # Desc: value of anone | |
565 mi_gdb_test "-var-evaluate-expression anone" \ | |
566 "\\^done,value=\"A\"" \ | |
567 "eval variable anone" | |
568 | |
569 # Test: c_variable-7.70 | |
570 # Desc: create anone | |
571 mi_gdb_test "-var-create anone * anone" \ | |
572 "\\^error,msg=\"Duplicate variable object name\"" \ | |
573 "create duplicate local variable anone" | |
574 | |
575 | |
576 # Test: c_variable-7.72 | |
577 # Desc: type of anone | |
578 mi_gdb_test "-var-info-type anone" \ | |
579 "\\^done,type=\"enum \{\\.\\.\\.\}\"" \ | |
580 "info type variable anone" | |
581 | |
582 | |
583 # Test: c_variable-7.73 | |
584 # Desc: is anone editable | |
585 mi_gdb_test "-var-show-attributes anone" \ | |
586 "\\^done,attr=\"editable\"" \ | |
587 "is anone editable" | |
588 | |
589 # Test: c_variable-7.74 | |
590 # Desc: number of children of anone | |
591 mi_gdb_test "-var-info-num-children anone" \ | |
592 "\\^done,numchild=\"0\"" \ | |
593 "get number of children of anone" | |
594 | |
595 # Test: c_variable-7.75 | |
596 # Desc: children of anone | |
597 mi_gdb_test "-var-list-children anone" \ | |
598 "\\^done,numchild=\"0\",has_more=\"0\"" \ | |
599 "get children of anone" | |
600 | |
601 | |
602 # Record fp | |
603 if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] { | |
604 set fp $expect_out(3,string) | |
605 } | |
606 | |
607 mi_continue_to "incr_a" | |
608 | |
609 # Test: c_variable-7.81 | |
610 # Desc: Create variables in different scopes | |
611 mi_gdb_test "-var-create a1 * a" \ | |
612 "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \ | |
613 "create local variable a1" | |
614 | |
615 mi_gdb_test "-var-create a2 $fp a" \ | |
616 "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \ | |
617 "create variable a2 in different scope" | |
618 | |
619 #gdbtk_test c_variable-7.81 {create variables in different scopes} { | |
620 # set a1 [gdb_variable create -expr a] | |
621 # set a2 [gdb_variable create -expr a -frame $fp] | |
622 | |
623 # set vals {} | |
624 # lappend vals [$a1 value] | |
625 # lappend vals [$a2 value] | |
626 # set vals | |
627 #} {2 1} | |
628 | |
629 | |
630 mi_gdb_exit | |
631 return 0 | |
OLD | NEW |