e49bfa7568aa957ca88d2dd18cebd37aaea30ebe
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi2-var-child.exp
1 # Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2009 Free Software
2 # Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
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
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
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}/mi2-var-child
34 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
35 untested mi2-var-child.exp
36 return -1
37 }
38
39 mi_delete_breakpoints
40 mi_gdb_reinitialize_dir $srcdir/$subdir
41 mi_gdb_load ${binfile}
42
43 mi_runto do_children_tests
44
45 set line_dlt_first_real [gdb_get_line_number "weird = &struct_declarations;"]
46 mi_continue_to_line $line_dlt_first_real "step to real start of do_children_test"
47
48 ##### #####
49 # #
50 # children tests #
51 # #
52 ##### #####
53
54
55 # Test: c_variable-4.2
56 # Desc: create variable "struct_declarations"
57 mi_create_varobj "struct_declarations" "struct_declarations" \
58 "create local variable struct_declarations"
59
60 # Test: c_variable-4.3
61 # Desc: children of struct_declarations
62 # STABS doesn't give us argument types for the func ptr structs, but
63 # Dwarf 2 does.
64 mi_list_varobj_children "struct_declarations" {
65 {struct_declarations.integer integer 0 int}
66 {struct_declarations.character character 0 char}
67 {struct_declarations.char_ptr char_ptr 1 "char \\*"}
68 {struct_declarations.long_int long_int 0 "long int"}
69 {struct_declarations.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
70 {struct_declarations.long_array long_array 10 "long int \\[10\\]"}
71 {struct_declarations.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
72 {struct_declarations.func_ptr_struct func_ptr_struct 0 \
73 "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"}
74 {struct_declarations.func_ptr_ptr func_ptr_ptr 0 \
75 "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"}
76 {struct_declarations.u1 u1 4 "union \\{\\.\\.\\.\\}"}
77 {struct_declarations.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
78 } "get children of struct_declarations"
79
80
81 #gdbtk_test c_variable-4.3 {children of struct_declarations} {
82 # get_children struct_declarations
83 #} {integer character char_ptr long_int int_ptr_ptr long_array func_ptr func_ptr_struct func_ptr_ptr u1 s2}
84
85 # Test: c_variable-4.4
86 # Desc: number of children of struct_declarations
87 mi_gdb_test "-var-info-num-children struct_declarations" \
88 "\\^done,numchild=\"11\"" \
89 "get number of children of struct_declarations"
90
91 # Test: c_variable-4.5
92 # Desc: children of struct_declarations.integer
93 mi_list_varobj_children "struct_declarations.integer" {} \
94 "get children of struct_declarations.integer"
95
96 # Test: c_variable-4.6
97 # Desc: number of children of struct_declarations.integer
98 mi_gdb_test "-var-info-num-children struct_declarations.integer" \
99 "\\^done,numchild=\"0\"" \
100 "get number of children of struct_declarations.integer"
101
102 # Test: c_variable-4.7
103 # Desc: children of struct_declarations.character
104 mi_list_varobj_children "struct_declarations.character" {} \
105 "get children of struct_declarations.character"
106
107 # Test: c_variable-4.8
108 # Desc: number of children of struct_declarations.character
109 mi_gdb_test "-var-info-num-children struct_declarations.character" \
110 "\\^done,numchild=\"0\"" \
111 "get number of children of struct_declarations.character"
112
113 # Test: c_variable-4.9
114 # Desc: children of struct_declarations.char_ptr
115 mi_list_varobj_children "struct_declarations.char_ptr" {
116 {{struct_declarations.char_ptr.\*char_ptr} {\*char_ptr} 0 char}
117 } "get children of struct_declarations.char_ptr"
118
119 # Test: c_variable-4.10
120 # Desc: number of children of struct_declarations.char_ptr
121 mi_gdb_test "-var-info-num-children struct_declarations.char_ptr" \
122 "\\^done,numchild=\"1\"" \
123 "get number of children of struct_declarations.char_ptr"
124
125 # Test: c_variable-4.11
126 # Desc: children of struct_declarations.long_int
127 mi_list_varobj_children "struct_declarations.long_int" {} \
128 "get children of struct_declarations.long_int"
129
130 # Test: c_variable-4.12
131 # Desc: number of children of struct_declarations.long_int
132 mi_gdb_test "-var-info-num-children struct_declarations.long_int" \
133 "\\^done,numchild=\"0\"" \
134 "get number of children of struct_declarations.long_int"
135
136 # Test: c_variable-4.13
137 # Desc: children of int_ptr_ptr
138 mi_list_varobj_children "struct_declarations.int_ptr_ptr" {
139 {{struct_declarations.int_ptr_ptr.\*int_ptr_ptr} {\*int_ptr_ptr} 1 {int \*}}
140 } "get children of struct_declarations.int_ptr_ptr"
141
142 #gdbtk_test c_variable-4.13 {children of int_ptr_ptr} {
143 # get_children struct_declarations.int_ptr_ptr
144 #} {*int_ptr_ptr}
145
146 # Test: c_variable-4.14
147 # Desc: number of children of int_ptr_ptr
148 mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr" \
149 "\\^done,numchild=\"1\"" \
150 "get number of children of struct_declarations.int_ptr_ptr"
151
152
153 # Test: c_variable-4.15
154 # Desc: children of struct_declarations.long_array
155 mi_list_array_varobj_children "struct_declarations.long_array" 10 "long int" \
156 "get children of struct_declarations.long_array"
157
158 # Test: c_variable-4.16
159 # Desc: number of children of struct_declarations.long_array
160 mi_gdb_test "-var-info-num-children struct_declarations.long_array" \
161 "\\^done,numchild=\"10\"" \
162 "get number of children of struct_declarations.long_array"
163
164 # Test: c_variable-4.17
165 # Desc: children of struct_declarations.func_ptr
166 mi_list_varobj_children "struct_declarations.func_ptr" {} \
167 "get children of struct_declarations.func_ptr"
168
169 # Test: c_variable-4.18
170 # Desc: number of children of struct_declarations.func_ptr
171 mi_gdb_test "-var-info-num-children struct_declarations.func_ptr" \
172 "\\^done,numchild=\"0\"" \
173 "get number of children of struct_declarations.func_ptr"
174
175
176 # Test: c_variable-4.19
177 # Desc: children of struct_declarations.func_ptr_struct
178 mi_list_varobj_children "struct_declarations.func_ptr_struct" {} \
179 "get children of struct_declarations.func_ptr_struct"
180
181 # Test: c_variable-4.20
182 # Desc: number of children of struct_declarations.func_ptr_struct
183 mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_struct" \
184 "\\^done,numchild=\"0\"" \
185 "get number of children of struct_declarations.func_ptr_struct"
186
187
188 # Test: c_variable-4.21
189 # Desc: children of struct_declarations.func_ptr_ptr
190 mi_list_varobj_children "struct_declarations.func_ptr_ptr" {} \
191 "get children of struct_declarations.func_ptr_ptr"
192
193 # Test: c_variable-4.22
194 # Desc: number of children of struct_declarations.func_ptr_ptr
195 mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_ptr" \
196 "\\^done,numchild=\"0\"" \
197 "get number of children of struct_declarations.func_ptr_ptr"
198
199 # Test: c_variable-4.23
200 # Desc: children of struct_declarations.u1
201 mi_list_varobj_children "struct_declarations.u1" {
202 {struct_declarations.u1.a a 0 int}
203 {struct_declarations.u1.b b 1 {char \*}}
204 {struct_declarations.u1.c c 0 {long int}}
205 {struct_declarations.u1.d d 0 {enum foo}}
206 } "get children of struct_declarations.u1"
207
208 # Test: c_variable-4.24
209 # Desc: number of children of struct_declarations.u1
210 mi_gdb_test "-var-info-num-children struct_declarations.u1" \
211 "\\^done,numchild=\"4\"" \
212 "get number of children of struct_declarations.u1"
213
214 # Test: c_variable-4.25
215 # Desc: children of struct_declarations.s2
216 mi_list_varobj_children "struct_declarations.s2" {
217 {struct_declarations.s2.u2 u2 3 {union \{\.\.\.\}}}
218 {struct_declarations.s2.g g 0 int}
219 {struct_declarations.s2.h h 0 char}
220 {struct_declarations.s2.i i 10 {long int \[10\]}}
221 } "get children of struct_declarations.s2"
222
223 #gdbtk_test c_variable-4.25 {children of struct_declarations.s2} {
224 # get_children struct_declarations.s2
225 #} {u2 g h i}
226
227 # Test: c_variable-4.26
228 # Desc: number of children of struct_declarations.s2
229 mi_gdb_test "-var-info-num-children struct_declarations.s2" \
230 "\\^done,numchild=\"4\"" \
231 "get number of children of struct_declarations.s2"
232
233
234 for {set i 1} {$i <= 9} {incr i} {
235 mi_list_varobj_children "struct_declarations.long_array.$i" {} \
236 "get children of struct_declarations.long_array.$i"
237
238 mi_gdb_test "-var-info-num-children struct_declarations.long_array.$i" \
239 "\\^done,numchild=\"0\"" \
240 "get number of children of struct_declarations.long_array.$i"
241 }
242
243 # Test: c_variable-4.45
244 # Desc: children of struct_declarations.u1.a
245 mi_list_varobj_children "struct_declarations.u1.a" {} \
246 "get children of struct_declarations.u1.a"
247
248 # Test: c_variable-4.46
249 # Desc: number of children of struct_declarations.u1.a
250 mi_gdb_test "-var-info-num-children struct_declarations.u1.a" \
251 "\\^done,numchild=\"0\"" \
252 "get number of children of struct_declarations.u1.a"
253
254 # Test: c_variable-4.47
255 # Desc: children of struct_declarations.u1.b
256 mi_list_varobj_children "struct_declarations.u1.b" {
257 {{struct_declarations.u1.b.\*b} {\*b} 0 char}
258 } "get children of struct_declarations.u1.b"
259
260 # Test: c_variable-4.48
261 # Desc: number of children of struct_declarations.u1.b
262 mi_gdb_test "-var-info-num-children struct_declarations.u1.b" \
263 "\\^done,numchild=\"1\"" \
264 "get number of children of struct_declarations.u1.b"
265
266 # Test: c_variable-4.49
267 # Desc: children of struct_declarations.u1.c
268 mi_list_varobj_children "struct_declarations.u1.c" {} \
269 "get children of struct_declarations.u1.c"
270
271 # Test: c_variable-4.50
272 # Desc: number of children of struct_declarations.u1.c
273 mi_gdb_test "-var-info-num-children struct_declarations.u1.c" \
274 "\\^done,numchild=\"0\"" \
275 "get number of children of struct_declarations.u1.c"
276
277 # Test: c_variable-4.51
278 # Desc: children of struct_declarations.u1.d
279 mi_list_varobj_children "struct_declarations.u1.d" {} \
280 "get children of struct_declarations.u1.d"
281
282
283 # Test: c_variable-4.52
284 # Desc: number of children of struct_declarations.u1.d
285 mi_gdb_test "-var-info-num-children struct_declarations.u1.d" \
286 "\\^done,numchild=\"0\"" \
287 "get number of children of struct_declarations.u1.d"
288
289
290 # Test: c_variable-4.53
291 # Desc: children of struct_declarations.s2.u2
292 mi_list_varobj_children "struct_declarations.s2.u2" {
293 {"struct_declarations.s2.u2.u1s1" "u1s1" 4 {struct \{\.\.\.\}}}
294 {struct_declarations.s2.u2.f f 0 "long int"}
295 {struct_declarations.s2.u2.u1s2 u1s2 2 {struct \{\.\.\.\}}}
296 } "get children of struct_declarations.s2.u2"
297
298 # Test: c_variable-4.54
299 # Desc: number of children of struct_declarations.s2.u2
300 mi_gdb_test "-var-info-num-children struct_declarations.s2.u2" \
301 "\\^done,numchild=\"3\"" \
302 "get number of children of struct_declarations.s2.u2"
303
304 # Test: c_variable-4.55
305 # Desc: children of struct_declarations.s2.g
306 mi_list_varobj_children struct_declarations.s2.g {} \
307 "get children of struct_declarations.s2.g"
308
309 # Test: c_variable-4.56
310 # Desc: number of children of struct_declarations.s2.g
311 mi_gdb_test "-var-info-num-children struct_declarations.s2.g" \
312 "\\^done,numchild=\"0\"" \
313 "get number of children of struct_declarations.s2.g"
314
315
316 # Test: c_variable-4.57
317 # Desc: children of struct_declarations.s2.h
318 mi_list_varobj_children struct_declarations.s2.h {} \
319 "get children of struct_declarations.s2.h"
320
321 # Test: c_variable-4.58
322 # Desc: number of children of struct_declarations.s2.h
323 mi_gdb_test "-var-info-num-children struct_declarations.s2.h" \
324 "\\^done,numchild=\"0\"" \
325 "get number of children of struct_declarations.s2.h"
326
327
328 # Test: c_variable-4.59
329 # Desc: children of struct_declarations.s2.i
330 set t {}
331 for {set i 0} {$i < 10} {incr i} {
332 lappend t [list struct_declarations.s2.i.$i $i 0 "long int"]
333 }
334 mi_list_varobj_children struct_declarations.s2.i $t \
335 "get children of struct_declarations.s2.i"
336
337 # Test: c_variable-4.60
338 # Desc: number of children of struct_declarations.s2.i
339 mi_gdb_test "-var-info-num-children struct_declarations.s2.i" \
340 "\\^done,numchild=\"10\"" \
341 "get number of children of struct_declarations.s2.i"
342
343 # Test: c_variable-4.61
344 # Desc: children of struct_declarations.s2.u2.u1s1
345 mi_list_varobj_children struct_declarations.s2.u2.u1s1 {
346 {struct_declarations.s2.u2.u1s1.d d 0 int}
347 {struct_declarations.s2.u2.u1s1.e e 10 {char \[10\]}}
348 {struct_declarations.s2.u2.u1s1.func func 0 {int \*\(\*\)\((void)?\)}}
349 {struct_declarations.s2.u2.u1s1.foo foo 0 efoo}
350 } "get children of struct_declarations.s2.u2.u1s1"
351
352 # Test: c_variable-4.62
353 # Desc: number of children of struct_declarations.s2.u2.u1s1
354 mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1" \
355 "\\^done,numchild=\"4\"" \
356 "get number of children of struct_declarations.s2.u2.u1s1"
357
358 # Test: c_variable-4.63
359 # Desc: children of struct_declarations.s2.u2.f
360 mi_list_varobj_children struct_declarations.s2.u2.f {} \
361 "get children of struct_declarations.s2.u2.f"
362
363 # Test: c_variable-4.64
364 # Desc: number of children of struct_declarations.s2.u2.f
365 mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.f" \
366 "\\^done,numchild=\"0\"" \
367 "get number of children of struct_declarations.s2.u2.f"
368
369 # Test: c_variable-4.65
370 # Desc: children of struct_declarations.s2.u2.u1s2
371 mi_list_varobj_children struct_declarations.s2.u2.u1s2 {
372 {struct_declarations.s2.u2.u1s2.array_ptr array_ptr 2 {char \[2\]}}
373 {struct_declarations.s2.u2.u1s2.func func 0 {int \(\*\)\((int, char \*)?\)}}
374 } "get children of struct_declarations.s2.u2.u1s2"
375
376 # Test: c_variable-4.66
377 # Desc: number of children of struct_declarations.s2.u2.u1s2
378 mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2" \
379 "\\^done,numchild=\"2\"" \
380 "get number of children of struct_declarations.s2.u2.u1s2"
381
382 # Test: c_variable-4.67
383 # Desc: children of struct_declarations.s2.u2.u1s1.d
384 mi_list_varobj_children struct_declarations.s2.u2.u1s1.d {} \
385 "get children of struct_declarations.s2.u2.u1s1.d"
386
387 # Test: c_variable-4.68
388 # Desc: number of children of struct_declarations.s2.u2.u1s1.d
389 mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.d" \
390 "\\^done,numchild=\"0\"" \
391 "get number of children of struct_declarations.s2.u2.u1s1.d"
392
393 # Test: c_variable-4.69
394 # Desc: children of struct_declarations.s2.u2.u1s1.e
395 set t {}
396 for {set i 0} {$i < 10} {incr i} {
397 lappend t [list struct_declarations.s2.u2.u1s1.e.$i $i 0 char]
398 }
399 mi_list_varobj_children struct_declarations.s2.u2.u1s1.e $t \
400 "get children of struct_declarations.s2.u2.u1s1.e"
401
402 # Test: c_variable-4.70
403 # Desc: number of children of struct_declarations.s2.u2.u1s1.e
404 mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.e" \
405 "\\^done,numchild=\"10\"" \
406 "get number of children of struct_declarations.s2.u2.u1s1.e"
407
408
409 # Test: c_variable-4.71
410 # Desc: children of struct_declarations.s2.u2.u1s1.func
411 mi_list_varobj_children struct_declarations.s2.u2.u1s1.func {} \
412 "get children of struct_declarations.s2.u2.u1s1.func"
413
414 # Test: c_variable-4.72
415 # Desc: number of children of struct_declarations.s2.u2.u1s1.func
416 mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.func" \
417 "\\^done,numchild=\"0\"" \
418 "get number of children of struct_declarations.s2.u2.u1s1.func"
419
420
421 # Test: c_variable-4.73
422 # Desc: children of struct_declarations.s2.u2.u1s1.foo
423 mi_list_varobj_children struct_declarations.s2.u2.u1s1.foo {} \
424 "get children of struct_declarations.s2.u2.u1s1.foo"
425
426 # Test: c_variable-4.74
427 # Desc: number of children of struct_declarations.s2.u2.u1s1.foo
428 mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.foo" \
429 "\\^done,numchild=\"0\"" \
430 "get number of children of struct_declarations.s2.u2.u1s1.foo"
431
432
433 # Test: c_variable-4.75
434 # Desc: children of struct_declarations.s2.u2.u1s2.array_ptr
435 mi_list_varobj_children struct_declarations.s2.u2.u1s2.array_ptr {
436 {struct_declarations.s2.u2.u1s2.array_ptr.0 0 0 char}
437 {struct_declarations.s2.u2.u1s2.array_ptr.1 1 0 char}
438 } "get children of struct_declarations.s2.u2.u1s2.array_ptr"
439
440 # Test: c_variable-4.76
441 # Desc: number of children of struct_declarations.s2.u2.u1s2.array_ptr
442 mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.array_ptr" \
443 "\\^done,numchild=\"2\"" \
444 "get number of children of struct_declarations.s2.u2.u1s2.array_ptr"
445
446 # Test: c_variable-4.77
447 # Desc: children of struct_declarations.s2.u2.u1s2.func
448 mi_list_varobj_children struct_declarations.s2.u2.u1s2.func {} \
449 "get children of struct_declarations.s2.u2.u1s2.func"
450
451 # Test: c_variable-4.78
452 # Desc: number of children of struct_declarations.s2.u2.u1s2.func
453 mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.func" \
454 "\\^done,numchild=\"0\"" \
455 "get number of children of struct_declarations.s2.u2.u1s2.func"
456
457 # Test: c_variable-4.79
458 # Desc: children of struct_declarations.int_ptr_ptr.*int_ptr_ptr
459 mi_list_varobj_children "struct_declarations.int_ptr_ptr.*int_ptr_ptr" {
460 {{struct_declarations.int_ptr_ptr.\*int_ptr_ptr.\*\*int_ptr_ptr} \
461 {\*\*int_ptr_ptr} 0 int}
462 } "get children of struct_declarations.int_ptr_ptr.*int_ptr_ptr"
463
464 # Test: c_variable-4.80
465 # Desc: Number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr
466 mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr.*int_ptr_ptr" \
467 "\\^done,numchild=\"1\"" \
468 "get number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr"
469
470
471 # Step to "struct_declarations.integer = 123;"
472 set line_dct_123 [gdb_get_line_number "struct_declarations.integer = 123;"]
473 mi_step_to do_children_tests {} {.*var-cmd.c} \
474 $line_dct_123 "step to line \$line_dct_123"
475
476 # Test: c_variable-4.81
477 # Desc: create local variable "weird"
478 mi_create_varobj weird weird "create local variable weird"
479
480 # Test: c_variable-4.82
481 # Desc: children of weird
482 mi_list_varobj_children "weird" {
483 {weird.integer integer 0 int}
484 {weird.character character 0 char}
485 {weird.char_ptr char_ptr 1 "char \\*"}
486 {weird.long_int long_int 0 "long int"}
487 {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
488 {weird.long_array long_array 10 "long int \\[10\\]"}
489 {weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
490 {weird.func_ptr_struct func_ptr_struct 0 \
491 "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"}
492 {weird.func_ptr_ptr func_ptr_ptr 0 \
493 "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"}
494 {weird.u1 u1 4 "union \\{\\.\\.\\.\\}"}
495 {weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
496 } "get children of weird"
497
498 # Test: c_variable-4.83
499 # Desc: number of children of weird
500 mi_gdb_test "-var-info-num-children weird" \
501 "\\^done,numchild=\"11\"" \
502 "get number of children of weird"
503
504
505 # Test: c_variable-4.84
506 # Desc: children of weird->long_array
507 mi_list_array_varobj_children weird.long_array 10 "long int" \
508 "get children of weird.long_array"
509 #gdbtk_test c_variable-4.84 {children of weird->long_array} {
510 # get_children weird.long_array
511 #} {0 1 2 3 4 5 6 7 8 9}
512
513 # Test: c_variable-4.85
514 # Desc: number of children of weird.long_array
515 mi_gdb_test "-var-info-num-children weird.long_array" \
516 "\\^done,numchild=\"10\"" \
517 "get number of children of weird.long_array"
518
519 # Test: c_variable-4.86
520 # Desc: children of weird.int_ptr_ptr
521 mi_list_varobj_children weird.int_ptr_ptr {
522 {{weird.int_ptr_ptr.\*int_ptr_ptr} {\*int_ptr_ptr} 1 {int \*}}
523 } "get children of weird.int_ptr_ptr"
524 #gdbtk_test c_variable-4.86 {children of weird->int_ptr_ptr} {
525 # get_children weird.int_ptr_ptr
526 #} {*int_ptr_ptr}
527
528 # Test: c_variable-4.87
529 # Desc: number of children of weird.int_ptr_ptr
530 mi_gdb_test "-var-info-num-children weird.int_ptr_ptr" \
531 "\\^done,numchild=\"1\"" \
532 "get number of children of weird.int_ptr_ptr"
533
534 # Test: c_variable-4.88
535 # Desc: children of *weird->int_ptr_ptr
536 mi_list_varobj_children "weird.int_ptr_ptr.*int_ptr_ptr" {
537 {{weird.int_ptr_ptr.\*int_ptr_ptr.\*\*int_ptr_ptr} {\*\*int_ptr_ptr} 0 "int"}
538 } "get children of weird.int_ptr_ptr.*int_ptr_ptr"
539 #gdbtk_test c_variable-4.88 {children of *weird->int_ptr_ptr} {
540 # get_children weird.int_ptr_ptr.*int_ptr_ptr
541 #} {**int_ptr_ptr}
542
543 # Test: c_variable-4.89
544 # Desc: number of children *weird->int_ptr_ptr
545 mi_gdb_test "-var-info-num-children weird.int_ptr_ptr.*int_ptr_ptr" \
546 "\\^done,numchild=\"1\"" \
547 "get number of children of weird.int_ptr_ptr.*int_ptr_ptr"
548
549 # Test: c_variable-4.90
550 # Desc: create weird->int_ptr_ptr
551 mi_create_varobj "weird->int_ptr_ptr" "weird->int_ptr_ptr" \
552 "create local variable weird->int_ptr_ptr"
553
554 # Test: c_variable-4.91
555 # Desc: children of weird->int_ptr_ptr
556 mi_list_varobj_children "weird->int_ptr_ptr" {
557 {{weird->int_ptr_ptr.\*weird->int_ptr_ptr} {\*weird->int_ptr_ptr} 1 {int \*}}
558 } "get children of weird->int_ptr_ptr"
559
560 # Test: c_variable-4.92
561 # Desc: number of children of (weird->int_ptr_ptr)
562 mi_gdb_test "-var-info-num-children weird->int_ptr_ptr" \
563 "\\^done,numchild=\"1\"" \
564 "get number of children of weird->int_ptr_ptr"
565
566 # Test: c_variable-4.93
567 # Desc: children of *(weird->int_ptr_ptr)
568 mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr" {
569 {{weird->int_ptr_ptr.\*weird->int_ptr_ptr.\*\*weird->int_ptr_ptr} \
570 {\*\*weird->int_ptr_ptr} 0 int}
571 } "get children of weird->int_ptr_ptr.*weird->int_ptr_ptr"
572
573 # Test: c_variable-4.94
574 # Desc: number of children of *(weird->int_ptr_ptr)
575 mi_gdb_test "-var-info-num-children weird->int_ptr_ptr.*weird->int_ptr_ptr" \
576 "\\^done,numchild=\"1\"" \
577 "get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr"
578
579 # Test: c_variable-4.95
580 # Desc: children of *(*(weird->int_ptr_ptr))
581 mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" {} \
582 "get children of weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr"
583
584 # Test: c_variable-4.96
585 # Desc: number of children of *(*(weird->int_ptr_ptr))
586 mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" {} \
587 "get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr"
588
589 # Test: c_variable-4.97
590 # Desc: is weird editable
591 mi_gdb_test "-var-show-attributes weird" \
592 "\\^done,attr=\"editable\"" \
593 "is weird editable"
594
595 # Test: c_variable-4.98
596 # Desc: is weird->int_ptr_ptr editable
597 mi_gdb_test "-var-show-attributes weird->int_ptr_ptr" \
598 "\\^done,attr=\"editable\"" \
599 "is weird->int_ptr_ptr editable"
600
601 # Test: c_variable-4.99
602 # Desc: is *(weird->int_ptr_ptr) editable
603 mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr" \
604 "\\^done,attr=\"editable\"" \
605 "is weird.int_ptr_ptr.*int_ptr_ptr editable"
606
607 # Test: c_variable-4.100
608 # Desc: is *(*(weird->int_ptr_ptr)) editable
609 mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr" \
610 "\\^done,attr=\"editable\"" \
611 "is weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr editable"
612
613 # Test: c_variable-4.101
614 # Desc: is weird->u1 editable
615 mi_gdb_test "-var-show-attributes weird.u1" \
616 "\\^done,attr=\"noneditable\"" \
617 "is weird.u1 editable"
618
619 # Test: c_variable-4.102
620 # Desc: is weird->s2 editable
621 mi_gdb_test "-var-show-attributes weird.s2" \
622 "\\^done,attr=\"noneditable\"" \
623 "is weird.s2 editable"
624
625 # Test: c_variable-4.103
626 # Desc: is struct_declarations.u1.a editable
627 mi_gdb_test "-var-show-attributes struct_declarations.u1.a" \
628 "\\^done,attr=\"editable\"" \
629 "is struct_declarations.u1.a editable"
630
631 # Test: c_variable-4.104
632 # Desc: is struct_declarations.u1.b editable
633 mi_gdb_test "-var-show-attributes struct_declarations.u1.b" \
634 "\\^done,attr=\"editable\"" \
635 "is struct_declarations.u1.b editable"
636
637 # Test: c_variable-4.105
638 # Desc: is struct_declarations.u1.c editable
639 mi_gdb_test "-var-show-attributes struct_declarations.u1.c" \
640 "\\^done,attr=\"editable\"" \
641 "is struct_declarations.u1.c editable"
642
643 # Test: c_variable-4.106
644 # Desc: is struct_declarations.long_array editable
645 mi_gdb_test "-var-show-attributes struct_declarations.long_array" \
646 "\\^done,attr=\"noneditable\"" \
647 "is struct_declarations.long_array editable"
648
649 # Test: c_variable-4.107
650 # Desc: is struct_declarations.long_array[0] editable
651 mi_gdb_test "-var-show-attributes struct_declarations.long_array.0" \
652 "\\^done,attr=\"editable\"" \
653 "is struct_declarations.long_array.0 editable"
654
655 # Test: c_variable-4.108
656 # Desc: is struct_declarations editable
657 mi_gdb_test "-var-show-attributes struct_declarations" \
658 "\\^done,attr=\"noneditable\"" \
659 "is struct_declarations editable"
660
661 mi_gdb_test "-var-delete weird" \
662 "\\^done,ndeleted=\"24\"" \
663 "delete var weird"
664
665 ##### #####
666 # #
667 # children and update tests #
668 # #
669 ##### #####
670
671 # Test: c_variable-5.1
672 # Desc: check that nothing changed
673 mi_gdb_test "-var-update *" \
674 "\\^done,changelist=\\\[\\\]" \
675 "update all vars. None changed"
676
677 # Step over "struct_declarations.integer = 123;"
678 mi_step_to do_children_tests {} {.*var-cmd.c} \
679 [expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
680
681 # Test: c_variable-5.2
682 # Desc: check that integer changed
683 mi_gdb_test "-var-update *" \
684 "\\^done,changelist=\\\[\{name=\"struct_declarations.integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
685 "update all vars struct_declarations.integer"
686
687 # Step over:
688 # weird->char_ptr = "hello";
689 # bar = 2121;
690 # foo = &bar;
691 mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
692 [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4"
693
694 # Test: c_variable-5.3
695 # Desc: check that char_ptr changed
696 mi_gdb_test "-var-update *" \
697 "\\^done,changelist=\\\[\{name=\"struct_declarations.char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
698 "update all vars struct_declarations.char_ptr"
699
700 # Step over "struct_declarations.int_ptr_ptr = &foo;"
701 mi_step_to do_children_tests {} {.*var-cmd.c} \
702 [expr $line_dct_123 + 5] "step \$line_dct_123 + 5"
703
704 # Test: c_variable-5.4
705 # Desc: check that int_ptr_ptr and children changed
706 mi_gdb_test "-var-update *" \
707 "\\^done,changelist=\\\[\{name=\"weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr.\\*\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
708 "update all vars int_ptr_ptr and children changed"
709
710 # Step over "weird->long_array[0] = 1234;"
711 mi_step_to do_children_tests {} {.*var-cmd.c} \
712 [expr $line_dct_123 + 6] "step \$line_dct_123 + 6"
713
714 # Test: c_variable-5.5
715 # Desc: check that long_array[0] changed
716 mi_gdb_test "-var-update *" \
717 "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.0\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
718 "update all vars struct_declarations.long_array.0 changed"
719
720 # Step over "struct_declarations.long_array[1] = 2345;"
721 mi_step_to do_children_tests {} {.*var-cmd.c} \
722 [expr $line_dct_123 + 7] "step \$line_dct_123 + 7"
723
724 # Test: c_variable-5.6
725 # Desc: check that long_array[1] changed
726 mi_gdb_test "-var-update *" \
727 "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.1\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
728 "update all vars struct_declarations.long_array.1 changed"
729
730 # Step over "weird->long_array[2] = 3456;"
731 mi_step_to do_children_tests {} {.*var-cmd.c} \
732 [expr $line_dct_123 + 8] "step \$line_dct_123 + 8"
733
734 # Test: c_variable-5.7
735 # Desc: check that long_array[2] changed
736 mi_gdb_test "-var-update *" \
737 "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
738 "update all vars struct_declarations.long_array.2 changed"
739
740 # Step over:
741 # struct_declarations.long_array[3] = 4567;
742 # weird->long_array[4] = 5678;
743 # struct_declarations.long_array[5] = 6789;
744 # weird->long_array[6] = 7890;
745 # struct_declarations.long_array[7] = 8901;
746 # weird->long_array[8] = 9012;
747 # struct_declarations.long_array[9] = 1234;
748
749 set line_dct_nothing [gdb_get_line_number "weird->func_ptr = nothing;"]
750 mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
751 $line_dct_nothing {} "step \$line_dct_nothing"
752
753 # Test: c_variable-5.8
754 # Desc: check that long_array[3-9] changed
755 mi_gdb_test "-var-update *" \
756 "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.4\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.5\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.6\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.7\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.8\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.9\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
757 "update all vars struct_declarations.long_array.3-9 changed"
758
759
760 # Step over "weird->func_ptr = nothing;"
761 set line_dct_a0_0 [gdb_get_line_number "a0\[0\] = '0';"]
762 mi_step_to do_children_tests {} {.*var-cmd.c} \
763 $line_dct_a0_0 "step \$line_dct_a0_0"
764
765 # Test: c_variable-5.9
766 # Desc: check that func_ptr changed
767 mi_gdb_test "-var-update *" \
768 "\\^done,changelist=\\\[\{name=\"struct_declarations.func_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
769 "update all vars struct_declarations.func_ptr changed"
770
771 # Delete all variables
772 mi_gdb_test "-var-delete struct_declarations" \
773 "\\^done,ndeleted=\"65\"" \
774 "delete var struct_declarations"
775
776 mi_gdb_test "-var-delete weird->int_ptr_ptr" \
777 "\\^done,ndeleted=\"3\"" \
778 "delete var weird->int_ptr_ptr"
779
780 # Step over all lines:
781 # ...
782 # psnp = &snp0;
783
784 set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
785 mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
786 [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
787
788 # Test: c_variable-5.10
789 # Desc: create psnp->char_ptr
790 mi_create_varobj "psnp->char_ptr" "psnp->char_ptr" \
791 "create local variable psnp->char_ptr"
792
793 # Test: c_variable-5.11
794 # Desc: children of psnp->char_ptr
795 mi_list_varobj_children "psnp->char_ptr" {
796 {{psnp->char_ptr.\*psnp->char_ptr} {\*psnp->char_ptr} 1 {char \*\*\*}}
797 } "get children of psnp->char_ptr"
798
799 # Test: c_variable-5.12
800 # Desc: number of children of psnp->char_ptr
801 mi_gdb_test "-var-info-num-children psnp->char_ptr" \
802 "\\^done,numchild=\"1\"" \
803 "get number of children of psnp->char_ptr"
804
805 # Test: c_variable-5.13
806 # Desc: children of *(psnp->char_ptr)
807 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr" {
808 {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr} \
809 {\*\*psnp->char_ptr} 1 {char \*\*}}
810 } "get children of psnp->char_ptr.*psnp->char_ptr"
811
812 # Test: c_variable-5.14
813 # Desc: number of children of *(psnp->char_ptr)
814 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr" \
815 "\\^done,numchild=\"1\"" \
816 "get number of children of psnp->char_ptr.*psnp->char_ptr"
817
818 # Test: c_variable-5.15
819 # Desc: children of *(*(psnp->char_ptr))
820 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" {
821 {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr} \
822 {\*\*\*psnp->char_ptr} 1 {char \*}}
823 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
824
825 # Test: c_variable-5.15B
826 # Desc: children of *(*(*(psnp->char_ptr)))
827 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" {
828 {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr.\*\*\*\*psnp->char_ptr} \
829 {\*\*\*\*psnp->char_ptr} 0 char}
830 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
831
832 # Test: c_variable-5.16
833 # Desc: number of children of *(*(psnp->char_ptr))
834 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \
835 "\\^done,numchild=\"1\"" \
836 "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
837
838 # Test: c_variable-5.17
839 # Desc: children of *(*(*(psnp->char_ptr)))
840 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" {
841 {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr.\*\*\*\*psnp->char_ptr} \
842 {\*\*\*\*psnp->char_ptr} 0 char}
843 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
844
845 # Test: c_variable-5.18
846 # Desc: number of children of *(*(*(psnp->char_ptr)))
847 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \
848 "\\^done,numchild=\"1\"" \
849 "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
850
851 # Test: c_variable-5.17B
852 # Desc: children of *(*(*(*(psnp->char_ptr))))
853 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" {} \
854 "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr"
855
856 # Test: c_variable-5.18B
857 # Desc: number of children of *(*(*(*(psnp->char_ptr))))
858 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \
859 "\\^done,numchild=\"0\"" \
860 "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr"
861
862 # Test: c_variable-5.19
863 # Desc: create psnp->long_ptr
864 mi_create_varobj "psnp->long_ptr" "psnp->long_ptr" \
865 "create local variable psnp->long_ptr"
866
867 # Test: c_variable-5.20
868 # Desc: children of psnp->long_ptr
869 mi_list_varobj_children "psnp->long_ptr" {
870 {{psnp->long_ptr.\*psnp->long_ptr} {\*psnp->long_ptr} 1 {long int \*\*\*}}
871 } "get children of psnp->long_ptr"
872
873 # Test: c_variable-5.21
874 # Desc: number of children of psnp->long_ptr
875 mi_gdb_test "-var-info-num-children psnp->long_ptr" \
876 "\\^done,numchild=\"1\"" \
877 "get number of children of psnp->long_ptr"
878
879 # Test: c_variable-5.22
880 # Desc: children of *(psnp->long_ptr)
881 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr" {
882 {{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr} {\*\*psnp->long_ptr} 1 {long int \*\*}}
883 } "get children of psnp->long_ptr.*psnp->long_ptr"
884
885
886 # Test: c_variable-5.23
887 # Desc: number of children of *(psnp->long_ptr)
888 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr" \
889 "\\^done,numchild=\"1\"" \
890 "get number of children of psnp->long_ptr.*psnp->long_ptr"
891
892 # Test: c_variable-5.24
893 # Desc: children of *(*(psnp->long_ptr))
894 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" {
895 {{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr.\*\*\*psnp->long_ptr} \
896 {\*\*\*psnp->long_ptr} 1 {long int \*}}
897 } "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr"
898
899 # Test: c_variable-5.25
900 # Desc: number of children of *(*(psnp->long_ptr))
901 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \
902 "\\^done,numchild=\"1\"" \
903 "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr"
904
905 # Test: c_variable-5.26
906 # Desc: children of *(*(*(psnp->long_ptr)))
907 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" {
908 {{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr.\*\*\*psnp->long_ptr.\*\*\*\*psnp->long_ptr}
909 {\*\*\*\*psnp->long_ptr} 0 {long int}}
910 } "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr"
911
912 # Test: c_variable-5.27
913 # Desc: number of children of *(*(*(psnp->long_ptr)))
914 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \
915 "\\^done,numchild=\"1\"" \
916 "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr"
917
918 # Test: c_variable-5.28
919 # Desc: children of *(*(*(*(psnp->long_ptr))))
920 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" {} \
921 "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr"
922
923 # Test: c_variable-5.29
924 # Desc: number of children of *(*(*(*(psnp->long_ptr))))
925 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \
926 "\\^done,numchild=\"0\"" \
927 "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr"
928
929
930 # Test: c_variable-5.30
931 # Desc: create psnp->ptrs
932 mi_create_varobj "psnp->ptrs" "psnp->ptrs" \
933 "create local variable psnp->ptrs"
934
935 # Test: c_variable-5.31
936 # Desc: children of psnp->ptrs
937 mi_list_varobj_children "psnp->ptrs" {
938 {psnp->ptrs.0 0 4 {struct _struct_n_pointer \*}}
939 {psnp->ptrs.1 1 4 {struct _struct_n_pointer \*}}
940 {psnp->ptrs.2 2 4 {struct _struct_n_pointer \*}}
941 } "get children of psnp->ptrs"
942
943 # Test: c_variable-5.32
944 # Desc: number of children of psnp->ptrs
945 mi_gdb_test "-var-info-num-children psnp->ptrs" \
946 "\\^done,numchild=\"3\"" \
947 "get number of children of psnp->ptrs"
948
949 # Test: c_variable-5.33
950 # Desc: children of psnp->ptrs[0]
951 mi_list_varobj_children "psnp->ptrs.0" {
952 {psnp->ptrs.0.char_ptr char_ptr 1 {char \*\*\*\*}}
953 {psnp->ptrs.0.long_ptr long_ptr 1 {long int \*\*\*\*}}
954 {psnp->ptrs.0.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
955 {psnp->ptrs.0.next next 4 {struct _struct_n_pointer \*}}
956 } "get children of psnp->ptrs.0"
957
958 # Test: c_variable-5.34
959 # Desc: number of children of psnp->ptrs[0]
960 mi_gdb_test "-var-info-num-children psnp->ptrs.0" \
961 "\\^done,numchild=\"4\"" \
962 "get number of children of psnp->ptrs.0"
963
964 # Test: c_variable-5.35
965 # Desc: children of psnp->ptrs[0]->next
966 mi_list_varobj_children "psnp->ptrs.0.next" {
967 {psnp->ptrs.0.next.char_ptr char_ptr 1 {char \*\*\*\*}}
968 {psnp->ptrs.0.next.long_ptr long_ptr 1 {long int \*\*\*\*}}
969 {psnp->ptrs.0.next.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
970 {psnp->ptrs.0.next.next next 4 {struct _struct_n_pointer \*}}
971 } "get children of psnp->ptrs.0.next"
972
973 #} {char_ptr long_ptr ptrs next}
974
975 # Test: c_variable-5.36
976 # Desc: number of children of psnp->ptrs[0]->next
977 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next" \
978 "\\^done,numchild=\"4\"" \
979 "get number of children of psnp->ptrs.0.next"
980
981
982 # Test: c_variable-5.37
983 # Desc: children of psnp->ptrs[0]->next->char_ptr
984 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr" {
985 {{psnp->ptrs.0.next.char_ptr.\*char_ptr} {\*char_ptr} 1 {char \*\*\*}}
986 } "get children of psnp->ptrs.0.next.char_ptr"
987
988 #gdbtk_test c_variable-5.37 {children of psnp->ptrs[0]->next->char_ptr} {
989 # get_children psnp->ptrs.0.next.char_ptr
990 #} {*char_ptr}
991
992 # Test: c_variable-5.38
993 # Desc: number of children of psnp->ptrs[0]->next->char_ptr
994 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr" \
995 "\\^done,numchild=\"1\"" \
996 "get number of children of psnp->ptrs.0.next.char_ptr"
997
998 # Test: c_variable-5.39
999 # Desc: children of *psnp->ptrs[0]->next->char_ptr
1000 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr" {
1001 {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr} {\*\*char_ptr} 1 {char \*\*}}
1002 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr"
1003
1004 # Test: c_variable-5.40
1005 # Desc: number of children of *psnp->ptrs[0]->next->char_ptr
1006 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr" \
1007 "\\^done,numchild=\"1\"" \
1008 "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr"
1009
1010 # Test: c_variable-5.41
1011 # Desc: children of **psnp->ptrs[0]->next->char_ptr
1012 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" {
1013 {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr} \
1014 {\*\*\*char_ptr} 1 {char \*}}
1015 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
1016
1017 # Test: c_variable-5.41B
1018 # Desc: children of ***psnp->ptrs[0]->next->char_ptr
1019 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" {
1020 {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr.\*\*\*\*char_ptr} \
1021 {\*\*\*\*char_ptr} 0 char}
1022 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
1023
1024 # Test: c_variable-5.42
1025 # Desc: number of children of **psnp->ptrs[0]->next->char_ptr
1026 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \
1027 "\\^done,numchild=\"1\"" \
1028 "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
1029
1030 # Test: c_variable-5.43
1031 # Desc: children of ***psnp->ptrs[0]->next->char_ptr
1032 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" {
1033 {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr.\*\*\*\*char_ptr} \
1034 {\*\*\*\*char_ptr} 0 char}
1035 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1036
1037 # Test: c_variable-5.44
1038 # Desc: number of children of ***psnp->ptrs[0]->next->char_ptr
1039 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \
1040 "\\^done,numchild=\"1\"" \
1041 "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1042
1043 # Test: c_variable-5.43B
1044 # Desc: children of ****psnp->ptrs[0]->next->char_ptr
1045 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" {} \
1046 "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1047
1048 # Test: c_variable-5.44B
1049 # Desc: number of children of ****psnp->ptrs[0]->next->char_ptr
1050 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \
1051 "\\^done,numchild=\"0\"" \
1052 "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1053
1054 # Test: c_variable-5.45
1055 # Desc: children of psnp->ptrs[0]->next->next
1056 mi_list_varobj_children "psnp->ptrs.0.next.next" {
1057 {psnp->ptrs.0.next.next.char_ptr char_ptr 1 {char \*\*\*\*}}
1058 {psnp->ptrs.0.next.next.long_ptr long_ptr 1 {long int \*\*\*\*}}
1059 {psnp->ptrs.0.next.next.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
1060 {psnp->ptrs.0.next.next.next next 4 {struct _struct_n_pointer \*}}
1061 } "get children of psnp->ptrs.0.next.next"
1062
1063
1064 # Test: c_variable-5.46
1065 # Desc: children of psnp->ptrs[0]->next->next->ptrs
1066 mi_list_varobj_children "psnp->ptrs.0.next.next.ptrs" {
1067 {psnp->ptrs.0.next.next.ptrs.0 0 4 {struct _struct_n_pointer \*}}
1068 {psnp->ptrs.0.next.next.ptrs.1 1 4 {struct _struct_n_pointer \*}}
1069 {psnp->ptrs.0.next.next.ptrs.2 2 4 {struct _struct_n_pointer \*}}
1070 } "get children of psnp->ptrs.0.next.next.ptrs"
1071
1072 # Step over "snp0.char_ptr = &b3;"
1073 mi_step_to do_children_tests {} {.*var-cmd.c} \
1074 [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
1075
1076 # Test: c_variable-5.47
1077 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed
1078 mi_gdb_test "-var-update *" \
1079 "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
1080 "update all vars psnp->char_ptr (and 0.char_ptr) changed"
1081
1082 # Step over "snp1.char_ptr = &c3;"
1083 mi_step_to do_children_tests {} {.*var-cmd.c} \
1084 [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
1085
1086 # Test: c_variable-5.48
1087 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
1088 mi_gdb_test "-var-update *" \
1089 "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
1090 "update all vars psnp->next->char_ptr (and 1.char_ptr) changed"
1091
1092
1093 # Step over "snp2.char_ptr = &a3;"
1094 mi_step_to do_children_tests {} {.*var-cmd.c} \
1095 [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
1096
1097 # Test: c_variable-5.49
1098 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
1099 mi_gdb_test "-var-update *" \
1100 "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.next.char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
1101 "update all vars psnp->next->next->char_ptr (and 2.char_ptr) changed"
1102
1103
1104 # Step over "snp0.long_ptr = &y3;"
1105 mi_step_to do_children_tests {} {.*var-cmd.c} \
1106 [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
1107
1108 # Test: c_variable-5.50
1109 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed
1110 mi_gdb_test "-var-update *" \
1111 "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr.\\*\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
1112 "update all vars psnp->long_ptr (and 0.long_ptr) changed"
1113
1114
1115 # Step over "snp1.long_ptr = &x3;"
1116 mi_step_to do_children_tests {} {.*var-cmd.c} \
1117 [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
1118
1119 # Test: c_variable-5.51
1120 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed
1121 # Why does this have a FIXME?
1122 setup_xfail *-*-*
1123 mi_gdb_test "-var-update *" \
1124 "FIXME\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
1125 "update all vars psnp->next->long_ptr (and 1.long_ptr) changed"
1126 clear_xfail *-*-*
1127
1128 # This command produces this error message:
1129 # &"warning: varobj_list: assertion failed - mycount <> 0\n"
1130 #
1131
1132 # Step over "snp2.long_ptr = &z3;"
1133 mi_step_to do_children_tests {} {.*var-cmd.c} \
1134 [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
1135
1136 # Test: c_variable-5.52
1137 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
1138 mi_gdb_test "-var-update *" \
1139 "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.next.long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
1140 "update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed"
1141
1142
1143
1144
1145 mi_gdb_exit
1146 return 0
This page took 0.05626 seconds and 4 git commands to generate.