Commit | Line | Data |
---|---|---|
9b254dd1 | 1 | # Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 |
76ff342d | 2 | # Free Software Foundation, Inc. |
2fcf52f0 | 3 | # |
e22f8b7c | 4 | # This program is free software; you can redistribute it and/or modify |
2fcf52f0 | 5 | # it under the terms of the GNU General Public License as published by |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
2fcf52f0 AC |
7 | # (at your option) any later version. |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
2fcf52f0 | 16 | |
2fcf52f0 AC |
17 | # Test essential Machine interface (MI) operations |
18 | # | |
19 | # Verify that, using the MI, we can create, update, delete variables. | |
20 | # | |
21 | ||
22 | ||
23 | load_lib mi-support.exp | |
24 | set MIFLAGS "-i=mi2" | |
25 | ||
26 | gdb_exit | |
27 | if [mi_gdb_start] { | |
28 | continue | |
29 | } | |
30 | ||
31 | set testfile "var-cmd" | |
32 | set srcfile ${testfile}.c | |
33 | set binfile ${objdir}/${subdir}/${testfile} | |
34 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { | |
b60f0898 JB |
35 | untested mi2-var-display.exp |
36 | return -1 | |
2fcf52f0 AC |
37 | } |
38 | ||
39 | mi_delete_breakpoints | |
40 | mi_gdb_reinitialize_dir $srcdir/$subdir | |
41 | mi_gdb_load ${binfile} | |
42 | ||
e1c2defa | 43 | set line_dct_end [gdb_get_line_number "{int a = 0;}"] |
469aff8e | 44 | |
e1c2defa NS |
45 | mi_gdb_test "200-break-insert $srcfile:$line_dct_end" \ |
46 | "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_end\",times=\"0\"\}" \ | |
2fcf52f0 AC |
47 | "break-insert operation" |
48 | ||
49 | mi_run_cmd | |
bb378428 | 50 | mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" $line_dct_end "" "run to main" |
2fcf52f0 AC |
51 | |
52 | ##### ##### | |
53 | # # | |
54 | # Display tests # | |
55 | # # | |
56 | ##### ##### | |
57 | ||
58 | # Test: c_variable-6.1 | |
59 | # Desc: create variable bar | |
9e8e3afe | 60 | mi_create_varobj bar bar "create local variable bar" |
2fcf52f0 AC |
61 | |
62 | # Test: c_variable-6.2 | |
63 | # Desc: type of variable bar | |
64 | mi_gdb_test "-var-info-type bar" \ | |
65 | "\\^done,type=\"int\"" \ | |
66 | "info type variable bar" | |
67 | ||
68 | # Test: c_variable-6.3 | |
69 | # Desc: format of variable bar | |
70 | mi_gdb_test "-var-show-format bar" \ | |
71 | "\\^done,format=\"natural\"" \ | |
72 | "show format variable bar" | |
73 | ||
74 | # Test: c_variable-6.4 | |
75 | # Desc: value of variable bar | |
76 | mi_gdb_test "-var-evaluate-expression bar" \ | |
77 | "\\^done,value=\"2121\"" \ | |
78 | "eval variable bar" | |
79 | ||
80 | # Test: c_variable-6.5 | |
81 | # Desc: change format of bar to hex | |
82 | mi_gdb_test "-var-set-format bar hexadecimal" \ | |
8a578dd7 | 83 | "\\^done,format=\"hexadecimal\",value=\"0x849\"" \ |
2fcf52f0 AC |
84 | "set format variable bar" |
85 | ||
86 | # Test: c_variable-6.6 | |
87 | # Desc: value of bar with new format | |
88 | mi_gdb_test "-var-evaluate-expression bar" \ | |
89 | "\\^done,value=\"0x849\"" \ | |
90 | "eval variable bar with new format" | |
91 | ||
92 | # Test: c_variable-6.7 | |
93 | # Desc: change value of bar | |
94 | mi_gdb_test "-var-assign bar 3" \ | |
95 | "\\^done,value=\"0x3\"" \ | |
96 | "assing to variable bar" | |
97 | ||
98 | mi_gdb_test "-var-set-format bar decimal" \ | |
8a578dd7 | 99 | "\\^done,format=\"decimal\",value=\"3\"" \ |
2fcf52f0 AC |
100 | "set format variable bar" |
101 | ||
102 | mi_gdb_test "-var-evaluate-expression bar" \ | |
103 | "\\^done,value=\"3\"" \ | |
104 | "eval variable bar with new value" | |
105 | ||
106 | mi_gdb_test "-var-delete bar" \ | |
107 | "\\^done,ndeleted=\"1\"" \ | |
108 | "delete var bar" | |
109 | ||
110 | # Test: c_variable-6.11 | |
111 | # Desc: create variable foo | |
9e8e3afe | 112 | mi_create_varobj foo foo "create local variable foo" |
2fcf52f0 AC |
113 | |
114 | # Test: c_variable-6.12 | |
115 | # Desc: type of variable foo | |
116 | mi_gdb_test "-var-info-type foo" \ | |
117 | "\\^done,type=\"int \\*\"" \ | |
118 | "info type variable foo" | |
119 | ||
120 | # Test: c_variable-6.13 | |
121 | # Desc: format of variable foo | |
122 | mi_gdb_test "-var-show-format foo" \ | |
123 | "\\^done,format=\"natural\"" \ | |
124 | "show format variable foo" | |
125 | ||
126 | # Test: c_variable-6.14 | |
127 | # Desc: value of variable foo | |
128 | mi_gdb_test "-var-evaluate-expression foo" \ | |
129 | "\\^done,value=\"$hex\"" \ | |
130 | "eval variable foo" | |
131 | ||
132 | # Test: c_variable-6.15 | |
133 | # Desc: change format of var to octal | |
134 | mi_gdb_test "-var-set-format foo octal" \ | |
8a578dd7 | 135 | "\\^done,format=\"octal\",value=\"$octal\"" \ |
2fcf52f0 AC |
136 | "set format variable foo" |
137 | ||
138 | mi_gdb_test "-var-show-format foo" \ | |
139 | "\\^done,format=\"octal\"" \ | |
140 | "show format variable foo" | |
141 | ||
142 | # Test: c_variable-6.16 | |
143 | # Desc: value of foo with new format | |
144 | mi_gdb_test "-var-evaluate-expression foo" \ | |
145 | "\\^done,value=\"\[0-7\]+\"" \ | |
146 | "eval variable foo" | |
147 | ||
148 | # Test: c_variable-6.17 | |
149 | # Desc: change value of foo | |
150 | mi_gdb_test "-var-assign foo 3" \ | |
151 | "\\^done,value=\"03\"" \ | |
152 | "assing to variable foo" | |
153 | ||
154 | mi_gdb_test "-var-set-format foo decimal" \ | |
8a578dd7 | 155 | "\\^done,format=\"decimal\",value=\"3\"" \ |
2fcf52f0 AC |
156 | "set format variable foo" |
157 | ||
158 | # Test: c_variable-6.18 | |
159 | # Desc: check new value of foo | |
160 | mi_gdb_test "-var-evaluate-expression foo" \ | |
161 | "\\^done,value=\"3\"" \ | |
162 | "eval variable foo" | |
163 | ||
164 | mi_gdb_test "-var-delete foo" \ | |
165 | "\\^done,ndeleted=\"1\"" \ | |
166 | "delete var foo" | |
167 | ||
168 | # Test: c_variable-6.21 | |
169 | # Desc: create variable weird and children | |
9e8e3afe VP |
170 | mi_create_varobj weird weird "create local variable weird" |
171 | ||
172 | mi_list_varobj_children weird { | |
173 | {weird.integer integer 0 int} | |
174 | {weird.character character 0 char} | |
175 | {weird.char_ptr char_ptr 1 "char \\*"} | |
176 | {weird.long_int long_int 0 "long int"} | |
177 | {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"} | |
178 | {weird.long_array long_array 10 "long int \\[10\\]"} | |
179 | {weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"} | |
180 | {weird.func_ptr_struct func_ptr_struct 0 \ | |
181 | "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"} | |
182 | {weird.func_ptr_ptr func_ptr_ptr 0 \ | |
183 | "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"} | |
184 | {weird.u1 u1 4 "union \\{\\.\\.\\.\\}"} | |
185 | {weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"} | |
186 | } "get children local variable weird" | |
2fcf52f0 AC |
187 | |
188 | ||
189 | # Test: c_variable-6.23 | |
190 | # Desc: change format of weird.func_ptr and weird.func_ptr_ptr | |
191 | mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ | |
8a578dd7 | 192 | "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ |
2fcf52f0 AC |
193 | "set format variable weird.func_ptr" |
194 | ||
195 | mi_gdb_test "-var-show-format weird.func_ptr" \ | |
196 | "\\^done,format=\"hexadecimal\"" \ | |
197 | "show format variable weird.func_ptr" | |
198 | ||
199 | mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \ | |
8a578dd7 | 200 | "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ |
2fcf52f0 AC |
201 | "set format variable weird.func_ptr_ptr" |
202 | ||
203 | mi_gdb_test "-var-show-format weird.func_ptr_ptr" \ | |
204 | "\\^done,format=\"hexadecimal\"" \ | |
205 | "show format variable weird.func_ptr_ptr" | |
206 | ||
207 | # Test: c_variable-6.24 | |
208 | # Desc: format of weird and children | |
209 | mi_gdb_test "-var-set-format weird natural" \ | |
8a578dd7 | 210 | "\\^done,format=\"natural\",value=\"$hex\"" \ |
2fcf52f0 AC |
211 | "set format variable weird" |
212 | ||
213 | mi_gdb_test "-var-set-format weird.integer natural" \ | |
8a578dd7 | 214 | "\\^done,format=\"natural\",value=\"123\"" \ |
2fcf52f0 AC |
215 | "set format variable weird.integer" |
216 | ||
217 | mi_gdb_test "-var-set-format weird.character natural" \ | |
8a578dd7 | 218 | "\\^done,format=\"natural\",value=\"0 '\\\\\\\\0'\"" \ |
2fcf52f0 AC |
219 | "set format variable weird.character" |
220 | ||
221 | mi_gdb_test "-var-set-format weird.char_ptr natural" \ | |
8a578dd7 | 222 | "\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \ |
2fcf52f0 AC |
223 | "set format variable weird.char_ptr" |
224 | ||
225 | mi_gdb_test "-var-set-format weird.long_int natural" \ | |
8a578dd7 | 226 | "\\^done,format=\"natural\",value=\"0\"" \ |
2fcf52f0 AC |
227 | "set format variable weird.long_int" |
228 | ||
229 | mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \ | |
8a578dd7 | 230 | "\\^done,format=\"natural\",value=\"$hex\"" \ |
2fcf52f0 AC |
231 | "set format variable weird.int_ptr_ptr" |
232 | ||
233 | mi_gdb_test "-var-set-format weird.long_array natural" \ | |
8a578dd7 | 234 | "\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \ |
2fcf52f0 AC |
235 | "set format variable weird.long_array" |
236 | ||
237 | mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ | |
8a578dd7 | 238 | "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ |
2fcf52f0 AC |
239 | "set format variable weird.func_ptr" |
240 | ||
241 | mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ | |
8a578dd7 | 242 | "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ |
2fcf52f0 AC |
243 | "set format variable weird.func_ptr_struct" |
244 | ||
245 | mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ | |
8a578dd7 | 246 | "\\^done,format=\"natural\",value=\"0\"" \ |
2fcf52f0 AC |
247 | "set format variable weird.func_ptr_ptr" |
248 | ||
249 | mi_gdb_test "-var-set-format weird.u1 natural" \ | |
8a578dd7 | 250 | "\\^done,format=\"natural\",value=\"\{...\}\"" \ |
2fcf52f0 AC |
251 | "set format variable weird.u1" |
252 | ||
253 | mi_gdb_test "-var-set-format weird.s2 natural" \ | |
8a578dd7 | 254 | "\\^done,format=\"natural\",value=\"\{...\}\"" \ |
2fcf52f0 AC |
255 | "set format variable weird.s2" |
256 | ||
257 | # Test: c_variable-6.25 | |
258 | # Desc: value of weird and children | |
259 | #gdbtk_test c_variable-6.25 {value of weird and children} { | |
260 | # set values {} | |
261 | # foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] { | |
262 | # lappend values [value $v $f] | |
263 | # } | |
264 | ||
265 | # set values | |
266 | #} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} | |
267 | ||
268 | # Test: c_variable-6.26 | |
269 | # Desc: change format of weird and children to octal | |
270 | #gdbtk_test c_variable-6.26 {change format of weird and children to octal} { | |
271 | # set formats {} | |
272 | # foreach v [lsort [array names var]] { | |
273 | # $var($v) format octal | |
274 | # lappend formats [$var($v) format] | |
275 | # } | |
276 | ||
277 | # set formats | |
278 | #} {octal octal octal octal octal octal octal octal octal octal octal octal} | |
279 | ||
280 | # Test: c_variable-6.27 | |
281 | # Desc: value of weird and children with new format | |
282 | #gdbtk_test c_variable-6.27 {value of foo with new format} { | |
283 | # set values {} | |
284 | # foreach v [lsort [array names var]] { | |
285 | # lappend values [value $v o] | |
286 | # } | |
287 | ||
288 | # set values | |
289 | #} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1} | |
290 | ||
291 | # Test: c_variable-6.30 | |
292 | # Desc: create more children of weird | |
293 | #gdbtk_test c_variable-6.30 {create more children of weird} { | |
294 | # foreach v [array names var] { | |
295 | # get_children $v | |
296 | # } | |
297 | ||
298 | # # Do it twice to get more children | |
299 | # foreach v [array names var] { | |
300 | # get_children $v | |
301 | # } | |
302 | ||
303 | # lsort [array names var] | |
304 | #} {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} | |
305 | ||
306 | # Test: c_variable-6.31 | |
307 | # Desc: check that all children of weird change | |
308 | # Ok, obviously things like weird.s2 and weird.u1 will not change! | |
309 | #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)} { | |
310 | # $var(weird) value 0x2121 | |
311 | # check_update | |
312 | #} {{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} {}} | |
313 | ||
314 | mi_gdb_test "-var-delete weird" \ | |
315 | "\\^done,ndeleted=\"12\"" \ | |
316 | "delete var weird" | |
317 | ||
318 | ||
319 | ##### ##### | |
320 | # # | |
321 | # Special Display Tests # | |
322 | # # | |
323 | ##### ##### | |
324 | ||
325 | # Stop in "do_special_tests" | |
469aff8e | 326 | |
6c2d1a6b | 327 | set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"] |
469aff8e | 328 | |
6c2d1a6b MK |
329 | mi_gdb_test "200-break-insert $line_dst_incr_a_2" \ |
330 | "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_incr_a_2\",times=\"0\"\}" \ | |
2fcf52f0 AC |
331 | "break-insert operation" |
332 | ||
bb378428 VP |
333 | mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" ".*var-cmd.c" $line_dst_incr_a_2 "" \ |
334 | "continue to do_special_tests" | |
2fcf52f0 AC |
335 | |
336 | # Test: c_variable-7.10 | |
337 | # Desc: create union u | |
9e8e3afe | 338 | mi_create_varobj u u "create local variable u" |
2fcf52f0 AC |
339 | |
340 | # Test: c_variable-7.11 | |
341 | # Desc: value of u | |
342 | mi_gdb_test "-var-evaluate-expression u" \ | |
343 | "\\^done,value=\"\{\\.\\.\\.\}\"" \ | |
344 | "eval variable u" | |
345 | ||
346 | # Test: c_variable-7.12 | |
347 | # Desc: type of u | |
348 | mi_gdb_test "-var-info-type u" \ | |
349 | "\\^done,type=\"union named_union\"" \ | |
350 | "info type variable u" | |
351 | ||
352 | # Test: c_variable-7.13 | |
353 | # Desc: is u editable | |
354 | mi_gdb_test "-var-show-attributes u" \ | |
355 | "\\^done,attr=\"noneditable\"" \ | |
356 | "is u editable" | |
357 | ||
358 | # Test: c_variable-7.14 | |
359 | # Desc: number of children of u | |
360 | mi_gdb_test "-var-info-num-children u" \ | |
361 | "\\^done,numchild=\"2\"" \ | |
362 | "get number of children of u" | |
363 | ||
364 | # Test: c_variable-7.15 | |
365 | # Desc: children of u | |
9e8e3afe VP |
366 | mi_list_varobj_children u { |
367 | {u.integer integer 0 int} | |
368 | {u.char_ptr char_ptr 1 {char \*}} | |
369 | } "get children of u" | |
2fcf52f0 AC |
370 | |
371 | # Test: c_variable-7.20 | |
372 | # Desc: create anonu | |
9e8e3afe | 373 | mi_create_varobj anonu anonu "create local variable anonu" |
2fcf52f0 AC |
374 | |
375 | # Test: c_variable-7.21 | |
376 | # Desc: value of anonu | |
377 | mi_gdb_test "-var-evaluate-expression anonu" \ | |
378 | "\\^done,value=\"\{\\.\\.\\.\}\"" \ | |
379 | "eval variable anonu" | |
380 | ||
381 | # Test: c_variable-7.22 | |
382 | # Desc: type of anonu | |
383 | mi_gdb_test "-var-info-type anonu" \ | |
384 | "\\^done,type=\"union \{\\.\\.\\.\}\"" \ | |
385 | "info type variable anonu" | |
386 | ||
387 | # Test: c_variable-7.23 | |
388 | # Desc: is anonu editable | |
389 | mi_gdb_test "-var-show-attributes anonu" \ | |
390 | "\\^done,attr=\"noneditable\"" \ | |
391 | "is anonu editable" | |
392 | ||
393 | # Test: c_variable-7.24 | |
394 | # Desc: number of children of anonu | |
395 | mi_gdb_test "-var-info-num-children anonu" \ | |
396 | "\\^done,numchild=\"3\"" \ | |
397 | "get number of children of anonu" | |
398 | ||
399 | # Test: c_variable-7.25 | |
400 | # Desc: children of anonu | |
9e8e3afe VP |
401 | mi_list_varobj_children "anonu" { |
402 | {anonu.a a 0 int} | |
403 | {anonu.b b 0 char} | |
404 | {anonu.c c 0 "long int"} | |
405 | } "get children of anonu" | |
2fcf52f0 AC |
406 | |
407 | # Test: c_variable-7.30 | |
408 | # Desc: create struct s | |
9e8e3afe | 409 | mi_create_varobj s s "create local variable s" |
3fddb3ad | 410 | |
2fcf52f0 AC |
411 | |
412 | # Test: c_variable-7.31 | |
413 | # Desc: value of s | |
414 | mi_gdb_test "-var-evaluate-expression s" \ | |
415 | "\\^done,value=\"\{\\.\\.\\.\}\"" \ | |
416 | "eval variable s" | |
417 | ||
418 | # Test: c_variable-7.32 | |
419 | # Desc: type of s | |
420 | mi_gdb_test "-var-info-type s" \ | |
421 | "\\^done,type=\"struct _simple_struct\"" \ | |
422 | "info type variable s" | |
423 | ||
424 | # Test: c_variable-7.33 | |
425 | # Desc: is s editable | |
426 | mi_gdb_test "-var-show-attributes s" \ | |
427 | "\\^done,attr=\"noneditable\"" \ | |
428 | "is s editable" | |
429 | ||
430 | # Test: c_variable-7.34 | |
431 | # Desc: number of children of s | |
432 | mi_gdb_test "-var-info-num-children s" \ | |
433 | "\\^done,numchild=\"6\"" \ | |
434 | "get number of children of s" | |
435 | ||
436 | # Test: c_variable-7.35 | |
437 | # Desc: children of s | |
9e8e3afe VP |
438 | mi_list_varobj_children s { |
439 | {s.integer integer 0 int} | |
440 | {s.unsigned_integer unsigned_integer 0 "unsigned int"} | |
441 | {s.character character 0 char} | |
442 | {s.signed_character signed_character 0 "signed char"} | |
443 | {s.char_ptr char_ptr 1 {char \*}} | |
444 | {s.array_of_10 array_of_10 10 {int \[10\]}} | |
445 | } "get children of s" | |
2fcf52f0 AC |
446 | #} {integer unsigned_integer character signed_character char_ptr array_of_10} |
447 | ||
448 | # Test: c_variable-7.40 | |
449 | # Desc: create anons | |
9e8e3afe | 450 | mi_create_varobj anons anons "create local variable anons" |
2fcf52f0 AC |
451 | |
452 | # Test: c_variable-7.41 | |
453 | # Desc: value of anons | |
454 | mi_gdb_test "-var-evaluate-expression anons" \ | |
455 | "\\^done,value=\"\{\\.\\.\\.\}\"" \ | |
456 | "eval variable anons" | |
457 | ||
458 | # Test: c_variable-7.42 | |
459 | # Desc: type of anons | |
460 | mi_gdb_test "-var-info-type anons" \ | |
461 | "\\^done,type=\"struct \{\\.\\.\\.\}\"" \ | |
462 | "info type variable anons" | |
463 | ||
464 | # Test: c_variable-7.43 | |
465 | # Desc: is anons editable | |
466 | mi_gdb_test "-var-show-attributes anons" \ | |
467 | "\\^done,attr=\"noneditable\"" \ | |
468 | "is anons editable" | |
469 | ||
470 | # Test: c_variable-7.44 | |
471 | # Desc: number of children of anons | |
472 | mi_gdb_test "-var-info-num-children anons" \ | |
473 | "\\^done,numchild=\"3\"" \ | |
474 | "get number of children of anons" | |
475 | ||
476 | # Test: c_variable-7.45 | |
477 | # Desc: children of anons | |
9e8e3afe VP |
478 | mi_list_varobj_children anons { |
479 | {anons.a a 0 int} | |
480 | {anons.b b 0 char} | |
481 | {anons.c c 0 "long int"} | |
482 | } "get children of anons" | |
2fcf52f0 AC |
483 | |
484 | # Test: c_variable-7.50 | |
485 | # Desc: create enum e | |
9e8e3afe | 486 | mi_create_varobj e e "create local variable e" |
2fcf52f0 AC |
487 | |
488 | setup_xfail "*-*-*" | |
489 | # Test: c_variable-7.51 | |
490 | # Desc: value of e | |
491 | mi_gdb_test "-var-evaluate-expression e" \ | |
492 | "\\^done,value=\"FIXME\"" \ | |
493 | "eval variable e" | |
494 | clear_xfail "*-*-*" | |
495 | ||
496 | # Test: c_variable-7.52 | |
497 | # Desc: type of e | |
498 | mi_gdb_test "-var-info-type e" \ | |
499 | "\\^done,type=\"enum foo\"" \ | |
500 | "info type variable e" | |
501 | ||
502 | # Test: c_variable-7.53 | |
503 | # Desc: is e editable | |
504 | mi_gdb_test "-var-show-attributes e" \ | |
505 | "\\^done,attr=\"editable\"" \ | |
506 | "is e editable" | |
507 | ||
508 | # Test: c_variable-7.54 | |
509 | # Desc: number of children of e | |
510 | mi_gdb_test "-var-info-num-children e" \ | |
511 | "\\^done,numchild=\"0\"" \ | |
512 | "get number of children of e" | |
513 | ||
514 | # Test: c_variable-7.55 | |
515 | # Desc: children of e | |
516 | mi_gdb_test "-var-list-children e" \ | |
517 | "\\^done,numchild=\"0\"" \ | |
518 | "get children of e" | |
519 | ||
520 | # Test: c_variable-7.60 | |
521 | # Desc: create anone | |
9e8e3afe | 522 | mi_create_varobj anone anone "create local variable anone" |
2fcf52f0 | 523 | |
2fcf52f0 AC |
524 | # Test: c_variable-7.61 |
525 | # Desc: value of anone | |
526 | mi_gdb_test "-var-evaluate-expression anone" \ | |
527 | "\\^done,value=\"A\"" \ | |
528 | "eval variable anone" | |
2fcf52f0 AC |
529 | |
530 | # Test: c_variable-7.70 | |
531 | # Desc: create anone | |
532 | mi_gdb_test "-var-create anone * anone" \ | |
a13e061a | 533 | "\\^error,msg=\"Duplicate variable object name\"" \ |
2fcf52f0 AC |
534 | "create duplicate local variable anone" |
535 | ||
536 | ||
537 | # Test: c_variable-7.72 | |
538 | # Desc: type of anone | |
539 | mi_gdb_test "-var-info-type anone" \ | |
540 | "\\^done,type=\"enum \{\\.\\.\\.\}\"" \ | |
541 | "info type variable anone" | |
542 | ||
543 | ||
544 | # Test: c_variable-7.73 | |
545 | # Desc: is anone editable | |
546 | mi_gdb_test "-var-show-attributes anone" \ | |
547 | "\\^done,attr=\"editable\"" \ | |
548 | "is anone editable" | |
549 | ||
550 | # Test: c_variable-7.74 | |
551 | # Desc: number of children of anone | |
552 | mi_gdb_test "-var-info-num-children anone" \ | |
553 | "\\^done,numchild=\"0\"" \ | |
554 | "get number of children of anone" | |
555 | ||
556 | # Test: c_variable-7.75 | |
557 | # Desc: children of anone | |
558 | mi_gdb_test "-var-list-children anone" \ | |
559 | "\\^done,numchild=\"0\"" \ | |
560 | "get children of anone" | |
561 | ||
562 | ||
563 | # Record fp | |
564 | ||
565 | send_gdb "p/x \$fp\n" | |
566 | gdb_expect { | |
567 | -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" { | |
568 | pass "print FP register" | |
569 | set fp $expect_out(1,string) | |
570 | } | |
571 | # -re ".*" { fail "print FP register"} | |
572 | timeout { fail "print FP register (timeout)"} | |
573 | } | |
574 | ||
bb378428 | 575 | mi_continue_to "incr_a" |
2fcf52f0 AC |
576 | |
577 | # Test: c_variable-7.81 | |
578 | # Desc: Create variables in different scopes | |
3fddb3ad | 579 | mi_gdb_test "-var-create a1 * a" \ |
9e8e3afe | 580 | "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \ |
3fddb3ad | 581 | "create local variable a1" |
2fcf52f0 AC |
582 | |
583 | mi_gdb_test "-var-create a2 $fp a" \ | |
9e8e3afe | 584 | "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \ |
2fcf52f0 AC |
585 | "create variable a2 in different scope" |
586 | ||
587 | #gdbtk_test c_variable-7.81 {create variables in different scopes} { | |
588 | # set a1 [gdb_variable create -expr a] | |
589 | # set a2 [gdb_variable create -expr a -frame $fp] | |
590 | ||
591 | # set vals {} | |
592 | # lappend vals [$a1 value] | |
593 | # lappend vals [$a2 value] | |
594 | # set vals | |
595 | #} {2 1} | |
596 | ||
597 | ||
598 | mi_gdb_exit | |
599 | return 0 |