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