gas/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi2-var-child.exp
CommitLineData
469aff8e 1# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
2fcf52f0 2
e22f8b7c 3# This program is free software; you can redistribute it and/or modify
2fcf52f0 4# it under the terms of the GNU General Public License as published by
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
2fcf52f0
AC
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
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
2fcf52f0 15
2fcf52f0
AC
16# Test essential Machine interface (MI) operations
17#
18# Verify that, using the MI, we can create, update, delete variables.
19#
20
21
22load_lib mi-support.exp
23set MIFLAGS "-i=mi2"
24
25gdb_exit
26if [mi_gdb_start] {
27 continue
28}
29
30set testfile "var-cmd"
31set srcfile ${testfile}.c
3788363d 32set binfile ${objdir}/${subdir}/mi2-var-child
2fcf52f0 33if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
b60f0898
JB
34 untested mi2-var-child.exp
35 return -1
2fcf52f0
AC
36}
37
38mi_delete_breakpoints
39mi_gdb_reinitialize_dir $srcdir/$subdir
40mi_gdb_load ${binfile}
41
42mi_runto do_children_tests
43
a73bafbc
VP
44set line_dlt_first_real [gdb_get_line_number "weird = &struct_declarations;"]
45mi_continue_to_line $line_dlt_first_real "step to real start of do_children_test"
46
2fcf52f0
AC
47##### #####
48# #
49# children tests #
50# #
51##### #####
52
53
54# Test: c_variable-4.2
55# Desc: create variable "struct_declarations"
9e8e3afe 56mi_create_varobj "struct_declarations" "struct_declarations" \
3fddb3ad 57 "create local variable struct_declarations"
2fcf52f0
AC
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.
9e8e3afe
VP
63mi_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
2fcf52f0
AC
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
86mi_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
9e8e3afe
VP
92mi_list_varobj_children "struct_declarations.integer" {} \
93 "get children of struct_declarations.integer"
2fcf52f0
AC
94
95# Test: c_variable-4.6
96# Desc: number of children of struct_declarations.integer
97mi_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
9e8e3afe 103mi_list_varobj_children "struct_declarations.character" {} \
2fcf52f0
AC
104 "get children of struct_declarations.character"
105
106# Test: c_variable-4.8
107# Desc: number of children of struct_declarations.character
108mi_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
9e8e3afe
VP
114mi_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"
2fcf52f0
AC
117
118# Test: c_variable-4.10
119# Desc: number of children of struct_declarations.char_ptr
120mi_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
9e8e3afe 126mi_list_varobj_children "struct_declarations.long_int" {} \
2fcf52f0
AC
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
131mi_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
9e8e3afe
VP
137mi_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"
2fcf52f0
AC
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
147mi_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
9e8e3afe
VP
154mi_list_array_varobj_children "struct_declarations.long_array" 10 "long int" \
155 "get children of struct_declarations.long_array"
2fcf52f0
AC
156
157# Test: c_variable-4.16
158# Desc: number of children of struct_declarations.long_array
159mi_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
9e8e3afe 165mi_list_varobj_children "struct_declarations.func_ptr" {} \
2fcf52f0
AC
166 "get children of struct_declarations.func_ptr"
167
2fcf52f0
AC
168# Test: c_variable-4.18
169# Desc: number of children of struct_declarations.func_ptr
170mi_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
9e8e3afe 177mi_list_varobj_children "struct_declarations.func_ptr_struct" {} \
2fcf52f0
AC
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
182mi_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
9e8e3afe 189mi_list_varobj_children "struct_declarations.func_ptr_ptr" {} \
2fcf52f0
AC
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
194mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_ptr" \
9e8e3afe
VP
195 "\\^done,numchild=\"0\"" \
196 "get number of children of struct_declarations.func_ptr_ptr"
2fcf52f0
AC
197
198# Test: c_variable-4.23
199# Desc: children of struct_declarations.u1
9e8e3afe
VP
200mi_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"
2fcf52f0
AC
206
207# Test: c_variable-4.24
208# Desc: number of children of struct_declarations.u1
209mi_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
9e8e3afe
VP
215mi_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
2fcf52f0
AC
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
228mi_gdb_test "-var-info-num-children struct_declarations.s2" \
229 "\\^done,numchild=\"4\"" \
230 "get number of children of struct_declarations.s2"
231
232
9e8e3afe
VP
233for {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"
2fcf52f0 236
9e8e3afe 237 mi_gdb_test "-var-info-num-children struct_declarations.long_array.$i" \
2fcf52f0 238 "\\^done,numchild=\"0\"" \
9e8e3afe
VP
239 "get number of children of struct_declarations.long_array.$i"
240}
2fcf52f0
AC
241
242# Test: c_variable-4.45
243# Desc: children of struct_declarations.u1.a
9e8e3afe 244mi_list_varobj_children "struct_declarations.u1.a" {} \
2fcf52f0
AC
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
249mi_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
9e8e3afe
VP
255mi_list_varobj_children "struct_declarations.u1.b" {
256 {{struct_declarations.u1.b.\*b} {\*b} 0 char}
257} "get children of struct_declarations.u1.b"
2fcf52f0
AC
258
259# Test: c_variable-4.48
260# Desc: number of children of struct_declarations.u1.b
261mi_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
9e8e3afe 267mi_list_varobj_children "struct_declarations.u1.c" {} \
2fcf52f0
AC
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
272mi_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
9e8e3afe 278mi_list_varobj_children "struct_declarations.u1.d" {} \
2fcf52f0
AC
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
284mi_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
9e8e3afe
VP
291mi_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"
2fcf52f0
AC
296
297# Test: c_variable-4.54
298# Desc: number of children of struct_declarations.s2.u2
299mi_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
9e8e3afe 305mi_list_varobj_children struct_declarations.s2.g {} \
2fcf52f0
AC
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
310mi_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
9e8e3afe 317mi_list_varobj_children struct_declarations.s2.h {} \
2fcf52f0
AC
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
322mi_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
9e8e3afe
VP
329set t {}
330for {set i 0} {$i < 10} {incr i} {
331 lappend t [list struct_declarations.s2.i.$i $i 0 "long int"]
332}
333mi_list_varobj_children struct_declarations.s2.i $t \
2fcf52f0
AC
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
338mi_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
9e8e3afe
VP
344mi_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"
2fcf52f0
AC
350
351# Test: c_variable-4.62
352# Desc: number of children of struct_declarations.s2.u2.u1s1
353mi_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
9e8e3afe 359mi_list_varobj_children struct_declarations.s2.u2.f {} \
2fcf52f0
AC
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
364mi_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
9e8e3afe
VP
370mi_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"
2fcf52f0
AC
374
375# Test: c_variable-4.66
376# Desc: number of children of struct_declarations.s2.u2.u1s2
377mi_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
9e8e3afe 383mi_list_varobj_children struct_declarations.s2.u2.u1s1.d {} \
2fcf52f0
AC
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
388mi_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
9e8e3afe
VP
394set t {}
395for {set i 0} {$i < 10} {incr i} {
396 lappend t [list struct_declarations.s2.u2.u1s1.e.$i $i 0 char]
397}
398mi_list_varobj_children struct_declarations.s2.u2.u1s1.e $t \
2fcf52f0
AC
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
403mi_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
9e8e3afe 410mi_list_varobj_children struct_declarations.s2.u2.u1s1.func {} \
2fcf52f0
AC
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
415mi_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
9e8e3afe 422mi_list_varobj_children struct_declarations.s2.u2.u1s1.foo {} \
2fcf52f0
AC
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
427mi_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
9e8e3afe
VP
434mi_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"
2fcf52f0
AC
438
439# Test: c_variable-4.76
440# Desc: number of children of struct_declarations.s2.u2.u1s2.array_ptr
441mi_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
9e8e3afe 447mi_list_varobj_children struct_declarations.s2.u2.u1s2.func {} \
2fcf52f0
AC
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
452mi_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
9e8e3afe
VP
458mi_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"
2fcf52f0
AC
462
463# Test: c_variable-4.80
464# Desc: Number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr
465mi_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;"
469aff8e
MC
471set line_dct_123 [gdb_get_line_number "struct_declarations.integer = 123;"]
472mi_step_to do_children_tests {} {.*var-cmd.c} \
473 $line_dct_123 "step to line \$line_dct_123"
2fcf52f0
AC
474
475# Test: c_variable-4.81
476# Desc: create local variable "weird"
9e8e3afe 477mi_create_varobj weird weird "create local variable weird"
2fcf52f0
AC
478
479# Test: c_variable-4.82
480# Desc: children of weird
9e8e3afe
VP
481mi_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"
2fcf52f0
AC
496
497# Test: c_variable-4.83
498# Desc: number of children of weird
499mi_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
9e8e3afe 506mi_list_array_varobj_children weird.long_array 10 "long int" \
2fcf52f0
AC
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
514mi_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
9e8e3afe
VP
520mi_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"
2fcf52f0
AC
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
529mi_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
9e8e3afe
VP
535mi_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"
2fcf52f0
AC
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
544mi_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
9e8e3afe 550mi_create_varobj "weird->int_ptr_ptr" "weird->int_ptr_ptr" \
3fddb3ad 551 "create local variable weird->int_ptr_ptr"
2fcf52f0
AC
552
553# Test: c_variable-4.91
554# Desc: children of weird->int_ptr_ptr
9e8e3afe
VP
555mi_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"
2fcf52f0
AC
558
559# Test: c_variable-4.92
560# Desc: number of children of (weird->int_ptr_ptr)
561mi_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)
9e8e3afe
VP
567mi_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"
2fcf52f0
AC
571
572# Test: c_variable-4.94
573# Desc: number of children of *(weird->int_ptr_ptr)
574mi_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))
9e8e3afe 580mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" {} \
2fcf52f0
AC
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))
9e8e3afe 585mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" {} \
2fcf52f0
AC
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
590mi_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
596mi_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
602mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr" \
c7dd36a1 603 "\\^done,attr=\"editable\"" \
2fcf52f0
AC
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
608mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr" \
c7dd36a1 609 "\\^done,attr=\"editable\"" \
2fcf52f0
AC
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
614mi_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
620mi_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
626mi_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
632mi_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
638mi_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
644mi_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
650mi_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
656mi_gdb_test "-var-show-attributes struct_declarations" \
657 "\\^done,attr=\"noneditable\"" \
658 "is struct_declarations editable"
659
660mi_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
672mi_gdb_test "-var-update *" \
673 "\\^done,changelist=\\\[\\\]" \
674 "update all vars. None changed"
675
676# Step over "struct_declarations.integer = 123;"
469aff8e
MC
677mi_step_to do_children_tests {} {.*var-cmd.c} \
678 [expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
2fcf52f0
AC
679
680# Test: c_variable-5.2
681# Desc: check that integer changed
682mi_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;
469aff8e
MC
690mi_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"
2fcf52f0
AC
692
693# Test: c_variable-5.3
694# Desc: check that char_ptr changed
695mi_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;"
469aff8e
MC
700mi_step_to do_children_tests {} {.*var-cmd.c} \
701 [expr $line_dct_123 + 5] "step \$line_dct_123 + 5"
2fcf52f0
AC
702
703# Test: c_variable-5.4
704# Desc: check that int_ptr_ptr and children changed
705mi_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;"
469aff8e
MC
710mi_step_to do_children_tests {} {.*var-cmd.c} \
711 [expr $line_dct_123 + 6] "step \$line_dct_123 + 6"
2fcf52f0
AC
712
713# Test: c_variable-5.5
714# Desc: check that long_array[0] changed
715mi_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;"
469aff8e
MC
720mi_step_to do_children_tests {} {.*var-cmd.c} \
721 [expr $line_dct_123 + 7] "step \$line_dct_123 + 7"
2fcf52f0
AC
722
723# Test: c_variable-5.6
724# Desc: check that long_array[1] changed
725mi_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;"
469aff8e
MC
730mi_step_to do_children_tests {} {.*var-cmd.c} \
731 [expr $line_dct_123 + 8] "step \$line_dct_123 + 8"
2fcf52f0
AC
732
733# Test: c_variable-5.7
734# Desc: check that long_array[2] changed
735mi_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;
469aff8e
MC
747
748set line_dct_nothing [gdb_get_line_number "weird->func_ptr = nothing;"]
749mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
750 $line_dct_nothing {} "step \$line_dct_nothing"
2fcf52f0
AC
751
752# Test: c_variable-5.8
753# Desc: check that long_array[3-9] changed
754mi_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;"
a73bafbc 760set line_dct_a0_0 [gdb_get_line_number "a0\[0\] = '0';"]
469aff8e
MC
761mi_step_to do_children_tests {} {.*var-cmd.c} \
762 $line_dct_a0_0 "step \$line_dct_a0_0"
2fcf52f0
AC
763
764# Test: c_variable-5.9
765# Desc: check that func_ptr changed
766mi_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
771mi_gdb_test "-var-delete struct_declarations" \
772 "\\^done,ndeleted=\"65\"" \
773 "delete var struct_declarations"
774
775mi_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;
469aff8e
MC
782
783set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
784mi_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"
2fcf52f0
AC
786
787# Test: c_variable-5.10
788# Desc: create psnp->char_ptr
9e8e3afe 789mi_create_varobj "psnp->char_ptr" "psnp->char_ptr" \
3fddb3ad 790 "create local variable psnp->char_ptr"
2fcf52f0
AC
791
792# Test: c_variable-5.11
793# Desc: children of psnp->char_ptr
9e8e3afe
VP
794mi_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"
2fcf52f0
AC
797
798# Test: c_variable-5.12
799# Desc: number of children of psnp->char_ptr
800mi_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)
9e8e3afe
VP
806mi_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"
2fcf52f0
AC
810
811# Test: c_variable-5.14
812# Desc: number of children of *(psnp->char_ptr)
813mi_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))
9e8e3afe
VP
819mi_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"
2fcf52f0
AC
823
824# Test: c_variable-5.15B
825# Desc: children of *(*(*(psnp->char_ptr)))
9e8e3afe
VP
826mi_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"
2fcf52f0
AC
830
831# Test: c_variable-5.16
832# Desc: number of children of *(*(psnp->char_ptr))
833mi_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)))
9e8e3afe
VP
839mi_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"
2fcf52f0
AC
843
844# Test: c_variable-5.18
845# Desc: number of children of *(*(*(psnp->char_ptr)))
846mi_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))))
9e8e3afe 852mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" {} \
2fcf52f0
AC
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))))
857mi_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
2fcf52f0
AC
861# Test: c_variable-5.19
862# Desc: create psnp->long_ptr
9e8e3afe 863mi_create_varobj "psnp->long_ptr" "psnp->long_ptr" \
3fddb3ad 864 "create local variable psnp->long_ptr"
2fcf52f0
AC
865
866# Test: c_variable-5.20
867# Desc: children of psnp->long_ptr
9e8e3afe
VP
868mi_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"
2fcf52f0
AC
871
872# Test: c_variable-5.21
873# Desc: number of children of psnp->long_ptr
874mi_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)
9e8e3afe
VP
880mi_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"
2fcf52f0
AC
883
884
885# Test: c_variable-5.23
886# Desc: number of children of *(psnp->long_ptr)
887mi_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))
9e8e3afe
VP
893mi_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"
2fcf52f0
AC
897
898# Test: c_variable-5.25
899# Desc: number of children of *(*(psnp->long_ptr))
900mi_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)))
9e8e3afe
VP
906mi_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"
2fcf52f0
AC
910
911# Test: c_variable-5.27
912# Desc: number of children of *(*(*(psnp->long_ptr)))
913mi_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))))
9e8e3afe 919mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" {} \
2fcf52f0
AC
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))))
924mi_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
9e8e3afe 928
2fcf52f0
AC
929# Test: c_variable-5.30
930# Desc: create psnp->ptrs
9e8e3afe 931mi_create_varobj "psnp->ptrs" "psnp->ptrs" \
3fddb3ad 932 "create local variable psnp->ptrs"
2fcf52f0
AC
933
934# Test: c_variable-5.31
935# Desc: children of psnp->ptrs
9e8e3afe
VP
936mi_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"
2fcf52f0
AC
941
942# Test: c_variable-5.32
943# Desc: number of children of psnp->ptrs
944mi_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]
9e8e3afe
VP
950mi_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"
2fcf52f0
AC
956
957# Test: c_variable-5.34
958# Desc: number of children of psnp->ptrs[0]
959mi_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
9e8e3afe
VP
965mi_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"
2fcf52f0
AC
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
976mi_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
9e8e3afe
VP
983mi_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"
2fcf52f0
AC
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
993mi_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
9e8e3afe
VP
999mi_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"
2fcf52f0
AC
1002
1003# Test: c_variable-5.40
1004# Desc: number of children of *psnp->ptrs[0]->next->char_ptr
1005mi_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
9e8e3afe
VP
1011mi_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"
2fcf52f0
AC
1015
1016# Test: c_variable-5.41B
1017# Desc: children of ***psnp->ptrs[0]->next->char_ptr
9e8e3afe
VP
1018mi_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"
2fcf52f0
AC
1022
1023# Test: c_variable-5.42
1024# Desc: number of children of **psnp->ptrs[0]->next->char_ptr
1025mi_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
9e8e3afe
VP
1031mi_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"
2fcf52f0
AC
1035
1036# Test: c_variable-5.44
1037# Desc: number of children of ***psnp->ptrs[0]->next->char_ptr
1038mi_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
9e8e3afe 1044mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" {} \
2fcf52f0
AC
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
1049mi_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
9e8e3afe
VP
1055mi_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
2fcf52f0
AC
1062
1063# Test: c_variable-5.46
1064# Desc: children of psnp->ptrs[0]->next->next->ptrs
9e8e3afe
VP
1065mi_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"
2fcf52f0
AC
1070
1071# Step over "snp0.char_ptr = &b3;"
469aff8e
MC
1072mi_step_to do_children_tests {} {.*var-cmd.c} \
1073 [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
2fcf52f0
AC
1074
1075# Test: c_variable-5.47
1076# Desc: check that psnp->char_ptr (and [0].char_ptr) changed
1077mi_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;"
469aff8e
MC
1082mi_step_to do_children_tests {} {.*var-cmd.c} \
1083 [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
2fcf52f0
AC
1084
1085# Test: c_variable-5.48
1086# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
1087mi_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;"
469aff8e
MC
1093mi_step_to do_children_tests {} {.*var-cmd.c} \
1094 [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
2fcf52f0
AC
1095
1096# Test: c_variable-5.49
1097# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
1098mi_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;"
469aff8e
MC
1104mi_step_to do_children_tests {} {.*var-cmd.c} \
1105 [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
2fcf52f0
AC
1106
1107# Test: c_variable-5.50
1108# Desc: check that psnp->long_ptr (and [0].long_ptr) changed
1109mi_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;"
469aff8e
MC
1115mi_step_to do_children_tests {} {.*var-cmd.c} \
1116 [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
2fcf52f0
AC
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?
1121setup_xfail *-*-*
1122mi_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"
1125clear_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;"
469aff8e
MC
1132mi_step_to do_children_tests {} {.*var-cmd.c} \
1133 [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
2fcf52f0
AC
1134
1135# Test: c_variable-5.52
1136# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
1137mi_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
1144mi_gdb_exit
1145return 0
This page took 0.737148 seconds and 4 git commands to generate.