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