mi-var-child.exp revision 1.1.1.8 1 # Copyright 1999-2024 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=mi"
24
25 standard_testfile
26
27 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
28 untested "failed to compile"
29 return -1
30 }
31
32 if {[mi_clean_restart $binfile]} {
33 return
34 }
35
36 mi_runto do_children_tests
37
38 set line_dlt_first_real [gdb_get_line_number "weird = &struct_declarations;"]
39 mi_continue_to_line $line_dlt_first_real "step to real start of do_children_test"
40
41
42 ##### #####
43 # #
44 # children tests #
45 # #
46 ##### #####
47
48 # Test: c_variable-4.2
49 # Desc: create variable "struct_declarations"
50 mi_create_varobj "struct_declarations" "struct_declarations" \
51 "create local variable struct_declarations"
52
53 # Test: c_variable-4.3
54 # Desc: children of struct_declarations
55 # STABS doesn't give us argument types for the func ptr structs, but
56 # Dwarf 2 does.
57 mi_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 \\*"}
61 {struct_declarations.long_int long_int 0 "long"}
62 {struct_declarations.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
63 {struct_declarations.long_array long_array 12 "long \\[12\\]"}
64 {struct_declarations.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
65 {struct_declarations.func_ptr_struct func_ptr_struct 0 \
66 "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long\\))?"}
67 {struct_declarations.func_ptr_ptr func_ptr_ptr 0 \
68 "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long)?\\)"}
69 {struct_declarations.u1 u1 4 "union \\{\\.\\.\\.\\}"}
70 {struct_declarations.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
71 } "get children of struct_declarations"
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
79 mi_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
85 mi_list_varobj_children "struct_declarations.integer" {} \
86 "get children of struct_declarations.integer"
87
88 # Test: c_variable-4.6
89 # Desc: number of children of struct_declarations.integer
90 mi_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
96 mi_list_varobj_children "struct_declarations.character" {} \
97 "get children of struct_declarations.character"
98
99 # Test: c_variable-4.8
100 # Desc: number of children of struct_declarations.character
101 mi_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
107 mi_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"
110
111 # Test: c_variable-4.10
112 # Desc: number of children of struct_declarations.char_ptr
113 mi_gdb_test "-var-info-num-children struct_declarations.char_ptr" \
114 "\\^done,numchild=\"1\"" \
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
119 mi_list_varobj_children "struct_declarations.long_int" {} \
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
124 mi_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
130 mi_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"
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
140 mi_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
147 mi_list_array_varobj_children "struct_declarations.long_array" 12 \
148 "long" \
149 "get children of struct_declarations.long_array"
150
151 # Test: c_variable-4.16
152 # Desc: number of children of struct_declarations.long_array
153 mi_gdb_test "-var-info-num-children struct_declarations.long_array" \
154 "\\^done,numchild=\"12\"" \
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
159 mi_list_varobj_children "struct_declarations.func_ptr" {} \
160 "get children of struct_declarations.func_ptr"
161
162 # Test: c_variable-4.18
163 # Desc: number of children of struct_declarations.func_ptr
164 mi_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
171 mi_list_varobj_children "struct_declarations.func_ptr_struct" {} \
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
176 mi_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
183 mi_list_varobj_children "struct_declarations.func_ptr_ptr" {} \
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
188 mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_ptr" \
189 "\\^done,numchild=\"0\"" \
190 "get number of children of struct_declarations.func_ptr_ptr"
191
192 # Test: c_variable-4.23
193 # Desc: children of struct_declarations.u1
194 mi_list_varobj_children "struct_declarations.u1" {
195 {struct_declarations.u1.a a 0 int}
196 {struct_declarations.u1.b b 1 {char \*}}
197 {struct_declarations.u1.c c 0 {long}}
198 {struct_declarations.u1.d d 0 {enum foo}}
199 } "get children of struct_declarations.u1"
200
201 # Test: c_variable-4.24
202 # Desc: number of children of struct_declarations.u1
203 mi_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
209 mi_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}
213 {struct_declarations.s2.i i 10 {long \[10\]}}
214 } "get children of struct_declarations.s2"
215
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
222 mi_gdb_test "-var-info-num-children struct_declarations.s2" \
223 "\\^done,numchild=\"4\"" \
224 "get number of children of struct_declarations.s2"
225
226
227 for {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"
230
231 mi_gdb_test "-var-info-num-children struct_declarations.long_array.$i" \
232 "\\^done,numchild=\"0\"" \
233 "get number of children of struct_declarations.long_array.$i"
234 }
235
236 # Test: c_variable-4.45
237 # Desc: children of struct_declarations.u1.a
238 mi_list_varobj_children "struct_declarations.u1.a" {} \
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
243 mi_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
249 mi_list_varobj_children "struct_declarations.u1.b" {
250 {{struct_declarations.u1.b.\*b} {\*b} 0 char}
251 } "get children of struct_declarations.u1.b"
252
253 # Test: c_variable-4.48
254 # Desc: number of children of struct_declarations.u1.b
255 mi_gdb_test "-var-info-num-children struct_declarations.u1.b" \
256 "\\^done,numchild=\"1\"" \
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
261 mi_list_varobj_children "struct_declarations.u1.c" {} \
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
266 mi_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
272 mi_list_varobj_children "struct_declarations.u1.d" {} \
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
278 mi_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
285 mi_list_varobj_children "struct_declarations.s2.u2" {
286 {"struct_declarations.s2.u2.u1s1" "u1s1" 4 {struct \{\.\.\.\}}}
287 {struct_declarations.s2.u2.f f 0 "long"}
288 {struct_declarations.s2.u2.u1s2 u1s2 2 {struct \{\.\.\.\}}}
289 } "get children of struct_declarations.s2.u2"
290
291 # Test: c_variable-4.54
292 # Desc: number of children of struct_declarations.s2.u2
293 mi_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
299 mi_list_varobj_children struct_declarations.s2.g {} \
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
304 mi_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
311 mi_list_varobj_children struct_declarations.s2.h {} \
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
316 mi_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
323 set t {}
324 for {set i 0} {$i < 10} {incr i} {
325 lappend t [list struct_declarations.s2.i.$i $i 0 "long"]
326 }
327 mi_list_varobj_children struct_declarations.s2.i $t \
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
332 mi_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
338 mi_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"
344
345 # Test: c_variable-4.62
346 # Desc: number of children of struct_declarations.s2.u2.u1s1
347 mi_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
353 mi_list_varobj_children struct_declarations.s2.u2.f {} \
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
358 mi_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
364 mi_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"
368
369 # Test: c_variable-4.66
370 # Desc: number of children of struct_declarations.s2.u2.u1s2
371 mi_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
377 mi_list_varobj_children struct_declarations.s2.u2.u1s1.d {} \
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
382 mi_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
388 set t {}
389 for {set i 0} {$i < 10} {incr i} {
390 lappend t [list struct_declarations.s2.u2.u1s1.e.$i $i 0 char]
391 }
392 mi_list_varobj_children struct_declarations.s2.u2.u1s1.e $t \
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
397 mi_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
404 mi_list_varobj_children struct_declarations.s2.u2.u1s1.func {} \
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
409 mi_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
416 mi_list_varobj_children struct_declarations.s2.u2.u1s1.foo {} \
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
421 mi_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
428 mi_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"
432
433 # Test: c_variable-4.76
434 # Desc: number of children of struct_declarations.s2.u2.u1s2.array_ptr
435 mi_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
441 mi_list_varobj_children struct_declarations.s2.u2.u1s2.func {} \
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
446 mi_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
452 mi_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"
456
457 # Test: c_variable-4.80
458 # Desc: Number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr
459 mi_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;"
465 set line_dct_123 [gdb_get_line_number "struct_declarations.integer = 123;"]
466 mi_step_to do_children_tests {} ".*${srcfile}" \
467 $line_dct_123 "step to line \$line_dct_123"
468
469 # Test: c_variable-4.81
470 # Desc: create local variable "weird"
471 mi_create_varobj weird weird "create local variable weird"
472
473 # Test: c_variable-4.82
474 # Desc: children of weird
475 mi_list_varobj_children "weird" {
476 {weird.integer integer 0 int}
477 {weird.character character 0 char}
478 {weird.char_ptr char_ptr 1 "char \\*"}
479 {weird.long_int long_int 0 "long"}
480 {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
481 {weird.long_array long_array 12 "long \\[12\\]"}
482 {weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
483 {weird.func_ptr_struct func_ptr_struct 0 \
484 "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long\\))?"}
485 {weird.func_ptr_ptr func_ptr_ptr 0 \
486 "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long)?\\)"}
487 {weird.u1 u1 4 "union \\{\\.\\.\\.\\}"}
488 {weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
489 } "get children of weird"
490
491 # Test: c_variable-4.83
492 # Desc: number of children of weird
493 mi_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
500 mi_list_array_varobj_children weird.long_array 12 "long" \
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
504 #} {0 1 2 3 4 5 6 7 8 9 10 11}
505
506 # Test: c_variable-4.85
507 # Desc: number of children of weird.long_array
508 mi_gdb_test "-var-info-num-children weird.long_array" \
509 "\\^done,numchild=\"12\"" \
510 "get number of children of weird.long_array"
511
512 # Test: c_variable-4.86
513 # Desc: children of weird.int_ptr_ptr
514 mi_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"
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
523 mi_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
529 mi_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"
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
538 mi_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
544 mi_create_varobj "weird->int_ptr_ptr" "weird->int_ptr_ptr" \
545 "create local variable weird->int_ptr_ptr"
546
547 # Test: c_variable-4.91
548 # Desc: children of weird->int_ptr_ptr
549 mi_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"
552
553 # Test: c_variable-4.92
554 # Desc: number of children of (weird->int_ptr_ptr)
555 mi_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)
561 mi_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"
565
566 # Test: c_variable-4.94
567 # Desc: number of children of *(weird->int_ptr_ptr)
568 mi_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))
574 mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" {} \
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))
579 mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" {} \
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
584 mi_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
590 mi_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
596 mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr" \
597 "\\^done,attr=\"editable\"" \
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
602 mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr" \
603 "\\^done,attr=\"editable\"" \
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
608 mi_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
614 mi_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
620 mi_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
626 mi_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
632 mi_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
638 mi_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
644 mi_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
650 mi_gdb_test "-var-show-attributes struct_declarations" \
651 "\\^done,attr=\"noneditable\"" \
652 "is struct_declarations editable"
653
654 mi_gdb_test "-var-delete weird" \
655 "\\^done,ndeleted=\"26\"" \
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
666 mi_varobj_update * {} "update all vars. None changed"
667
668 # Step over "struct_declarations.integer = 123;"
669 mi_step_to do_children_tests {} ".*${srcfile}" \
670 [expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
671
672 # Test: c_variable-5.2
673 # Desc: check that integer changed
674 mi_varobj_update * {struct_declarations.integer} \
675 "update all vars struct_declarations.integer"
676
677 # Step over:
678 # weird->char_ptr = "hello";
679 # bar = 2121;
680 # foo = &bar;
681 mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
682 [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4"
683
684 # Test: c_variable-5.3
685 # Desc: check that char_ptr changed
686 mi_varobj_update * {struct_declarations.char_ptr struct_declarations.char_ptr.\\*char_ptr} \
687 "update all vars struct_declarations.char_ptr"
688
689 # Step over "struct_declarations.int_ptr_ptr = &foo;"
690 mi_step_to do_children_tests {} ".*${srcfile}" \
691 [expr $line_dct_123 + 5] "step \$line_dct_123 + 5"
692
693 # Test: c_variable-5.4
694 # Desc: check that int_ptr_ptr and children changed
695 mi_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} \
701 "update all vars int_ptr_ptr and children changed"
702
703 # Step over "weird->long_array[0] = 1234;"
704 mi_step_to do_children_tests {} ".*${srcfile}" \
705 [expr $line_dct_123 + 6] "step \$line_dct_123 + 6"
706
707 # Test: c_variable-5.5
708 # Desc: check that long_array[0] changed
709 mi_varobj_update * {struct_declarations.long_array.0} \
710 "update all vars struct_declarations.long_array.0 changed"
711
712 # Step over "struct_declarations.long_array[1] = 2345;"
713 mi_step_to do_children_tests {} ".*${srcfile}" \
714 [expr $line_dct_123 + 7] "step \$line_dct_123 + 7"
715
716 # Test: c_variable-5.6
717 # Desc: check that long_array[1] changed
718 mi_varobj_update * {struct_declarations.long_array.1} \
719 "update all vars struct_declarations.long_array.1 changed"
720
721 # Step over "weird->long_array[2] = 3456;"
722 mi_step_to do_children_tests {} ".*${srcfile}" \
723 [expr $line_dct_123 + 8] "step \$line_dct_123 + 8"
724
725 # Test: c_variable-5.7
726 # Desc: check that long_array[2] changed
727 mi_varobj_update * {struct_declarations.long_array.2} \
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;
738
739 set line_dct_nothing [gdb_get_line_number "weird->func_ptr = nothing;"]
740 mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
741 $line_dct_nothing {} "step \$line_dct_nothing"
742
743 # Test: c_variable-5.8
744 # Desc: check that long_array[3-9] changed
745 mi_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"
753
754
755 # Step over "weird->func_ptr = nothing";
756 mi_step_to do_children_tests {} ".*${srcfile}" \
757 [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1"
758
759 # Test: c_variable-5.9
760 # Desc: check that func_ptr changed
761 mi_varobj_update * {struct_declarations.func_ptr} \
762 "update all vars struct_declarations.func_ptr changed"
763
764 # Step over "weird->func_ptr_struct = nothing1"
765 mi_step_to do_children_tests {} ".*${srcfile}" \
766 [expr $line_dct_nothing + 2] "step \$line_dct_nothing + 2"
767 mi_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"
771 mi_step_to do_children_tests {} ".*${srcfile}" \
772 [expr $line_dct_nothing + 3] "step \$line_dct_nothing + 3"
773 mi_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";
777 mi_step_to do_children_tests {} ".*${srcfile}" \
778 [expr $line_dct_nothing + 4] "step \$line_dct_nothing + 4"
779
780 mi_gdb_test "-var-update --no-values *" \
781 "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.10\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
782 "update all vars struct_declarations.long_array.10 changed, don't print values."
783
784 # Step over "struct_declarations.long_array[11] = 5678";
785 set line_dct_a0_0 [gdb_get_line_number "a0\[0\] = '0';"]
786 mi_step_to do_children_tests {} ".*${srcfile}" \
787 $line_dct_a0_0 "step \$line_dct_a0_0"
788
789 mi_gdb_test "-var-update --all-values *" \
790 "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.11\",value=\"5678\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
791 "update all vars struct_declarations.long_array.11 changed, print values."
792
793 mi_list_varobj_children {struct_declarations.long_array --all-values} {
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}
806 } "listing of names and values of children"
807
808 mi_list_varobj_children {struct_declarations --simple-values} \
809 [list \
810 {struct_declarations.integer integer 0 int 123} \
811 {struct_declarations.character character 0 char {0 '\\\\000'}} \
812 [list struct_declarations.char_ptr char_ptr 1 "char \\*" "$hex \\\\\"hello\\\\\""] \
813 {struct_declarations.long_int long_int 0 "long" 0} \
814 [list struct_declarations.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*" "$hex"] \
815 {struct_declarations.long_array long_array 12 "long \\[12\\]"} \
816 [list struct_declarations.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)" "(@$hex: |)$hex <nothing>"] \
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>"] \
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"
824
825 # Delete all variables
826 mi_gdb_test "-var-delete struct_declarations" \
827 "\\^done,ndeleted=\"67\"" \
828 "delete var struct_declarations"
829
830 mi_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;
837
838 set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
839 mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
840 [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
841
842 # Test: c_variable-5.10
843 # Desc: create psnp->char_ptr
844 mi_create_varobj "psnp->char_ptr" "psnp->char_ptr" \
845 "create local variable psnp->char_ptr"
846
847 # Test: c_variable-5.11
848 # Desc: children of psnp->char_ptr
849 mi_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"
852
853 # Test: c_variable-5.12
854 # Desc: number of children of psnp->char_ptr
855 mi_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)
861 mi_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"
865
866 # Test: c_variable-5.14
867 # Desc: number of children of *(psnp->char_ptr)
868 mi_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))
874 mi_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"
878
879 # Test: c_variable-5.15B
880 # Desc: children of *(*(*(psnp->char_ptr)))
881 mi_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"
885
886 # Test: c_variable-5.16
887 # Desc: number of children of *(*(psnp->char_ptr))
888 mi_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)))
894 mi_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}
897 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr after counting children"
898
899 # Test: c_variable-5.18
900 # Desc: number of children of *(*(*(psnp->char_ptr)))
901 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \
902 "\\^done,numchild=\"1\"" \
903 "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
904
905 # Test: c_variable-5.17B
906 # Desc: children of *(*(*(*(psnp->char_ptr))))
907 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" {} \
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))))
912 mi_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
916 # Test: c_variable-5.19
917 # Desc: create psnp->long_ptr
918 mi_create_varobj "psnp->long_ptr" "psnp->long_ptr" \
919 "create local variable psnp->long_ptr"
920
921 # Test: c_variable-5.20
922 # Desc: children of psnp->long_ptr
923 mi_list_varobj_children "psnp->long_ptr" {
924 {{psnp->long_ptr.\*psnp->long_ptr} {\*psnp->long_ptr} 1 {long \*\*\*}}
925 } "get children of psnp->long_ptr"
926
927 # Test: c_variable-5.21
928 # Desc: number of children of psnp->long_ptr
929 mi_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)
935 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr" {
936 {{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr} {\*\*psnp->long_ptr} 1 {long \*\*}}
937 } "get children of psnp->long_ptr.*psnp->long_ptr"
938
939
940 # Test: c_variable-5.23
941 # Desc: number of children of *(psnp->long_ptr)
942 mi_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))
948 mi_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} \
950 {\*\*\*psnp->long_ptr} 1 {long \*}}
951 } "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr"
952
953 # Test: c_variable-5.25
954 # Desc: number of children of *(*(psnp->long_ptr))
955 mi_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)))
961 mi_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}
963 {\*\*\*\*psnp->long_ptr} 0 {long}}
964 } "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr"
965
966 # Test: c_variable-5.27
967 # Desc: number of children of *(*(*(psnp->long_ptr)))
968 mi_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))))
974 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" {} \
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))))
979 mi_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
985 mi_create_varobj "psnp->ptrs" "psnp->ptrs" \
986 "create local variable psnp->ptrs"
987
988 # Test: c_variable-5.31
989 # Desc: children of psnp->ptrs
990 mi_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"
995
996 # Test: c_variable-5.32
997 # Desc: number of children of psnp->ptrs
998 mi_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]
1004 mi_list_varobj_children "psnp->ptrs.0" {
1005 {psnp->ptrs.0.char_ptr char_ptr 1 {char \*\*\*\*}}
1006 {psnp->ptrs.0.long_ptr long_ptr 1 {long \*\*\*\*}}
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"
1010
1011 # Test: c_variable-5.34
1012 # Desc: number of children of psnp->ptrs[0]
1013 mi_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
1019 mi_list_varobj_children "psnp->ptrs.0.next" {
1020 {psnp->ptrs.0.next.char_ptr char_ptr 1 {char \*\*\*\*}}
1021 {psnp->ptrs.0.next.long_ptr long_ptr 1 {long \*\*\*\*}}
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"
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
1030 mi_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
1037 mi_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"
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
1047 mi_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
1053 mi_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"
1056
1057 # Test: c_variable-5.40
1058 # Desc: number of children of *psnp->ptrs[0]->next->char_ptr
1059 mi_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
1065 mi_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"
1069
1070 # Test: c_variable-5.41B
1071 # Desc: children of ***psnp->ptrs[0]->next->char_ptr
1072 mi_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}
1075 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1076
1077 # Test: c_variable-5.42
1078 # Desc: number of children of **psnp->ptrs[0]->next->char_ptr
1079 mi_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
1085 mi_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}
1088 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr after counting children"
1089
1090 # Test: c_variable-5.44
1091 # Desc: number of children of ***psnp->ptrs[0]->next->char_ptr
1092 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \
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
1098 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" {} \
1099 "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
1100
1101 # Test: c_variable-5.44B
1102 # Desc: number of children of ****psnp->ptrs[0]->next->char_ptr
1103 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \
1104 "\\^done,numchild=\"0\"" \
1105 "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
1106
1107 # Test: c_variable-5.45
1108 # Desc: children of psnp->ptrs[0]->next->next
1109 mi_list_varobj_children "psnp->ptrs.0.next.next" {
1110 {psnp->ptrs.0.next.next.char_ptr char_ptr 1 {char \*\*\*\*}}
1111 {psnp->ptrs.0.next.next.long_ptr long_ptr 1 {long \*\*\*\*}}
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"
1115
1116 # Test: c_variable-5.46
1117 # Desc: children of psnp->ptrs[0]->next->next->ptrs
1118 mi_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"
1123
1124 # Step over "snp0.char_ptr = &b3;"
1125 mi_step_to do_children_tests {} ".*${srcfile}" \
1126 [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
1127
1128 # Test: c_variable-5.47
1129 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed
1130 mi_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 } \
1135 "update all vars psnp->char_ptr (and 0.char_ptr) changed"
1136
1137 # Step over "snp1.char_ptr = &c3;"
1138 mi_step_to do_children_tests {} ".*${srcfile}" \
1139 [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
1140
1141 # Test: c_variable-5.48
1142 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
1143 mi_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} \
1148 "update all vars psnp->next->char_ptr (and 1.char_ptr) changed"
1149
1150
1151 # Step over "snp2.char_ptr = &a3;"
1152 mi_step_to do_children_tests {} ".*${srcfile}" \
1153 [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
1154
1155 # Test: c_variable-5.49
1156 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
1157 mi_varobj_update * {psnp->ptrs.0.next.next.char_ptr} \
1158 "update all vars psnp->next->next->char_ptr (and 2.char_ptr) changed"
1159
1160
1161 # Step over "snp0.long_ptr = &y3;"
1162 mi_step_to do_children_tests {} ".*${srcfile}" \
1163 [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
1164
1165 # Test: c_variable-5.50
1166 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed
1167 mi_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} \
1172 "update all vars psnp->long_ptr (and 0.long_ptr) changed"
1173
1174
1175 # Step over "snp1.long_ptr = &x3;"
1176 mi_step_to do_children_tests {} ".*${srcfile}" \
1177 [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
1178
1179 # Test: c_variable-5.51
1180 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed
1181 # Why does this have a FIXME?
1182 setup_xfail *-*-*
1183 mi_gdb_test "-var-update *" \
1184 "FIXME\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.long_ptr\",in_scope_changed=\"false\"\}\\\]" \
1185 "update all vars psnp->next->long_ptr (and 1.long_ptr) changed"
1186 clear_xfail *-*-*
1187
1188 # This command produces this error message:
1189 # &"warning: varobj_list: assertion failed - mycount <> 0\n"
1190 #
1191
1192 # Step over "snp2.long_ptr = &z3;"
1193 mi_step_to do_children_tests {} ".*${srcfile}" \
1194 [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
1195
1196 # Test: c_variable-5.52
1197 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
1198 mi_varobj_update * {psnp->ptrs.0.next.next.long_ptr} \
1199 "update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed"
1200
1201 mi_prepare_inline_tests $srcfile
1202
1203 if { [mi_run_inline_test child_deletion] < 0 } {
1204 return -1
1205 }
1206
1207
1208 mi_gdb_exit
1209