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