1 # Copyright
1999, 2000, 2001, 2002, 2003, 2004, 2005
2 # Free Software Foundation
, Inc.
4 # This
Program Is Free software
; you can redistribute it and
/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation
; either version
2 of the License
, or
7 #
(at your option
) any later version.
9 # This
program is distributed in the hope that it will be useful
,
10 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License
for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this
program; if not
, write to the Free Software
16 # Foundation
, Inc.
, 59 Temple Place
- Suite
330, Boston
, MA
02111-1307, USA.
18 # Test essential Machine interface
(MI
) operations
20 # Verify that
, using the MI
, we can create
, update, delete variables.
24 load_lib mi
-support.exp
32 set testfile
"var-cmd"
33 set srcfile $
{testfile
}.c
34 set binfile $
{objdir
}/$
{subdir
}/$
{testfile
}
35 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
36 gdb_suppress_entire_file
"Testcase compile failed, so all tests in this file will automatically fail."
40 mi_gdb_reinitialize_dir $srcdir
/$subdir
41 mi_gdb_load $
{binfile
}
43 set line_dct_close_brace
[expr
[gdb_get_line_number
"snp2.long_ptr = &z3;"] + 1]
45 mi_gdb_test
"200-break-insert $line_dct_close_brace" \
46 "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_close_brace\",times=\"0\"\}" \
47 "break-insert operation"
50 # The running part has been checked already by mi_run_cmd
52 -re
"\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dct_close_brace\"\}\r\n$mi_gdb_prompt$" {
53 pass
"run to do_children_tests"
55 -re
".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"}
56 timeout
{fail
"run to do_children_tests (timeout 2)"}
65 # Test
: c_variable
-6.1
66 # Desc
: create
variable bar
67 mi_gdb_test
"-var-create bar * bar" \
68 "\\^done,name=\"bar\",numchild=\"0\",type=\"int\"" \
69 "create local variable bar"
71 # Test
: c_variable
-6.2
72 # Desc
: type of
variable bar
73 mi_gdb_test
"-var-info-type bar" \
74 "\\^done,type=\"int\"" \
75 "info type variable bar"
77 # Test
: c_variable
-6.3
78 # Desc
: format of
variable bar
79 mi_gdb_test
"-var-show-format bar" \
80 "\\^done,format=\"natural\"" \
81 "show format variable bar"
83 # Test
: c_variable
-6.4
84 # Desc
: value of
variable bar
85 mi_gdb_test
"-var-evaluate-expression bar" \
86 "\\^done,value=\"2121\"" \
89 # Test
: c_variable
-6.5
90 # Desc
: change format of bar to hex
91 mi_gdb_test
"-var-set-format bar hexadecimal" \
92 "\\^done,format=\"hexadecimal\"" \
93 "set format variable bar"
95 # Test
: c_variable
-6.6
96 # Desc
: value of bar with new format
97 mi_gdb_test
"-var-evaluate-expression bar" \
98 "\\^done,value=\"0x849\"" \
99 "eval variable bar with new format"
101 # Test
: c_variable
-6.7
102 # Desc
: change value of bar
103 mi_gdb_test
"-var-assign bar 3" \
104 "\\^done,value=\"0x3\"" \
105 "assing to variable bar"
107 mi_gdb_test
"-var-set-format bar decimal" \
108 "\\^done,format=\"decimal\"" \
109 "set format variable bar"
111 mi_gdb_test
"-var-evaluate-expression bar" \
112 "\\^done,value=\"3\"" \
113 "eval variable bar with new value"
115 mi_gdb_test
"-var-delete bar" \
116 "\\^done,ndeleted=\"1\"" \
119 # Test
: c_variable
-6.11
120 # Desc
: create
variable foo
121 mi_gdb_test
"-var-create foo * foo" \
122 "\\^done,name=\"foo\",numchild=\"1\",type=\"int \\*\"" \
123 "create local variable foo"
125 # Test
: c_variable
-6.12
126 # Desc
: type of
variable foo
127 mi_gdb_test
"-var-info-type foo" \
128 "\\^done,type=\"int \\*\"" \
129 "info type variable foo"
131 # Test
: c_variable
-6.13
132 # Desc
: format of
variable foo
133 mi_gdb_test
"-var-show-format foo" \
134 "\\^done,format=\"natural\"" \
135 "show format variable foo"
137 # Test
: c_variable
-6.14
138 # Desc
: value of
variable foo
139 mi_gdb_test
"-var-evaluate-expression foo" \
140 "\\^done,value=\"$hex\"" \
143 # Test
: c_variable
-6.15
144 # Desc
: change format of var to octal
145 mi_gdb_test
"-var-set-format foo octal" \
146 "\\^done,format=\"octal\"" \
147 "set format variable foo"
149 mi_gdb_test
"-var-show-format foo" \
150 "\\^done,format=\"octal\"" \
151 "show format variable foo"
153 # Test
: c_variable
-6.16
154 # Desc
: value of foo with new format
155 mi_gdb_test
"-var-evaluate-expression foo" \
156 "\\^done,value=\"\[0-7\]+\"" \
159 # Test
: c_variable
-6.17
160 # Desc
: change value of foo
161 mi_gdb_test
"-var-assign foo 3" \
162 "\\^done,value=\"03\"" \
163 "assing to variable foo"
165 mi_gdb_test
"-var-set-format foo decimal" \
166 "\\^done,format=\"decimal\"" \
167 "set format variable foo"
169 # Test
: c_variable
-6.18
170 # Desc
: check new value of foo
171 mi_gdb_test
"-var-evaluate-expression foo" \
172 "\\^done,value=\"3\"" \
175 mi_gdb_test
"-var-delete foo" \
176 "\\^done,ndeleted=\"1\"" \
179 # Test
: c_variable
-6.21
180 # Desc
: create
variable weird and children
181 mi_gdb_test
"-var-create weird * weird" \
182 "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \
183 "create local variable weird"
185 mi_gdb_test
"-var-list-children weird" \
186 "\\^done,numchild=\"11\",children=\\\[child=\{name=\"weird.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"weird.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child={name=\"weird.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"weird.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"weird.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"weird.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void|)\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\\\]" \
187 "get children local variable weird"
190 # Test
: c_variable
-6.23
191 # Desc
: change format of weird.func_ptr and weird.func_ptr_ptr
192 mi_gdb_test
"-var-set-format weird.func_ptr hexadecimal" \
193 "\\^done,format=\"hexadecimal\"" \
194 "set format variable weird.func_ptr"
196 mi_gdb_test
"-var-show-format weird.func_ptr" \
197 "\\^done,format=\"hexadecimal\"" \
198 "show format variable weird.func_ptr"
200 mi_gdb_test
"-var-set-format weird.func_ptr_ptr hexadecimal" \
201 "\\^done,format=\"hexadecimal\"" \
202 "set format variable weird.func_ptr_ptr"
204 mi_gdb_test
"-var-show-format weird.func_ptr_ptr" \
205 "\\^done,format=\"hexadecimal\"" \
206 "show format variable weird.func_ptr_ptr"
208 # Test
: c_variable
-6.24
209 # Desc
: format of weird and children
210 mi_gdb_test
"-var-set-format weird natural" \
211 "\\^done,format=\"natural\"" \
212 "set format variable weird"
214 mi_gdb_test
"-var-set-format weird.integer natural" \
215 "\\^done,format=\"natural\"" \
216 "set format variable weird.integer"
218 mi_gdb_test
"-var-set-format weird.character natural" \
219 "\\^done,format=\"natural\"" \
220 "set format variable weird.character"
222 mi_gdb_test
"-var-set-format weird.char_ptr natural" \
223 "\\^done,format=\"natural\"" \
224 "set format variable weird.char_ptr"
226 mi_gdb_test
"-var-set-format weird.long_int natural" \
227 "\\^done,format=\"natural\"" \
228 "set format variable weird.long_int"
230 mi_gdb_test
"-var-set-format weird.int_ptr_ptr natural" \
231 "\\^done,format=\"natural\"" \
232 "set format variable weird.int_ptr_ptr"
234 mi_gdb_test
"-var-set-format weird.long_array natural" \
235 "\\^done,format=\"natural\"" \
236 "set format variable weird.long_array"
238 mi_gdb_test
"-var-set-format weird.func_ptr hexadecimal" \
239 "\\^done,format=\"hexadecimal\"" \
240 "set format variable weird.func_ptr"
242 mi_gdb_test
"-var-set-format weird.func_ptr_struct hexadecimal" \
243 "\\^done,format=\"hexadecimal\"" \
244 "set format variable weird.func_ptr_struct"
246 mi_gdb_test
"-var-set-format weird.func_ptr_ptr natural" \
247 "\\^done,format=\"natural\"" \
248 "set format variable weird.func_ptr_ptr"
250 mi_gdb_test
"-var-set-format weird.u1 natural" \
251 "\\^done,format=\"natural\"" \
252 "set format variable weird.u1"
254 mi_gdb_test
"-var-set-format weird.s2 natural" \
255 "\\^done,format=\"natural\"" \
256 "set format variable weird.s2"
258 # Test
: c_variable
-6.25
259 # Desc
: value of weird and children
260 #gdbtk_test c_variable
-6.25 {value of weird and children
} {
262 # foreach v
[lsort
[array names var
]] f
[list x
"" "" x x x x d d d d d] {
263 # lappend
values [value $v $f
]
267 #
} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1
}
269 # Test
: c_variable
-6.26
270 # Desc
: change format of weird and children to octal
271 #gdbtk_test c_variable
-6.26 {change format of weird and children to octal
} {
273 # foreach v
[lsort
[array names var
]] {
274 # $var
($v
) format octal
275 # lappend formats
[$var
($v
) format
]
279 #
} {octal octal octal octal octal octal octal octal octal octal octal octal
}
281 # Test
: c_variable
-6.27
282 # Desc
: value of weird and children with new format
283 #gdbtk_test c_variable
-6.27 {value of foo with new format
} {
285 # foreach v
[lsort
[array names var
]] {
286 # lappend
values [value $v o
]
290 #
} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1
}
292 # Test
: c_variable
-6.30
293 # Desc
: create more children of weird
294 #gdbtk_test c_variable
-6.30 {create more children of weird
} {
295 # foreach v
[array names var
] {
299 # #
Do it twice to
get more children
300 # foreach v
[array names var
] {
304 # lsort
[array names var
]
305 #
} {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
}
307 # Test
: c_variable
-6.31
308 # Desc
: check that all children of weird change
309 # Ok
, obviously things like weird.s2 and weird.u1 will not change
!
310 #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
)} {
311 # $var
(weird
) value
0x2121
313 #
} {{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
} {}}
315 mi_gdb_test
"-var-delete weird" \
316 "\\^done,ndeleted=\"12\"" \
322 # Special Display Tests #
326 # Stop in
"do_special_tests"
328 set line_dst_a_1
[gdb_get_line_number
"a = 1;"]
330 mi_gdb_test
"200-break-insert do_special_tests" \
331 "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_a_1\",times=\"0\"\}" \
332 "break-insert operation"
334 send_gdb
"-exec-continue\n"
336 -re
"\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dst_a_1\"\}\r\n$mi_gdb_prompt$" {
337 pass
"continue to do_special_tests"
340 fail
"continue to do_special_tests (timeout)"
344 # Test
: c_variable
-7.10
345 # Desc
: create union u
346 mi_gdb_test
"-var-create u * u" \
347 "\\^done,name=\"u\",numchild=\"2\",type=\"union named_union\"" \
348 "create local variable u"
350 # Test
: c_variable
-7.11
352 mi_gdb_test
"-var-evaluate-expression u" \
353 "\\^done,value=\"\{\\.\\.\\.\}\"" \
356 # Test
: c_variable
-7.12
358 mi_gdb_test
"-var-info-type u" \
359 "\\^done,type=\"union named_union\"" \
360 "info type variable u"
362 # Test
: c_variable
-7.13
363 # Desc
: is u editable
364 mi_gdb_test
"-var-show-attributes u" \
365 "\\^done,attr=\"noneditable\"" \
368 # Test
: c_variable
-7.14
369 # Desc
: number of children of u
370 mi_gdb_test
"-var-info-num-children u" \
371 "\\^done,numchild=\"2\"" \
372 "get number of children of u"
374 # Test
: c_variable
-7.15
375 # Desc
: children of u
376 mi_gdb_test
"-var-list-children u" \
377 "\\^done,numchild=\"2\",children=\\\[child=\{name=\"u.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"u.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\}\\\]" \
380 # Test
: c_variable
-7.20
382 mi_gdb_test
"-var-create anonu * anonu" \
383 "\\^done,name=\"anonu\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"" \
384 "create local variable anonu"
386 # Test
: c_variable
-7.21
387 # Desc
: value of anonu
388 mi_gdb_test
"-var-evaluate-expression anonu" \
389 "\\^done,value=\"\{\\.\\.\\.\}\"" \
390 "eval variable anonu"
392 # Test
: c_variable
-7.22
393 # Desc
: type of anonu
394 mi_gdb_test
"-var-info-type anonu" \
395 "\\^done,type=\"union \{\\.\\.\\.\}\"" \
396 "info type variable anonu"
398 # Test
: c_variable
-7.23
399 # Desc
: is anonu editable
400 mi_gdb_test
"-var-show-attributes anonu" \
401 "\\^done,attr=\"noneditable\"" \
404 # Test
: c_variable
-7.24
405 # Desc
: number of children of anonu
406 mi_gdb_test
"-var-info-num-children anonu" \
407 "\\^done,numchild=\"3\"" \
408 "get number of children of anonu"
410 # Test
: c_variable
-7.25
411 # Desc
: children of anonu
412 mi_gdb_test
"-var-list-children anonu" \
413 "\\^done,numchild=\"3\",children=\\\[child=\{name=\"anonu.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"anonu.b\",exp=\"b\",numchild=\"0\",type=\"char\"\},child=\{name=\"anonu.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\}\\\]" \
414 "get children of anonu"
416 # Test
: c_variable
-7.30
417 # Desc
: create struct s
418 mi_gdb_test
"-var-create s * s" \
419 "\\^done,name=\"s\",numchild=\"6\",type=\"struct _simple_struct\"" \
420 "create local variable s"
423 # Test
: c_variable
-7.31
425 mi_gdb_test
"-var-evaluate-expression s" \
426 "\\^done,value=\"\{\\.\\.\\.\}\"" \
429 # Test
: c_variable
-7.32
431 mi_gdb_test
"-var-info-type s" \
432 "\\^done,type=\"struct _simple_struct\"" \
433 "info type variable s"
435 # Test
: c_variable
-7.33
436 # Desc
: is s editable
437 mi_gdb_test
"-var-show-attributes s" \
438 "\\^done,attr=\"noneditable\"" \
441 # Test
: c_variable
-7.34
442 # Desc
: number of children of s
443 mi_gdb_test
"-var-info-num-children s" \
444 "\\^done,numchild=\"6\"" \
445 "get number of children of s"
447 # Test
: c_variable
-7.35
448 # Desc
: children of s
449 mi_gdb_test
"-var-list-children s" \
450 "\\^done,numchild=\"6\",children=\\\[child=\{name=\"s.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"s.unsigned_integer\",exp=\"unsigned_integer\",numchild=\"0\",type=\"unsigned int\"\},child=\{name=\"s.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child=\{name=\"s.signed_character\",exp=\"signed_character\",numchild=\"0\",type=\"signed char\"\},child=\{name=\"s.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"s.array_of_10\",exp=\"array_of_10\",numchild=\"10\",type=\"int \\\[10\\\]\"\}\\\]" \
452 #
} {integer unsigned_integer character signed_character char_ptr array_of_10
}
454 # Test
: c_variable
-7.40
456 mi_gdb_test
"-var-create anons * anons" \
457 "\\^done,name=\"anons\",numchild=\"3\",type=\"struct \{\\.\\.\\.\}\"" \
458 "create local variable anons"
460 # Test
: c_variable
-7.41
461 # Desc
: value of anons
462 mi_gdb_test
"-var-evaluate-expression anons" \
463 "\\^done,value=\"\{\\.\\.\\.\}\"" \
464 "eval variable anons"
466 # Test
: c_variable
-7.42
467 # Desc
: type of anons
468 mi_gdb_test
"-var-info-type anons" \
469 "\\^done,type=\"struct \{\\.\\.\\.\}\"" \
470 "info type variable anons"
472 # Test
: c_variable
-7.43
473 # Desc
: is anons editable
474 mi_gdb_test
"-var-show-attributes anons" \
475 "\\^done,attr=\"noneditable\"" \
478 # Test
: c_variable
-7.44
479 # Desc
: number of children of anons
480 mi_gdb_test
"-var-info-num-children anons" \
481 "\\^done,numchild=\"3\"" \
482 "get number of children of anons"
484 # Test
: c_variable
-7.45
485 # Desc
: children of anons
486 mi_gdb_test
"-var-list-children anons" \
487 "\\^done,numchild=\"3\",children=\\\[child=\{name=\"anons.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"anons.b\",exp=\"b\",numchild=\"0\",type=\"char\"\},child=\{name=\"anons.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\}\\\]" \
488 "get children of anons"
491 # Test
: c_variable
-7.50
492 # Desc
: create enum e
493 mi_gdb_test
"-var-create e * e" \
494 "\\^done,name=\"e\",numchild=\"0\",type=\"enum foo\"" \
495 "create local variable e"
498 # Test
: c_variable
-7.51
500 mi_gdb_test
"-var-evaluate-expression e" \
501 "\\^done,value=\"FIXME\"" \
505 # Test
: c_variable
-7.52
507 mi_gdb_test
"-var-info-type e" \
508 "\\^done,type=\"enum foo\"" \
509 "info type variable e"
511 # Test
: c_variable
-7.53
512 # Desc
: is e editable
513 mi_gdb_test
"-var-show-attributes e" \
514 "\\^done,attr=\"editable\"" \
517 # Test
: c_variable
-7.54
518 # Desc
: number of children of e
519 mi_gdb_test
"-var-info-num-children e" \
520 "\\^done,numchild=\"0\"" \
521 "get number of children of e"
523 # Test
: c_variable
-7.55
524 # Desc
: children of e
525 mi_gdb_test
"-var-list-children e" \
526 "\\^done,numchild=\"0\"" \
529 # Test
: c_variable
-7.60
531 mi_gdb_test
"-var-create anone * anone" \
532 "\\^done,name=\"anone\",numchild=\"0\",type=\"enum \{\\.\\.\\.\}\"" \
533 "create local variable anone"
536 # Test
: c_variable
-7.61
537 # Desc
: value of anone
538 mi_gdb_test
"-var-evaluate-expression anone" \
539 "\\^done,value=\"A\"" \
540 "eval variable anone"
544 # Test
: c_variable
-7.70
546 mi_gdb_test
"-var-create anone * anone" \
547 "&\"Duplicate variable object name\\\\n\".*\\^error,msg=\"Duplicate variable object name\"" \
548 "create duplicate local variable anone"
551 # Test
: c_variable
-7.72
552 # Desc
: type of anone
553 mi_gdb_test
"-var-info-type anone" \
554 "\\^done,type=\"enum \{\\.\\.\\.\}\"" \
555 "info type variable anone"
558 # Test
: c_variable
-7.73
559 # Desc
: is anone editable
560 mi_gdb_test
"-var-show-attributes anone" \
561 "\\^done,attr=\"editable\"" \
564 # Test
: c_variable
-7.74
565 # Desc
: number of children of anone
566 mi_gdb_test
"-var-info-num-children anone" \
567 "\\^done,numchild=\"0\"" \
568 "get number of children of anone"
570 # Test
: c_variable
-7.75
571 # Desc
: children of anone
572 mi_gdb_test
"-var-list-children anone" \
573 "\\^done,numchild=\"0\"" \
574 "get children of anone"
579 send_gdb
"p/x \$fp\n"
581 -re
".*($hex).*\\^done\r\n$mi_gdb_prompt$" {
582 pass
"print FP register"
583 set fp $expect_out
(1,string
)
585 #
-re
".*" { fail "print FP register"}
586 timeout
{ fail
"print FP register (timeout)"}
589 set line_incr_a_b_a
[gdb_get_line_number
"b = a;"]
591 mi_gdb_test
"200-break-insert incr_a" \
592 "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"$line_incr_a_b_a\",times=\"0\"\}" \
593 "break-insert operation"
594 send_gdb
"-exec-continue\n"
596 -re
"\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"2\.*\"\}\\\],file=\".*var-cmd.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_incr_a_b_a\"\}\r\n$mi_gdb_prompt$" {
597 pass
"continue to incr_a"
599 -re
"\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"([expr $line_incr_a_b_a - 2]|[expr $line_incr_a_b_a - 1]|$line_incr_a_b_a)\"\}\r\n$mi_gdb_prompt$" {
600 fail
"continue to incr_a (compiler debug info incorrect)"
602 -re
"\\^running\r\n${mi_gdb_prompt}.*\r\n$mi_gdb_prompt$" {
603 fail
"continue to incr_a (unknown output)"
606 fail
"continue to incr_a (timeout)"
610 # Test
: c_variable
-7.81
611 # Desc
: Create variables in different scopes
612 mi_gdb_test
"-var-create a1 * a" \
613 "\\^done,name=\"a1\",numchild=\"0\",type=\"char\"" \
614 "create local variable a1"
616 mi_gdb_test
"-var-create a2 $fp a" \
617 "\\^done,name=\"a2\",numchild=\"0\",type=\"int\"" \
618 "create variable a2 in different scope"
620 #gdbtk_test c_variable
-7.81 {create variables in different scopes
} {
621 #
set a1
[gdb_variable create
-expr a
]
622 #
set a2
[gdb_variable create
-expr a
-frame $fp
]
625 # lappend vals
[$a1 value
]
626 # lappend vals
[$a2 value
]