1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
|
# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test essential Machine interface (MI) operations
#
# Verify that, using the MI, we can create, update, delete variables.
#
load_lib mi-support.exp
set MIFLAGS "-i=mi2"
gdb_exit
if [mi_gdb_start] {
continue
}
set testfile "var-cmd"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
untested mi2-var-display.exp
return -1
}
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
set line_dct_end [gdb_get_line_number "{int a = 0;}"]
mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \
"break-insert operation"
mi_run_cmd
mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \
$line_dct_end { "" "disp=\"keep\"" } "run to main"
##### #####
# #
# Display tests #
# #
##### #####
# Test: c_variable-6.1
# Desc: create variable bar
mi_create_varobj bar bar "create local variable bar"
# Test: c_variable-6.2
# Desc: type of variable bar
mi_gdb_test "-var-info-type bar" \
"\\^done,type=\"int\"" \
"info type variable bar"
# Test: c_variable-6.3
# Desc: format of variable bar
mi_gdb_test "-var-show-format bar" \
"\\^done,format=\"natural\"" \
"show format variable bar"
# Test: c_variable-6.4
# Desc: value of variable bar
mi_gdb_test "-var-evaluate-expression bar" \
"\\^done,value=\"2121\"" \
"eval variable bar"
# Test: c_variable-6.5
# Desc: change format of bar to hex
mi_gdb_test "-var-set-format bar hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"0x849\"" \
"set format variable bar"
# Test: c_variable-6.6
# Desc: value of bar with new format
mi_gdb_test "-var-evaluate-expression bar" \
"\\^done,value=\"0x849\"" \
"eval variable bar with new format"
# Test: c_variable-6.7
# Desc: change value of bar
mi_gdb_test "-var-assign bar 3" \
"\\^done,value=\"0x3\"" \
"assing to variable bar"
mi_gdb_test "-var-set-format bar decimal" \
"\\^done,format=\"decimal\",value=\"3\"" \
"set format variable bar"
mi_gdb_test "-var-evaluate-expression bar" \
"\\^done,value=\"3\"" \
"eval variable bar with new value"
mi_gdb_test "-var-delete bar" \
"\\^done,ndeleted=\"1\"" \
"delete var bar"
# Test: c_variable-6.11
# Desc: create variable foo
mi_create_varobj foo foo "create local variable foo"
# Test: c_variable-6.12
# Desc: type of variable foo
mi_gdb_test "-var-info-type foo" \
"\\^done,type=\"int \\*\"" \
"info type variable foo"
# Test: c_variable-6.13
# Desc: format of variable foo
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"natural\"" \
"show format variable foo"
# Test: c_variable-6.14
# Desc: value of variable foo
mi_gdb_test "-var-evaluate-expression foo" \
"\\^done,value=\"$hex\"" \
"eval variable foo"
# Test: c_variable-6.15
# Desc: change format of var to octal
mi_gdb_test "-var-set-format foo octal" \
"\\^done,format=\"octal\",value=\"$octal\"" \
"set format variable foo"
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"octal\"" \
"show format variable foo"
# Test: c_variable-6.16
# Desc: value of foo with new format
mi_gdb_test "-var-evaluate-expression foo" \
"\\^done,value=\"\[0-7\]+\"" \
"eval variable foo"
# Test: c_variable-6.17
# Desc: change value of foo
mi_gdb_test "-var-assign foo 3" \
"\\^done,value=\"03\"" \
"assing to variable foo"
mi_gdb_test "-var-set-format foo decimal" \
"\\^done,format=\"decimal\",value=\"3\"" \
"set format variable foo"
# Test: c_variable-6.18
# Desc: check new value of foo
mi_gdb_test "-var-evaluate-expression foo" \
"\\^done,value=\"3\"" \
"eval variable foo"
# Test: c_variable-6.19
# Desc: check optional format parameter of var-evaluate-expression
# and check that current format is not changed
mi_gdb_test "-var-evaluate-expression -f hex foo" \
"\\^done,value=\"0x3\"" \
"eval variable foo in hex"
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"decimal\"" \
"show format variable foo after eval in hex"
mi_gdb_test "-var-evaluate-expression -f octal foo" \
"\\^done,value=\"03\"" \
"eval variable foo in octal"
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"decimal\"" \
"show format variable foo after eval in octal"
mi_gdb_test "-var-evaluate-expression -f decimal foo" \
"\\^done,value=\"3\"" \
"eval variable foo in decimal"
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"decimal\"" \
"show format variable foo after eval in decimal"
mi_gdb_test "-var-evaluate-expression -f nat foo" \
"\\^done,value=\"0x3\"" \
"eval variable foo in natural"
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"decimal\"" \
"show format variable foo after eval in natural"
mi_gdb_test "-var-evaluate-expression -f bin foo" \
"\\^done,value=\"11\"" \
"eval variable foo in binary"
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"decimal\"" \
"show format variable foo after eval in binary"
mi_gdb_test "-var-delete foo" \
"\\^done,ndeleted=\"1\"" \
"delete var foo"
# Test: c_variable-6.21
# Desc: create variable weird and children
mi_create_varobj weird weird "create local variable weird"
mi_list_varobj_children weird {
{weird.integer integer 0 int}
{weird.character character 0 char}
{weird.char_ptr char_ptr 1 "char \\*"}
{weird.long_int long_int 0 "long int"}
{weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
{weird.long_array long_array 10 "long int \\[10\\]"}
{weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
{weird.func_ptr_struct func_ptr_struct 0 \
"struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"}
{weird.func_ptr_ptr func_ptr_ptr 0 \
"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"}
{weird.u1 u1 4 "union \\{\\.\\.\\.\\}"}
{weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
} "get children local variable weird"
# Test: c_variable-6.23
# Desc: change format of weird.func_ptr and weird.func_ptr_ptr
mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
"set format variable weird.func_ptr"
mi_gdb_test "-var-show-format weird.func_ptr" \
"\\^done,format=\"hexadecimal\"" \
"show format variable weird.func_ptr"
mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
"set format variable weird.func_ptr_ptr"
mi_gdb_test "-var-show-format weird.func_ptr_ptr" \
"\\^done,format=\"hexadecimal\"" \
"show format variable weird.func_ptr_ptr"
# Test: c_variable-6.24
# Desc: format of weird and children
mi_gdb_test "-var-set-format weird natural" \
"\\^done,format=\"natural\",value=\"$hex\"" \
"set format variable weird"
mi_gdb_test "-var-set-format weird.integer natural" \
"\\^done,format=\"natural\",value=\"123\"" \
"set format variable weird.integer"
mi_gdb_test "-var-set-format weird.character natural" \
"\\^done,format=\"natural\",value=\"0 '\\\\\\\\0'\"" \
"set format variable weird.character"
mi_gdb_test "-var-set-format weird.char_ptr natural" \
"\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \
"set format variable weird.char_ptr"
mi_gdb_test "-var-set-format weird.long_int natural" \
"\\^done,format=\"natural\",value=\"0\"" \
"set format variable weird.long_int"
mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \
"\\^done,format=\"natural\",value=\"$hex\"" \
"set format variable weird.int_ptr_ptr"
mi_gdb_test "-var-set-format weird.long_array natural" \
"\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \
"set format variable weird.long_array"
mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
"set format variable weird.func_ptr"
mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
"set format variable weird.func_ptr_struct"
mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
"\\^done,format=\"natural\",value=\"0\"" \
"set format variable weird.func_ptr_ptr"
mi_gdb_test "-var-set-format weird.u1 natural" \
"\\^done,format=\"natural\",value=\"\{...\}\"" \
"set format variable weird.u1"
mi_gdb_test "-var-set-format weird.s2 natural" \
"\\^done,format=\"natural\",value=\"\{...\}\"" \
"set format variable weird.s2"
# Test: c_variable-6.25
# Desc: value of weird and children
#gdbtk_test c_variable-6.25 {value of weird and children} {
# set values {}
# foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] {
# lappend values [value $v $f]
# }
# set values
#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1}
# Test: c_variable-6.26
# Desc: change format of weird and children to octal
#gdbtk_test c_variable-6.26 {change format of weird and children to octal} {
# set formats {}
# foreach v [lsort [array names var]] {
# $var($v) format octal
# lappend formats [$var($v) format]
# }
# set formats
#} {octal octal octal octal octal octal octal octal octal octal octal octal}
# Test: c_variable-6.27
# Desc: value of weird and children with new format
#gdbtk_test c_variable-6.27 {value of foo with new format} {
# set values {}
# foreach v [lsort [array names var]] {
# lappend values [value $v o]
# }
# set values
#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1}
# Test: c_variable-6.30
# Desc: create more children of weird
#gdbtk_test c_variable-6.30 {create more children of weird} {
# foreach v [array names var] {
# get_children $v
# }
# # Do it twice to get more children
# foreach v [array names var] {
# get_children $v
# }
# lsort [array names var]
#} {weird weird.char_ptr weird.character weird.func_ptr weird.func_ptr_ptr weird.func_ptr_struct weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.integer weird.long_array weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.long_int weird.s2 weird.s2.g weird.s2.h weird.s2.i weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9 weird.s2.u2 weird.s2.u2.f weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.u1 weird.u1.a weird.u1.b weird.u1.c weird.u1.d}
# Test: c_variable-6.31
# Desc: check that all children of weird change
# Ok, obviously things like weird.s2 and weird.u1 will not change!
#gdbtk_test *c_variable-6.31 {check that all children of weird change (ops, we are now reporting array names as changed in this case - seems harmless though)} {
# $var(weird) value 0x2121
# check_update
#} {{weird.integer weird.character weird.char_ptr weird.long_int weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.func_ptr weird.func_ptr_struct weird.func_ptr_ptr weird.u1.a weird.u1.b weird.u1.c weird.u1.d weird.s2.u2.f weird.s2.g weird.s2.h weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9} {weird.s2.i weird.s2.u2 weird weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.s2 weird.long_array weird.u1} {}}
mi_gdb_test "-var-delete weird" \
"\\^done,ndeleted=\"12\"" \
"delete var weird"
##### #####
# #
# Special Display Tests #
# #
##### #####
# Stop in "do_special_tests"
set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"]
mi_create_breakpoint "$line_dst_incr_a_2" 2 keep do_special_tests ".*var-cmd.c" $line_dst_incr_a_2 $hex \
"break-insert operation 2"
mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \
".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \
"continue to do_special_tests"
# Test: c_variable-7.10
# Desc: create union u
mi_create_varobj u u "create local variable u"
# Test: c_variable-7.11
# Desc: value of u
mi_gdb_test "-var-evaluate-expression u" \
"\\^done,value=\"\{\\.\\.\\.\}\"" \
"eval variable u"
# Test: c_variable-7.12
# Desc: type of u
mi_gdb_test "-var-info-type u" \
"\\^done,type=\"union named_union\"" \
"info type variable u"
# Test: c_variable-7.13
# Desc: is u editable
mi_gdb_test "-var-show-attributes u" \
"\\^done,attr=\"noneditable\"" \
"is u editable"
# Test: c_variable-7.14
# Desc: number of children of u
mi_gdb_test "-var-info-num-children u" \
"\\^done,numchild=\"2\"" \
"get number of children of u"
# Test: c_variable-7.15
# Desc: children of u
mi_list_varobj_children u {
{u.integer integer 0 int}
{u.char_ptr char_ptr 1 {char \*}}
} "get children of u"
# Test: c_variable-7.20
# Desc: create anonu
mi_create_varobj anonu anonu "create local variable anonu"
# Test: c_variable-7.21
# Desc: value of anonu
mi_gdb_test "-var-evaluate-expression anonu" \
"\\^done,value=\"\{\\.\\.\\.\}\"" \
"eval variable anonu"
# Test: c_variable-7.22
# Desc: type of anonu
mi_gdb_test "-var-info-type anonu" \
"\\^done,type=\"union \{\\.\\.\\.\}\"" \
"info type variable anonu"
# Test: c_variable-7.23
# Desc: is anonu editable
mi_gdb_test "-var-show-attributes anonu" \
"\\^done,attr=\"noneditable\"" \
"is anonu editable"
# Test: c_variable-7.24
# Desc: number of children of anonu
mi_gdb_test "-var-info-num-children anonu" \
"\\^done,numchild=\"3\"" \
"get number of children of anonu"
# Test: c_variable-7.25
# Desc: children of anonu
mi_list_varobj_children "anonu" {
{anonu.a a 0 int}
{anonu.b b 0 char}
{anonu.c c 0 "long int"}
} "get children of anonu"
# Test: c_variable-7.30
# Desc: create struct s
mi_create_varobj s s "create local variable s"
# Test: c_variable-7.31
# Desc: value of s
mi_gdb_test "-var-evaluate-expression s" \
"\\^done,value=\"\{\\.\\.\\.\}\"" \
"eval variable s"
# Test: c_variable-7.32
# Desc: type of s
mi_gdb_test "-var-info-type s" \
"\\^done,type=\"struct _simple_struct\"" \
"info type variable s"
# Test: c_variable-7.33
# Desc: is s editable
mi_gdb_test "-var-show-attributes s" \
"\\^done,attr=\"noneditable\"" \
"is s editable"
# Test: c_variable-7.34
# Desc: number of children of s
mi_gdb_test "-var-info-num-children s" \
"\\^done,numchild=\"6\"" \
"get number of children of s"
# Test: c_variable-7.35
# Desc: children of s
mi_list_varobj_children s {
{s.integer integer 0 int}
{s.unsigned_integer unsigned_integer 0 "unsigned int"}
{s.character character 0 char}
{s.signed_character signed_character 0 "signed char"}
{s.char_ptr char_ptr 1 {char \*}}
{s.array_of_10 array_of_10 10 {int \[10\]}}
} "get children of s"
#} {integer unsigned_integer character signed_character char_ptr array_of_10}
# Test: c_variable-7.40
# Desc: create anons
mi_create_varobj anons anons "create local variable anons"
# Test: c_variable-7.41
# Desc: value of anons
mi_gdb_test "-var-evaluate-expression anons" \
"\\^done,value=\"\{\\.\\.\\.\}\"" \
"eval variable anons"
# Test: c_variable-7.42
# Desc: type of anons
mi_gdb_test "-var-info-type anons" \
"\\^done,type=\"struct \{\\.\\.\\.\}\"" \
"info type variable anons"
# Test: c_variable-7.43
# Desc: is anons editable
mi_gdb_test "-var-show-attributes anons" \
"\\^done,attr=\"noneditable\"" \
"is anons editable"
# Test: c_variable-7.44
# Desc: number of children of anons
mi_gdb_test "-var-info-num-children anons" \
"\\^done,numchild=\"3\"" \
"get number of children of anons"
# Test: c_variable-7.45
# Desc: children of anons
mi_list_varobj_children anons {
{anons.a a 0 int}
{anons.b b 0 char}
{anons.c c 0 "long int"}
} "get children of anons"
# Test: c_variable-7.50
# Desc: create enum e
mi_create_varobj e e "create local variable e"
setup_xfail "*-*-*"
# Test: c_variable-7.51
# Desc: value of e
mi_gdb_test "-var-evaluate-expression e" \
"\\^done,value=\"FIXME\"" \
"eval variable e"
clear_xfail "*-*-*"
# Test: c_variable-7.52
# Desc: type of e
mi_gdb_test "-var-info-type e" \
"\\^done,type=\"enum foo\"" \
"info type variable e"
# Test: c_variable-7.53
# Desc: is e editable
mi_gdb_test "-var-show-attributes e" \
"\\^done,attr=\"editable\"" \
"is e editable"
# Test: c_variable-7.54
# Desc: number of children of e
mi_gdb_test "-var-info-num-children e" \
"\\^done,numchild=\"0\"" \
"get number of children of e"
# Test: c_variable-7.55
# Desc: children of e
mi_gdb_test "-var-list-children e" \
"\\^done,numchild=\"0\"" \
"get children of e"
# Test: c_variable-7.60
# Desc: create anone
mi_create_varobj anone anone "create local variable anone"
# Test: c_variable-7.61
# Desc: value of anone
mi_gdb_test "-var-evaluate-expression anone" \
"\\^done,value=\"A\"" \
"eval variable anone"
# Test: c_variable-7.70
# Desc: create anone
mi_gdb_test "-var-create anone * anone" \
"\\^error,msg=\"Duplicate variable object name\"" \
"create duplicate local variable anone"
# Test: c_variable-7.72
# Desc: type of anone
mi_gdb_test "-var-info-type anone" \
"\\^done,type=\"enum \{\\.\\.\\.\}\"" \
"info type variable anone"
# Test: c_variable-7.73
# Desc: is anone editable
mi_gdb_test "-var-show-attributes anone" \
"\\^done,attr=\"editable\"" \
"is anone editable"
# Test: c_variable-7.74
# Desc: number of children of anone
mi_gdb_test "-var-info-num-children anone" \
"\\^done,numchild=\"0\"" \
"get number of children of anone"
# Test: c_variable-7.75
# Desc: children of anone
mi_gdb_test "-var-list-children anone" \
"\\^done,numchild=\"0\"" \
"get children of anone"
# Record fp
send_gdb "p/x \$fp\n"
gdb_expect {
-re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" {
pass "print FP register"
set fp $expect_out(1,string)
}
# -re ".*" { fail "print FP register"}
timeout { fail "print FP register (timeout)"}
}
mi_continue_to "incr_a"
# Test: c_variable-7.81
# Desc: Create variables in different scopes
mi_gdb_test "-var-create a1 * a" \
"\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \
"create local variable a1"
mi_gdb_test "-var-create a2 $fp a" \
"\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \
"create variable a2 in different scope"
#gdbtk_test c_variable-7.81 {create variables in different scopes} {
# set a1 [gdb_variable create -expr a]
# set a2 [gdb_variable create -expr a -frame $fp]
# set vals {}
# lappend vals [$a1 value]
# lappend vals [$a2 value]
# set vals
#} {2 1}
mi_gdb_exit
return 0
|