1 # Copyright 1999-2024 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Test essential Machine interface (MI) operations
18 # Verify that, using the MI, we can create, update, delete variables.
22 load_lib mi-support.exp
25 standard_testfile var-cmd.c
27 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
28 untested "failed to compile"
32 if {[mi_clean_restart $binfile]} {
36 mi_runto do_children_tests
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"
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"
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
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 10 "long \\[10\\]"}
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"
74 #gdbtk_test c_variable-4.3 {children of struct_declarations} {
75 # get_children struct_declarations
76 #} {integer character char_ptr long_int int_ptr_ptr long_array func_ptr func_ptr_struct func_ptr_ptr u1 s2}
78 # Test: c_variable-4.4
79 # Desc: number of children of struct_declarations
80 mi_gdb_test "-var-info-num-children struct_declarations" \
81 "\\^done,numchild=\"11\"" \
82 "get number of children of struct_declarations"
84 # Test: c_variable-4.5
85 # Desc: children of struct_declarations.integer
86 mi_list_varobj_children "struct_declarations.integer" {} \
87 "get children of struct_declarations.integer"
89 # Test: c_variable-4.6
90 # Desc: number of children of struct_declarations.integer
91 mi_gdb_test "-var-info-num-children struct_declarations.integer" \
92 "\\^done,numchild=\"0\"" \
93 "get number of children of struct_declarations.integer"
95 # Test: c_variable-4.7
96 # Desc: children of struct_declarations.character
97 mi_list_varobj_children "struct_declarations.character" {} \
98 "get children of struct_declarations.character"
100 # Test: c_variable-4.8
101 # Desc: number of children of struct_declarations.character
102 mi_gdb_test "-var-info-num-children struct_declarations.character" \
103 "\\^done,numchild=\"0\"" \
104 "get number of children of struct_declarations.character"
106 # Test: c_variable-4.9
107 # Desc: children of struct_declarations.char_ptr
108 mi_list_varobj_children "struct_declarations.char_ptr" {
109 {{struct_declarations.char_ptr.\*char_ptr} {\*char_ptr} 0 char}
110 } "get children of struct_declarations.char_ptr"
112 # Test: c_variable-4.10
113 # Desc: number of children of struct_declarations.char_ptr
114 mi_gdb_test "-var-info-num-children struct_declarations.char_ptr" \
115 "\\^done,numchild=\"1\"" \
116 "get number of children of struct_declarations.char_ptr"
118 # Test: c_variable-4.11
119 # Desc: children of struct_declarations.long_int
120 mi_list_varobj_children "struct_declarations.long_int" {} \
121 "get children of struct_declarations.long_int"
123 # Test: c_variable-4.12
124 # Desc: number of children of struct_declarations.long_int
125 mi_gdb_test "-var-info-num-children struct_declarations.long_int" \
126 "\\^done,numchild=\"0\"" \
127 "get number of children of struct_declarations.long_int"
129 # Test: c_variable-4.13
130 # Desc: children of int_ptr_ptr
131 mi_list_varobj_children "struct_declarations.int_ptr_ptr" {
132 {{struct_declarations.int_ptr_ptr.\*int_ptr_ptr} {\*int_ptr_ptr} 1 {int \*}}
133 } "get children of struct_declarations.int_ptr_ptr"
135 #gdbtk_test c_variable-4.13 {children of int_ptr_ptr} {
136 # get_children struct_declarations.int_ptr_ptr
139 # Test: c_variable-4.14
140 # Desc: number of children of int_ptr_ptr
141 mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr" \
142 "\\^done,numchild=\"1\"" \
143 "get number of children of struct_declarations.int_ptr_ptr"
146 # Test: c_variable-4.15
147 # Desc: children of struct_declarations.long_array
148 mi_list_array_varobj_children "struct_declarations.long_array" 10 "long" \
149 "get children of struct_declarations.long_array"
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=\"10\"" \
155 "get number of children of struct_declarations.long_array"
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"
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"
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"
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"
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"
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"
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"
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"
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"
216 #gdbtk_test c_variable-4.25 {children of struct_declarations.s2} {
217 # get_children struct_declarations.s2
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
321 # Test: c_variable-4.59
322 # Desc: children of struct_declarations.s2.i
324 for {set i 0} {$i < 10} {incr i} {
325 lappend t [list struct_declarations.s2.i.$i $i 0 "long"]
327 mi_list_varobj_children struct_declarations.s2.i $t \
328 "get children of struct_declarations.s2.i"
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"
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"
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"
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"
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"
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"
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"
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"
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"
386 # Test: c_variable-4.69
387 # Desc: children of struct_declarations.s2.u2.u1s1.e
389 for {set i 0} {$i < 10} {incr i} {
390 lappend t [list struct_declarations.s2.u2.u1s1.e.$i $i 0 char]
392 mi_list_varobj_children struct_declarations.s2.u2.u1s1.e $t \
393 "get children of struct_declarations.s2.u2.u1s1.e"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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 {} {.*var-cmd.c} \
467 $line_dct_123 "step to line \$line_dct_123"
469 # Test: c_variable-4.81
470 # Desc: create local variable "weird"
471 mi_create_varobj weird weird "create local variable weird"
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 10 "long \\[10\\]"}
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"
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"
498 # Test: c_variable-4.84
499 # Desc: children of weird->long_array
500 mi_list_array_varobj_children weird.long_array 10 "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}
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=\"10\"" \
510 "get number of children of weird.long_array"
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
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"
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
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"
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"
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"
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"
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"
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"
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"
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"
582 # Test: c_variable-4.97
583 # Desc: is weird editable
584 mi_gdb_test "-var-show-attributes weird" \
585 "\\^done,attr=\"editable\"" \
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
654 mi_gdb_test "-var-delete weird" \
655 "\\^done,ndeleted=\"24\"" \
660 # children and update tests #
664 # Test: c_variable-5.1
665 # Desc: check that nothing changed
666 mi_varobj_update * {} "update all vars. None changed"
668 # Step over "struct_declarations.integer = 123;"
669 mi_step_to do_children_tests {} {.*var-cmd.c} \
670 [expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
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"
678 # weird->char_ptr = "hello";
681 mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
682 [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4"
684 # Test: c_variable-5.3
685 # Desc: check that char_ptr changed
686 mi_varobj_update * {struct_declarations.char_ptr
687 struct_declarations.char_ptr.\\*char_ptr} \
688 "update all vars struct_declarations.char_ptr"
690 # Step over "struct_declarations.int_ptr_ptr = &foo;"
691 mi_step_to do_children_tests {} {.*var-cmd.c} \
692 [expr $line_dct_123 + 5] "step \$line_dct_123 + 5"
694 # Test: c_variable-5.4
695 # Desc: check that int_ptr_ptr and children changed
696 mi_varobj_update * {weird->int_ptr_ptr
697 weird->int_ptr_ptr.\\*weird->int_ptr_ptr
698 weird->int_ptr_ptr.\\*weird->int_ptr_ptr.\\*\\*weird->int_ptr_ptr
699 struct_declarations.int_ptr_ptr
700 struct_declarations.int_ptr_ptr.\\*int_ptr_ptr
701 struct_declarations.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr} \
702 "update all vars int_ptr_ptr and children changed"
704 # Step over "weird->long_array[0] = 1234;"
705 mi_step_to do_children_tests {} {.*var-cmd.c} \
706 [expr $line_dct_123 + 6] "step \$line_dct_123 + 6"
708 # Test: c_variable-5.5
709 # Desc: check that long_array[0] changed
710 mi_varobj_update * {struct_declarations.long_array.0} \
711 "update all vars struct_declarations.long_array.0 changed"
713 # Step over "struct_declarations.long_array[1] = 2345;"
714 mi_step_to do_children_tests {} {.*var-cmd.c} \
715 [expr $line_dct_123 + 7] "step \$line_dct_123 + 7"
717 # Test: c_variable-5.6
718 # Desc: check that long_array[1] changed
719 mi_varobj_update * {struct_declarations.long_array.1} \
720 "update all vars struct_declarations.long_array.1 changed"
722 # Step over "weird->long_array[2] = 3456;"
723 mi_step_to do_children_tests {} {.*var-cmd.c} \
724 [expr $line_dct_123 + 8] "step \$line_dct_123 + 8"
726 # Test: c_variable-5.7
727 # Desc: check that long_array[2] changed
728 mi_varobj_update * {struct_declarations.long_array.2} \
729 "update all vars struct_declarations.long_array.2 changed"
732 # struct_declarations.long_array[3] = 4567;
733 # weird->long_array[4] = 5678;
734 # struct_declarations.long_array[5] = 6789;
735 # weird->long_array[6] = 7890;
736 # struct_declarations.long_array[7] = 8901;
737 # weird->long_array[8] = 9012;
738 # struct_declarations.long_array[9] = 1234;
740 set line_dct_nothing [gdb_get_line_number "weird->func_ptr = nothing;"]
741 mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
742 $line_dct_nothing {} "step \$line_dct_nothing"
744 # Test: c_variable-5.8
745 # Desc: check that long_array[3-9] changed
746 mi_varobj_update * {struct_declarations.long_array.3
747 struct_declarations.long_array.4
748 struct_declarations.long_array.5
749 struct_declarations.long_array.6
750 struct_declarations.long_array.7
751 struct_declarations.long_array.8
752 struct_declarations.long_array.9} \
753 "update all vars struct_declarations.long_array.3-9 changed"
756 # Step over "weird->func_ptr = nothing;"
757 mi_step_to do_children_tests {} ".*${srcfile}" \
758 [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1"
760 # Test: c_variable-5.9
761 # Desc: check that func_ptr changed
762 mi_varobj_update * {struct_declarations.func_ptr} \
763 "update all vars struct_declarations.func_ptr changed"
765 # Delete all variables
766 mi_gdb_test "-var-delete struct_declarations" \
767 "\\^done,ndeleted=\"65\"" \
768 "delete var struct_declarations"
770 mi_gdb_test "-var-delete weird->int_ptr_ptr" \
771 "\\^done,ndeleted=\"3\"" \
772 "delete var weird->int_ptr_ptr"
774 # Step over all lines:
778 set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
779 mi_execute_to "exec-step 45" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
780 [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
782 # Test: c_variable-5.10
783 # Desc: create psnp->char_ptr
784 mi_create_varobj "psnp->char_ptr" "psnp->char_ptr" \
785 "create local variable psnp->char_ptr"
787 # Test: c_variable-5.11
788 # Desc: children of psnp->char_ptr
789 mi_list_varobj_children "psnp->char_ptr" {
790 {{psnp->char_ptr.\*psnp->char_ptr} {\*psnp->char_ptr} 1 {char \*\*\*}}
791 } "get children of psnp->char_ptr"
793 # Test: c_variable-5.12
794 # Desc: number of children of psnp->char_ptr
795 mi_gdb_test "-var-info-num-children psnp->char_ptr" \
796 "\\^done,numchild=\"1\"" \
797 "get number of children of psnp->char_ptr"
799 # Test: c_variable-5.13
800 # Desc: children of *(psnp->char_ptr)
801 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr" {
802 {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr} \
803 {\*\*psnp->char_ptr} 1 {char \*\*}}
804 } "get children of psnp->char_ptr.*psnp->char_ptr"
806 # Test: c_variable-5.14
807 # Desc: number of children of *(psnp->char_ptr)
808 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr" \
809 "\\^done,numchild=\"1\"" \
810 "get number of children of psnp->char_ptr.*psnp->char_ptr"
812 # Test: c_variable-5.15
813 # Desc: children of *(*(psnp->char_ptr))
814 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" {
815 {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr} \
816 {\*\*\*psnp->char_ptr} 1 {char \*}}
817 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
819 # Test: c_variable-5.15B
820 # Desc: children of *(*(*(psnp->char_ptr)))
821 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" {
822 {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr.\*\*\*\*psnp->char_ptr} \
823 {\*\*\*\*psnp->char_ptr} 0 char}
824 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
826 # Test: c_variable-5.16
827 # Desc: number of children of *(*(psnp->char_ptr))
828 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \
829 "\\^done,numchild=\"1\"" \
830 "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
832 # Test: c_variable-5.17
833 # Desc: children of *(*(*(psnp->char_ptr)))
834 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" {
835 {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr.\*\*\*\*psnp->char_ptr} \
836 {\*\*\*\*psnp->char_ptr} 0 char}
837 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr after counting children"
839 # Test: c_variable-5.18
840 # Desc: number of children of *(*(*(psnp->char_ptr)))
841 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \
842 "\\^done,numchild=\"1\"" \
843 "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
845 # Test: c_variable-5.17B
846 # Desc: children of *(*(*(*(psnp->char_ptr))))
847 mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" {} \
848 "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr"
850 # Test: c_variable-5.18B
851 # Desc: number of children of *(*(*(*(psnp->char_ptr))))
852 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \
853 "\\^done,numchild=\"0\"" \
854 "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr"
856 # Test: c_variable-5.19
857 # Desc: create psnp->long_ptr
858 mi_create_varobj "psnp->long_ptr" "psnp->long_ptr" \
859 "create local variable psnp->long_ptr"
861 # Test: c_variable-5.20
862 # Desc: children of psnp->long_ptr
863 mi_list_varobj_children "psnp->long_ptr" {
864 {{psnp->long_ptr.\*psnp->long_ptr} {\*psnp->long_ptr} 1 {long \*\*\*}}
865 } "get children of psnp->long_ptr"
867 # Test: c_variable-5.21
868 # Desc: number of children of psnp->long_ptr
869 mi_gdb_test "-var-info-num-children psnp->long_ptr" \
870 "\\^done,numchild=\"1\"" \
871 "get number of children of psnp->long_ptr"
873 # Test: c_variable-5.22
874 # Desc: children of *(psnp->long_ptr)
875 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr" {
876 {{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr} {\*\*psnp->long_ptr} 1 {long \*\*}}
877 } "get children of psnp->long_ptr.*psnp->long_ptr"
880 # Test: c_variable-5.23
881 # Desc: number of children of *(psnp->long_ptr)
882 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr" \
883 "\\^done,numchild=\"1\"" \
884 "get number of children of psnp->long_ptr.*psnp->long_ptr"
886 # Test: c_variable-5.24
887 # Desc: children of *(*(psnp->long_ptr))
888 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" {
889 {{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr.\*\*\*psnp->long_ptr} \
890 {\*\*\*psnp->long_ptr} 1 {long \*}}
891 } "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr"
893 # Test: c_variable-5.25
894 # Desc: number of children of *(*(psnp->long_ptr))
895 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \
896 "\\^done,numchild=\"1\"" \
897 "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr"
899 # Test: c_variable-5.26
900 # Desc: children of *(*(*(psnp->long_ptr)))
901 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" {
902 {{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr.\*\*\*psnp->long_ptr.\*\*\*\*psnp->long_ptr}
903 {\*\*\*\*psnp->long_ptr} 0 {long}}
904 } "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr"
906 # Test: c_variable-5.27
907 # Desc: number of children of *(*(*(psnp->long_ptr)))
908 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \
909 "\\^done,numchild=\"1\"" \
910 "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr"
912 # Test: c_variable-5.28
913 # Desc: children of *(*(*(*(psnp->long_ptr))))
914 mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" {} \
915 "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr"
917 # Test: c_variable-5.29
918 # Desc: number of children of *(*(*(*(psnp->long_ptr))))
919 mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \
920 "\\^done,numchild=\"0\"" \
921 "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr"
924 # Test: c_variable-5.30
925 # Desc: create psnp->ptrs
926 mi_create_varobj "psnp->ptrs" "psnp->ptrs" \
927 "create local variable psnp->ptrs"
929 # Test: c_variable-5.31
930 # Desc: children of psnp->ptrs
931 mi_list_varobj_children "psnp->ptrs" {
932 {psnp->ptrs.0 0 4 {struct _struct_n_pointer \*}}
933 {psnp->ptrs.1 1 4 {struct _struct_n_pointer \*}}
934 {psnp->ptrs.2 2 4 {struct _struct_n_pointer \*}}
935 } "get children of psnp->ptrs"
937 # Test: c_variable-5.32
938 # Desc: number of children of psnp->ptrs
939 mi_gdb_test "-var-info-num-children psnp->ptrs" \
940 "\\^done,numchild=\"3\"" \
941 "get number of children of psnp->ptrs"
943 # Test: c_variable-5.33
944 # Desc: children of psnp->ptrs[0]
945 mi_list_varobj_children "psnp->ptrs.0" {
946 {psnp->ptrs.0.char_ptr char_ptr 1 {char \*\*\*\*}}
947 {psnp->ptrs.0.long_ptr long_ptr 1 {long \*\*\*\*}}
948 {psnp->ptrs.0.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
949 {psnp->ptrs.0.next next 4 {struct _struct_n_pointer \*}}
950 } "get children of psnp->ptrs.0"
952 # Test: c_variable-5.34
953 # Desc: number of children of psnp->ptrs[0]
954 mi_gdb_test "-var-info-num-children psnp->ptrs.0" \
955 "\\^done,numchild=\"4\"" \
956 "get number of children of psnp->ptrs.0"
958 # Test: c_variable-5.35
959 # Desc: children of psnp->ptrs[0]->next
960 mi_list_varobj_children "psnp->ptrs.0.next" {
961 {psnp->ptrs.0.next.char_ptr char_ptr 1 {char \*\*\*\*}}
962 {psnp->ptrs.0.next.long_ptr long_ptr 1 {long \*\*\*\*}}
963 {psnp->ptrs.0.next.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
964 {psnp->ptrs.0.next.next next 4 {struct _struct_n_pointer \*}}
965 } "get children of psnp->ptrs.0.next"
967 #} {char_ptr long_ptr ptrs next}
969 # Test: c_variable-5.36
970 # Desc: number of children of psnp->ptrs[0]->next
971 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next" \
972 "\\^done,numchild=\"4\"" \
973 "get number of children of psnp->ptrs.0.next"
976 # Test: c_variable-5.37
977 # Desc: children of psnp->ptrs[0]->next->char_ptr
978 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr" {
979 {{psnp->ptrs.0.next.char_ptr.\*char_ptr} {\*char_ptr} 1 {char \*\*\*}}
980 } "get children of psnp->ptrs.0.next.char_ptr"
982 #gdbtk_test c_variable-5.37 {children of psnp->ptrs[0]->next->char_ptr} {
983 # get_children psnp->ptrs.0.next.char_ptr
986 # Test: c_variable-5.38
987 # Desc: number of children of psnp->ptrs[0]->next->char_ptr
988 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr" \
989 "\\^done,numchild=\"1\"" \
990 "get number of children of psnp->ptrs.0.next.char_ptr"
992 # Test: c_variable-5.39
993 # Desc: children of *psnp->ptrs[0]->next->char_ptr
994 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr" {
995 {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr} {\*\*char_ptr} 1 {char \*\*}}
996 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr"
998 # Test: c_variable-5.40
999 # Desc: number of children of *psnp->ptrs[0]->next->char_ptr
1000 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr" \
1001 "\\^done,numchild=\"1\"" \
1002 "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr"
1004 # Test: c_variable-5.41
1005 # Desc: children of **psnp->ptrs[0]->next->char_ptr
1006 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" {
1007 {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr} \
1008 {\*\*\*char_ptr} 1 {char \*}}
1009 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
1011 # Test: c_variable-5.41B
1012 # Desc: children of ***psnp->ptrs[0]->next->char_ptr
1013 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" {
1014 {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr.\*\*\*\*char_ptr} \
1015 {\*\*\*\*char_ptr} 0 char}
1016 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1018 # Test: c_variable-5.42
1019 # Desc: number of children of **psnp->ptrs[0]->next->char_ptr
1020 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \
1021 "\\^done,numchild=\"1\"" \
1022 "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
1024 # Test: c_variable-5.43
1025 # Desc: children of ***psnp->ptrs[0]->next->char_ptr
1026 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" {
1027 {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr.\*\*\*\*char_ptr} \
1028 {\*\*\*\*char_ptr} 0 char}
1029 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr after counting children"
1031 # Test: c_variable-5.44
1032 # Desc: number of children of ***psnp->ptrs[0]->next->char_ptr
1033 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \
1034 "\\^done,numchild=\"1\"" \
1035 "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
1037 # Test: c_variable-5.43B
1038 # Desc: children of ****psnp->ptrs[0]->next->char_ptr
1039 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" {} \
1040 "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
1042 # Test: c_variable-5.44B
1043 # Desc: number of children of ****psnp->ptrs[0]->next->char_ptr
1044 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \
1045 "\\^done,numchild=\"0\"" \
1046 "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
1048 # Test: c_variable-5.45
1049 # Desc: children of psnp->ptrs[0]->next->next
1050 mi_list_varobj_children "psnp->ptrs.0.next.next" {
1051 {psnp->ptrs.0.next.next.char_ptr char_ptr 1 {char \*\*\*\*}}
1052 {psnp->ptrs.0.next.next.long_ptr long_ptr 1 {long \*\*\*\*}}
1053 {psnp->ptrs.0.next.next.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
1054 {psnp->ptrs.0.next.next.next next 4 {struct _struct_n_pointer \*}}
1055 } "get children of psnp->ptrs.0.next.next"
1058 # Test: c_variable-5.46
1059 # Desc: children of psnp->ptrs[0]->next->next->ptrs
1060 mi_list_varobj_children "psnp->ptrs.0.next.next.ptrs" {
1061 {psnp->ptrs.0.next.next.ptrs.0 0 4 {struct _struct_n_pointer \*}}
1062 {psnp->ptrs.0.next.next.ptrs.1 1 4 {struct _struct_n_pointer \*}}
1063 {psnp->ptrs.0.next.next.ptrs.2 2 4 {struct _struct_n_pointer \*}}
1064 } "get children of psnp->ptrs.0.next.next.ptrs"
1066 # Step over "snp0.char_ptr = &b3;"
1067 mi_step_to do_children_tests {} {.*var-cmd.c} \
1068 [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
1070 # Test: c_variable-5.47
1071 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed
1072 mi_varobj_update * {psnp->ptrs.0.char_ptr
1074 psnp->char_ptr.\\*psnp->char_ptr psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr
1075 psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr
1076 psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr } \
1077 "update all vars psnp->char_ptr (and 0.char_ptr) changed"
1079 # Step over "snp1.char_ptr = &c3;"
1080 mi_step_to do_children_tests {} {.*var-cmd.c} \
1081 [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
1083 # Test: c_variable-5.48
1084 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
1085 mi_varobj_update * {psnp->ptrs.0.next.char_ptr
1086 psnp->ptrs.0.next.char_ptr.\\*char_ptr
1087 psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr
1088 psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr
1089 psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr} \
1090 "update all vars psnp->next->char_ptr (and 1.char_ptr) changed"
1093 # Step over "snp2.char_ptr = &a3;"
1094 mi_step_to do_children_tests {} {.*var-cmd.c} \
1095 [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
1097 # Test: c_variable-5.49
1098 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
1099 mi_varobj_update * {psnp->ptrs.0.next.next.char_ptr} \
1100 "update all vars psnp->next->next->char_ptr (and 2.char_ptr) changed"
1103 # Step over "snp0.long_ptr = &y3;"
1104 mi_step_to do_children_tests {} {.*var-cmd.c} \
1105 [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
1107 # Test: c_variable-5.50
1108 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed
1109 mi_varobj_update * {psnp->ptrs.0.long_ptr psnp->long_ptr
1110 psnp->long_ptr.\\*psnp->long_ptr
1111 psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr
1112 psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr
1113 psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr.\\*\\*\\*\\*psnp->long_ptr} \
1114 "update all vars psnp->long_ptr (and 0.long_ptr) changed"
1117 # Step over "snp1.long_ptr = &x3;"
1118 mi_step_to do_children_tests {} {.*var-cmd.c} \
1119 [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
1121 # Test: c_variable-5.51
1122 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed
1123 # Why does this have a FIXME?
1125 mi_gdb_test "-var-update *" \
1126 "FIXME\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
1127 "update all vars psnp->next->long_ptr (and 1.long_ptr) changed"
1130 # This command produces this error message:
1131 # &"warning: varobj_list: assertion failed - mycount <> 0\n"
1134 # Step over "snp2.long_ptr = &z3;"
1135 mi_step_to do_children_tests {} {.*var-cmd.c} \
1136 [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
1138 # Test: c_variable-5.52
1139 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
1140 mi_varobj_update * {psnp->ptrs.0.next.next.long_ptr} \
1141 "update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed"
1144 # Anonymous type tests
1145 proc verify_everything {variable_name} {
1146 # Test -var-list-children
1147 mi_varobj_tree_test_children_callback $variable_name
1149 # Bring the variable named by VARIABLE_NAME into the current scope
1151 upvar #0 $variable_name varobj
1153 # Test -var-info-path-expression
1154 mi_gdb_test "-var-info-path-expression $varobj(obj_name)" \
1155 "\\^done,path_expr=\"[string_to_regexp $varobj(path_expr)]\"" \
1156 "path expression for $varobj(obj_name)"
1158 # Test -var-info-expression
1159 mi_gdb_test "-var-info-expression $varobj(obj_name)" \
1160 "\\^done,lang=\"C\",exp=\"[string_to_regexp $varobj(display_name)]\"" \
1161 "expression for $varobj(obj_name)"
1164 set lineno [gdb_get_line_number "anonymous type tests breakpoint"]
1165 mi_create_breakpoint \
1166 "$srcfile:$lineno" "break in do_anonymous_type_tests" \
1167 -disp keep -func do_anonymous_type_tests \
1168 -file ".*var-cmd.c" -line $lineno
1170 set lineno [gdb_get_line_number "nested struct union tests breakpoint"]
1171 mi_create_breakpoint \
1172 "$srcfile:$lineno" "break in do_nested_struct_union_tests" \
1173 -disp keep -func do_nested_struct_union_tests \
1174 -file ".*var-cmd.c" -line $lineno
1176 mi_execute_to "exec-continue" "breakpoint-hit" "do_anonymous_type_tests" ""\
1177 ".*" ".*" {"" "disp=\"keep\""} \
1178 "continue to do_anonymous_type_tests breakpoint"
1180 # Run the varobj tree on variable "ptr".
1182 {struct anonymous **} ptr {
1183 {struct anonymous *} {*ptr} {
1197 {const char *} {*h} {
1198 {const char} {**h} {}
1201 {simpleton ***} simple {
1202 {simpleton **} {*simple} {
1203 {simpleton *} {**simple} {
1205 {unsigned int} unsigned_integer {}
1207 {signed char} signed_character {}
1211 {int [10]} array_of_10 {
1233 mi_walk_varobj_tree c $tree verify_everything
1247 mi_walk_varobj_tree c $tree verify_everything
1249 mi_send_resuming_command "exec-continue" \
1250 "continuing execution to enter do_nested_struct_union_tests"
1251 mi_expect_stop "breakpoint-hit" "do_nested_struct_union_tests" ".*" ".*" ".*" \
1252 {.* disp="keep"} "Run till MI stops in do_nested_struct_union_tests"
1254 set struct_ss_tree {
1293 mi_walk_varobj_tree c $tree verify_everything
1296 {struct {...}} var2 {
1308 mi_walk_varobj_tree c $tree verify_everything
1311 {struct ss *} ss_ptr {
1316 mi_walk_varobj_tree c $tree verify_everything