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