* gdb.mi/mi-async.exp, gdb.mi/mi-basics.exp,
[external/binutils.git] / gdb / testsuite / gdb.mi / mi2-var-child.exp
1 # Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16 # Test essential Machine interface (MI) operations
17 #
18 # Verify that, using the MI, we can create, update, delete variables.
19 #
20
21
22 load_lib mi-support.exp
23 set MIFLAGS "-i=mi2"
24
25 gdb_exit
26 if [mi_gdb_start] {
27     continue
28 }
29
30 set testfile "var-cmd"
31 set srcfile ${testfile}.c
32 set binfile ${objdir}/${subdir}/mi2-var-child
33 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
34     untested mi2-var-child.exp
35     return -1
36 }
37
38 mi_delete_breakpoints
39 mi_gdb_reinitialize_dir $srcdir/$subdir
40 mi_gdb_load ${binfile}
41
42 mi_runto do_children_tests
43
44 set line_dlt_first_real [gdb_get_line_number "weird = &struct_declarations;"]
45 mi_continue_to_line $line_dlt_first_real "step to real start of do_children_test"
46
47 #####        #####
48 #                #
49 # children tests #
50 #                #
51 #####        #####
52
53
54 # Test: c_variable-4.2
55 # Desc: create variable "struct_declarations"
56 mi_create_varobj "struct_declarations" "struct_declarations" \
57         "create local variable struct_declarations"
58
59 # Test: c_variable-4.3
60 # Desc: children of struct_declarations
61 # STABS doesn't give us argument types for the func ptr structs, but
62 # Dwarf 2 does.
63 mi_list_varobj_children "struct_declarations" {
64     {struct_declarations.integer integer 0 int}
65     {struct_declarations.character character 0 char}
66     {struct_declarations.char_ptr char_ptr 1 "char \\*"}
67     {struct_declarations.long_int long_int 0 "long int"}
68     {struct_declarations.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
69     {struct_declarations.long_array long_array 10 "long int \\[10\\]"}
70     {struct_declarations.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
71     {struct_declarations.func_ptr_struct func_ptr_struct 0 \
72          "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"}
73     {struct_declarations.func_ptr_ptr func_ptr_ptr 0 \
74         "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"}
75     {struct_declarations.u1 u1 4 "union \\{\\.\\.\\.\\}"}
76     {struct_declarations.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
77 } "get children of struct_declarations"
78
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" 10 "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=\"10\"" \
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 {} {.*var-cmd.c} \
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 10 "long int \\[10\\]"}
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 10 "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}
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=\"10\"" \
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=\"24\"" \
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 {} {.*var-cmd.c} \
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\"\}\\\]" \
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 {} {.*var-cmd.c} \
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\"\},\{name=\"struct_declarations.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
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 {} {.*var-cmd.c} \
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\"\},\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr.\\*\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
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 {} {.*var-cmd.c} \
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\"\}\\\]" \
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 {} {.*var-cmd.c} \
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\"\}\\\]" \
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 {} {.*var-cmd.c} \
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\"\}\\\]" \
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 {} {.*var-cmd.c} \
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\"\},\{name=\"struct_declarations.long_array.4\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.5\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.6\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.7\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.8\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.9\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
756         "update all vars struct_declarations.long_array.3-9 changed"
757
758
759 # Step over "weird->func_ptr = nothing;"
760 set line_dct_a0_0 [gdb_get_line_number "a0\[0\] = '0';"]
761 mi_step_to do_children_tests {} {.*var-cmd.c} \
762     $line_dct_a0_0 "step \$line_dct_a0_0"
763
764 # Test: c_variable-5.9
765 # Desc: check that func_ptr changed
766 mi_gdb_test "-var-update *" \
767         "\\^done,changelist=\\\[\{name=\"struct_declarations.func_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
768         "update all vars struct_declarations.func_ptr changed"
769
770 # Delete all variables
771 mi_gdb_test "-var-delete struct_declarations" \
772         "\\^done,ndeleted=\"65\"" \
773         "delete var struct_declarations"
774
775 mi_gdb_test "-var-delete weird->int_ptr_ptr" \
776         "\\^done,ndeleted=\"3\"" \
777         "delete var weird->int_ptr_ptr"
778
779 # Step over all lines:
780 # ...
781 #   psnp = &snp0;
782
783 set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
784 mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
785     [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
786
787 # Test: c_variable-5.10
788 # Desc: create psnp->char_ptr
789 mi_create_varobj "psnp->char_ptr" "psnp->char_ptr" \
790         "create local variable  psnp->char_ptr"
791
792 # Test: c_variable-5.11
793 # Desc: children of psnp->char_ptr
794 mi_list_varobj_children "psnp->char_ptr" {
795     {{psnp->char_ptr.\*psnp->char_ptr} {\*psnp->char_ptr} 1  {char \*\*\*}}
796 } "get children of psnp->char_ptr"
797
798 # Test: c_variable-5.12
799 # Desc: number of children of psnp->char_ptr
800 mi_gdb_test "-var-info-num-children psnp->char_ptr" \
801         "\\^done,numchild=\"1\"" \
802         "get number of children of psnp->char_ptr"
803
804 # Test: c_variable-5.13
805 # Desc: children of *(psnp->char_ptr)
806 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr" {
807     {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr} \
808          {\*\*psnp->char_ptr} 1 {char \*\*}}
809 } "get children of psnp->char_ptr.*psnp->char_ptr"
810
811 # Test: c_variable-5.14
812 # Desc: number of children of *(psnp->char_ptr)
813 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr" \
814         "\\^done,numchild=\"1\"" \
815         "get number of children of psnp->char_ptr.*psnp->char_ptr"
816
817 # Test: c_variable-5.15
818 # Desc: children of *(*(psnp->char_ptr))
819 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" {
820     {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr} \
821          {\*\*\*psnp->char_ptr} 1 {char \*}}
822 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
823
824 # Test: c_variable-5.15B
825 # Desc: children of *(*(*(psnp->char_ptr)))
826 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" {
827     {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr.\*\*\*\*psnp->char_ptr} \
828          {\*\*\*\*psnp->char_ptr} 0 char}
829 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
830
831 # Test: c_variable-5.16
832 # Desc: number of children of *(*(psnp->char_ptr))
833 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \
834         "\\^done,numchild=\"1\"" \
835         "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
836
837 # Test: c_variable-5.17
838 # Desc: children of *(*(*(psnp->char_ptr)))
839 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" {
840     {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr.\*\*\*\*psnp->char_ptr} \
841          {\*\*\*\*psnp->char_ptr} 0 char}
842 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
843
844 # Test: c_variable-5.18
845 # Desc: number of children of *(*(*(psnp->char_ptr)))
846 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \
847         "\\^done,numchild=\"1\"" \
848         "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
849
850 # Test: c_variable-5.17B
851 # Desc: children of *(*(*(*(psnp->char_ptr))))
852 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" {} \
853         "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr"
854
855 # Test: c_variable-5.18B
856 # Desc: number of children of *(*(*(*(psnp->char_ptr))))
857 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \
858         "\\^done,numchild=\"0\"" \
859         "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr"
860
861 # Test: c_variable-5.19
862 # Desc: create psnp->long_ptr
863 mi_create_varobj "psnp->long_ptr" "psnp->long_ptr" \
864         "create local variable  psnp->long_ptr"
865
866 # Test: c_variable-5.20
867 # Desc: children of psnp->long_ptr
868 mi_list_varobj_children "psnp->long_ptr" {
869     {{psnp->long_ptr.\*psnp->long_ptr} {\*psnp->long_ptr} 1 {long int \*\*\*}}
870 } "get children of psnp->long_ptr"
871
872 # Test: c_variable-5.21
873 # Desc: number of children of psnp->long_ptr
874 mi_gdb_test "-var-info-num-children psnp->long_ptr" \
875         "\\^done,numchild=\"1\"" \
876         "get number of children of psnp->long_ptr"
877
878 # Test: c_variable-5.22
879 # Desc: children of *(psnp->long_ptr)
880 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr" {
881     {{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr} {\*\*psnp->long_ptr} 1 {long int \*\*}}
882 } "get children of psnp->long_ptr.*psnp->long_ptr"
883
884
885 # Test: c_variable-5.23
886 # Desc: number of children of *(psnp->long_ptr)
887 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr" \
888         "\\^done,numchild=\"1\"" \
889         "get number of children of psnp->long_ptr.*psnp->long_ptr"
890
891 # Test: c_variable-5.24
892 # Desc: children of *(*(psnp->long_ptr))
893 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" {
894     {{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr.\*\*\*psnp->long_ptr} \
895          {\*\*\*psnp->long_ptr} 1 {long int \*}}
896 } "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr"
897
898 # Test: c_variable-5.25
899 # Desc: number of children of *(*(psnp->long_ptr))
900 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \
901         "\\^done,numchild=\"1\"" \
902         "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr"
903
904 # Test: c_variable-5.26
905 # Desc: children of *(*(*(psnp->long_ptr)))
906 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" {
907     {{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr.\*\*\*psnp->long_ptr.\*\*\*\*psnp->long_ptr}
908         {\*\*\*\*psnp->long_ptr} 0 {long int}}
909 } "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr"
910
911 # Test: c_variable-5.27
912 # Desc: number of children of *(*(*(psnp->long_ptr)))
913 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \
914         "\\^done,numchild=\"1\"" \
915         "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr"
916
917 # Test: c_variable-5.28
918 # Desc: children of *(*(*(*(psnp->long_ptr))))
919 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" {} \
920         "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr"
921
922 # Test: c_variable-5.29
923 # Desc: number of children of *(*(*(*(psnp->long_ptr))))
924 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \
925         "\\^done,numchild=\"0\"" \
926         "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr"
927
928
929 # Test: c_variable-5.30
930 # Desc: create psnp->ptrs
931 mi_create_varobj "psnp->ptrs" "psnp->ptrs" \
932         "create local variable  psnp->ptrs"
933
934 # Test: c_variable-5.31
935 # Desc: children of psnp->ptrs
936 mi_list_varobj_children "psnp->ptrs" {    
937     {psnp->ptrs.0 0 4 {struct _struct_n_pointer \*}}
938     {psnp->ptrs.1 1 4 {struct _struct_n_pointer \*}}
939     {psnp->ptrs.2 2 4 {struct _struct_n_pointer \*}}
940 } "get children of psnp->ptrs"
941
942 # Test: c_variable-5.32
943 # Desc: number of children of psnp->ptrs
944 mi_gdb_test "-var-info-num-children psnp->ptrs" \
945         "\\^done,numchild=\"3\"" \
946         "get number of children of psnp->ptrs"
947
948 # Test: c_variable-5.33
949 # Desc: children of psnp->ptrs[0]
950 mi_list_varobj_children "psnp->ptrs.0" {
951     {psnp->ptrs.0.char_ptr char_ptr 1 {char \*\*\*\*}}
952     {psnp->ptrs.0.long_ptr long_ptr 1 {long int \*\*\*\*}}
953     {psnp->ptrs.0.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
954     {psnp->ptrs.0.next next 4 {struct _struct_n_pointer \*}}
955 } "get children of psnp->ptrs.0"
956
957 # Test: c_variable-5.34
958 # Desc: number of children of psnp->ptrs[0]
959 mi_gdb_test "-var-info-num-children psnp->ptrs.0" \
960         "\\^done,numchild=\"4\"" \
961         "get number of children of psnp->ptrs.0"
962
963 # Test: c_variable-5.35
964 # Desc: children of psnp->ptrs[0]->next
965 mi_list_varobj_children "psnp->ptrs.0.next" {
966     {psnp->ptrs.0.next.char_ptr char_ptr 1 {char \*\*\*\*}}
967     {psnp->ptrs.0.next.long_ptr long_ptr 1 {long int \*\*\*\*}}
968     {psnp->ptrs.0.next.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
969     {psnp->ptrs.0.next.next next 4 {struct _struct_n_pointer \*}}
970 } "get children of psnp->ptrs.0.next"
971
972 #} {char_ptr long_ptr ptrs next}
973
974 # Test: c_variable-5.36
975 # Desc: number of children of psnp->ptrs[0]->next
976 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next" \
977         "\\^done,numchild=\"4\"" \
978         "get number of children of psnp->ptrs.0.next"
979
980
981 # Test: c_variable-5.37
982 # Desc: children of psnp->ptrs[0]->next->char_ptr
983 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr" {
984     {{psnp->ptrs.0.next.char_ptr.\*char_ptr} {\*char_ptr} 1 {char \*\*\*}}
985 } "get children of psnp->ptrs.0.next.char_ptr"
986
987 #gdbtk_test c_variable-5.37 {children of psnp->ptrs[0]->next->char_ptr} {
988 #  get_children psnp->ptrs.0.next.char_ptr
989 #} {*char_ptr}
990
991 # Test: c_variable-5.38
992 # Desc: number of children of psnp->ptrs[0]->next->char_ptr
993 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr" \
994         "\\^done,numchild=\"1\"" \
995         "get number of children of psnp->ptrs.0.next.char_ptr"
996
997 # Test: c_variable-5.39
998 # Desc: children of *psnp->ptrs[0]->next->char_ptr
999 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr" {
1000     {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr} {\*\*char_ptr} 1 {char \*\*}}
1001 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr"
1002
1003 # Test: c_variable-5.40
1004 # Desc: number of children of *psnp->ptrs[0]->next->char_ptr
1005 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr" \
1006         "\\^done,numchild=\"1\"" \
1007         "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr"
1008
1009 # Test: c_variable-5.41
1010 # Desc: children of **psnp->ptrs[0]->next->char_ptr
1011 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" {
1012     {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr} \
1013          {\*\*\*char_ptr} 1 {char \*}}
1014 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
1015
1016 # Test: c_variable-5.41B
1017 # Desc: children of ***psnp->ptrs[0]->next->char_ptr
1018 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" {
1019     {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr.\*\*\*\*char_ptr} \
1020          {\*\*\*\*char_ptr} 0 char}
1021 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
1022
1023 # Test: c_variable-5.42
1024 # Desc: number of children of **psnp->ptrs[0]->next->char_ptr
1025 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \
1026         "\\^done,numchild=\"1\"" \
1027         "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
1028
1029 # Test: c_variable-5.43
1030 # Desc: children of ***psnp->ptrs[0]->next->char_ptr
1031 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" {
1032     {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr.\*\*\*\*char_ptr} \
1033          {\*\*\*\*char_ptr} 0 char}
1034 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1035
1036 # Test: c_variable-5.44
1037 # Desc: number of children of ***psnp->ptrs[0]->next->char_ptr
1038 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \
1039         "\\^done,numchild=\"1\"" \
1040         "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1041
1042 # Test: c_variable-5.43B
1043 # Desc: children of ****psnp->ptrs[0]->next->char_ptr
1044 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" {} \
1045         "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1046
1047 # Test: c_variable-5.44B
1048 # Desc: number of children of ****psnp->ptrs[0]->next->char_ptr
1049 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \
1050         "\\^done,numchild=\"0\"" \
1051         "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1052
1053 # Test: c_variable-5.45
1054 # Desc: children of psnp->ptrs[0]->next->next
1055 mi_list_varobj_children "psnp->ptrs.0.next.next" {
1056     {psnp->ptrs.0.next.next.char_ptr char_ptr 1 {char \*\*\*\*}}
1057     {psnp->ptrs.0.next.next.long_ptr long_ptr 1 {long int \*\*\*\*}}
1058     {psnp->ptrs.0.next.next.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
1059     {psnp->ptrs.0.next.next.next next 4 {struct _struct_n_pointer \*}}
1060 } "get children of psnp->ptrs.0.next.next"
1061
1062
1063 # Test: c_variable-5.46
1064 # Desc: children of psnp->ptrs[0]->next->next->ptrs
1065 mi_list_varobj_children "psnp->ptrs.0.next.next.ptrs" {
1066     {psnp->ptrs.0.next.next.ptrs.0 0 4 {struct _struct_n_pointer \*}}
1067     {psnp->ptrs.0.next.next.ptrs.1 1 4 {struct _struct_n_pointer \*}}
1068     {psnp->ptrs.0.next.next.ptrs.2 2 4 {struct _struct_n_pointer \*}}
1069 } "get children of psnp->ptrs.0.next.next.ptrs"
1070
1071 #  Step over "snp0.char_ptr = &b3;"
1072 mi_step_to do_children_tests {} {.*var-cmd.c} \
1073     [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
1074
1075 # Test: c_variable-5.47
1076 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed
1077 mi_gdb_test "-var-update *" \
1078         "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.char_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
1079         "update all vars psnp->char_ptr (and 0.char_ptr) changed"
1080
1081 #  Step over "snp1.char_ptr = &c3;"
1082 mi_step_to do_children_tests {} {.*var-cmd.c} \
1083     [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
1084
1085 # Test: c_variable-5.48
1086 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
1087 mi_gdb_test "-var-update *" \
1088         "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.char_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
1089         "update all vars psnp->next->char_ptr (and 1.char_ptr) changed"
1090
1091
1092 #  Step over "snp2.char_ptr = &a3;"
1093 mi_step_to do_children_tests {} {.*var-cmd.c} \
1094     [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
1095
1096 # Test: c_variable-5.49
1097 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
1098 mi_gdb_test "-var-update *" \
1099         "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.next.char_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
1100         "update all vars psnp->next->next->char_ptr (and 2.char_ptr) changed"
1101
1102
1103 #  Step over "snp0.long_ptr = &y3;"
1104 mi_step_to do_children_tests {} {.*var-cmd.c} \
1105     [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
1106
1107 # Test: c_variable-5.50
1108 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed
1109 mi_gdb_test "-var-update *" \
1110         "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.long_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr.\\*\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
1111         "update all vars psnp->long_ptr (and 0.long_ptr) changed"
1112
1113
1114 #  Step over "snp1.long_ptr = &x3;"
1115 mi_step_to do_children_tests {} {.*var-cmd.c} \
1116     [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
1117
1118 # Test: c_variable-5.51
1119 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed
1120 # Why does this have a FIXME?
1121 setup_xfail *-*-*
1122 mi_gdb_test "-var-update *" \
1123         "FIXME\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.long_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
1124         "update all vars psnp->next->long_ptr (and 1.long_ptr) changed"
1125 clear_xfail *-*-*
1126
1127 # This command produces this error message:
1128 # &"warning: varobj_list: assertion failed - mycount <> 0\n"
1129 #
1130
1131 #  Step over "snp2.long_ptr = &z3;"
1132 mi_step_to do_children_tests {} {.*var-cmd.c} \
1133     [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
1134
1135 # Test: c_variable-5.52
1136 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
1137 mi_gdb_test "-var-update *" \
1138         "\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.next.long_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
1139         "update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed"
1140
1141
1142
1143
1144 mi_gdb_exit
1145 return 0