1 |
330 |
jeremybenn |
# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2004, 2007, 2008, 2009, 2010
|
2 |
|
|
# Free Software Foundation, Inc.
|
3 |
|
|
#
|
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 3 of the License, or
|
7 |
|
|
# (at your option) any later version.
|
8 |
|
|
#
|
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.
|
13 |
|
|
#
|
14 |
|
|
# You should have received a copy of the GNU General Public License
|
15 |
|
|
# along with this program. If not, see .
|
16 |
|
|
|
17 |
|
|
# Test essential Machine interface (MI) operations
|
18 |
|
|
#
|
19 |
|
|
# Verify that, using the MI, we can create, update, delete variables.
|
20 |
|
|
#
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
load_lib mi-support.exp
|
24 |
|
|
set MIFLAGS "-i=mi2"
|
25 |
|
|
|
26 |
|
|
gdb_exit
|
27 |
|
|
if [mi_gdb_start] {
|
28 |
|
|
continue
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
set testfile "var-cmd"
|
32 |
|
|
set srcfile ${testfile}.c
|
33 |
|
|
set binfile ${objdir}/${subdir}/mi2-var-cmd
|
34 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
35 |
|
|
untested mi2-var-cmd.exp
|
36 |
|
|
return -1
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
mi_delete_breakpoints
|
40 |
|
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
41 |
|
|
mi_gdb_load ${binfile}
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
##### #####
|
45 |
|
|
# #
|
46 |
|
|
# Variable Creation tests #
|
47 |
|
|
# #
|
48 |
|
|
##### #####
|
49 |
|
|
|
50 |
|
|
# Test: c_variable-1.1
|
51 |
|
|
# Desc: Create global variable
|
52 |
|
|
|
53 |
|
|
mi_create_varobj "global_simple" "global_simple" "create global variable"
|
54 |
|
|
|
55 |
|
|
# Test: c_variable-1.2
|
56 |
|
|
# Desc: Create non-existent variable
|
57 |
|
|
|
58 |
|
|
mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \
|
59 |
|
|
"112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
60 |
|
|
"create non-existent variable"
|
61 |
|
|
|
62 |
|
|
# Test: c_variable-1.3
|
63 |
|
|
# Desc: Create out of scope variable
|
64 |
|
|
|
65 |
|
|
mi_gdb_test "113-var-create argc * argc" \
|
66 |
|
|
"113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
67 |
|
|
"create out of scope variable"
|
68 |
|
|
|
69 |
|
|
mi_runto do_locals_tests
|
70 |
|
|
|
71 |
|
|
set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"]
|
72 |
|
|
|
73 |
|
|
mi_continue_to_line $line_dlt_first_real "step to real start of do_locals_test"
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
# Test: c_variable-1.4
|
77 |
|
|
# Desc: create local variables
|
78 |
|
|
|
79 |
|
|
mi_create_varobj_checked linteger linteger int "create local variable linteger"
|
80 |
|
|
|
81 |
|
|
mi_create_varobj_checked lpinteger lpinteger {int \*} "create local variable lpinteger"
|
82 |
|
|
|
83 |
|
|
mi_create_varobj_checked lcharacter lcharacter\[0\] char "create local variable lcharacter"
|
84 |
|
|
|
85 |
|
|
mi_create_varobj_checked lpcharacter lpcharacter {char \*} "create local variable lpcharacter"
|
86 |
|
|
|
87 |
|
|
mi_create_varobj_checked llong llong "long int" "create local variable llong"
|
88 |
|
|
|
89 |
|
|
mi_create_varobj_checked lplong lplong {long int \*} "create local variable lplong"
|
90 |
|
|
|
91 |
|
|
mi_create_varobj_checked lfloat lfloat float "create local variable lfloat"
|
92 |
|
|
|
93 |
|
|
mi_create_varobj_checked lpfloat lpfloat {float \*} "create local variable lpfloat"
|
94 |
|
|
|
95 |
|
|
mi_create_varobj_checked ldouble ldouble double "create local variable ldouble"
|
96 |
|
|
|
97 |
|
|
mi_create_varobj_checked lpdouble lpdouble {double \*} "create local variable lpdouble"
|
98 |
|
|
|
99 |
|
|
mi_create_varobj_checked lsimple lsimple "struct _simple_struct" "create local variable lsimple"
|
100 |
|
|
|
101 |
|
|
mi_create_varobj_checked lpsimple lpsimple {struct _simple_struct \*} "create local variable lpsimple"
|
102 |
|
|
|
103 |
|
|
mi_create_varobj_checked func func {void \(\*\)\((void|)\)} "create local variable func"
|
104 |
|
|
|
105 |
|
|
# Test: c_variable-1.5
|
106 |
|
|
# Desc: create lsimple.character
|
107 |
|
|
mi_create_varobj_checked lsimple.character lsimple.character "char" \
|
108 |
|
|
"create lsimple.character"
|
109 |
|
|
|
110 |
|
|
# Test: c_variable-1.6
|
111 |
|
|
# Desc: create lpsimple->integer
|
112 |
|
|
mi_create_varobj_checked lsimple->integer lsimple->integer "int" \
|
113 |
|
|
"create lsimple->integer"
|
114 |
|
|
|
115 |
|
|
# Test: c_variable-1.7
|
116 |
|
|
# Desc: crate lsimple.integer
|
117 |
|
|
mi_create_varobj_checked lsimple.integer lsimple.integer "int" \
|
118 |
|
|
"create lsimple.integer"
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
# Test: c_variable-1.9
|
122 |
|
|
# Desc: create type name
|
123 |
|
|
# Type names (like int, long, etc..) are all proper expressions to gdb.
|
124 |
|
|
# make sure variable code does not allow users to create variables, though.
|
125 |
|
|
mi_gdb_test "-var-create int * int" \
|
126 |
|
|
"&\"Attempt to use a type name as an expression.\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
127 |
|
|
"create int"
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
##### #####
|
131 |
|
|
# #
|
132 |
|
|
# Value changed tests #
|
133 |
|
|
# #
|
134 |
|
|
##### #####
|
135 |
|
|
|
136 |
|
|
# Test: c_variable-2.1
|
137 |
|
|
# Desc: check whether values changed at do_block_tests
|
138 |
|
|
mi_gdb_test "-var-update *" \
|
139 |
|
|
"\\^done,changelist=\\\[\\\]" \
|
140 |
|
|
"update all vars"
|
141 |
|
|
|
142 |
|
|
# Step over "linteger = 1234;"
|
143 |
|
|
set line_dlt_linteger [gdb_get_line_number "lpinteger = &linteger;"]
|
144 |
|
|
mi_step_to "do_locals_tests" "" "var-cmd.c" $line_dlt_linteger "step at do_locals_test"
|
145 |
|
|
|
146 |
|
|
# Test: c_variable-2.2
|
147 |
|
|
# Desc: check whether only linteger changed values
|
148 |
|
|
mi_gdb_test "-var-update *" \
|
149 |
|
|
"\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
150 |
|
|
"update all vars: linteger changed"
|
151 |
|
|
|
152 |
|
|
# Step over "lpinteger = &linteger;"
|
153 |
|
|
mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests (2)"
|
154 |
|
|
|
155 |
|
|
# Test: c_variable-2.3
|
156 |
|
|
# Desc: check whether only lpinteger changed
|
157 |
|
|
mi_gdb_test "-var-update *" \
|
158 |
|
|
"\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
159 |
|
|
"update all vars: lpinteger changed"
|
160 |
|
|
|
161 |
|
|
# Step over "lcharacter = 'a';"
|
162 |
|
|
mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests (3)"
|
163 |
|
|
|
164 |
|
|
# Test: c_variable-2.4
|
165 |
|
|
# Desc: check whether only lcharacter changed
|
166 |
|
|
mi_gdb_test "-var-update *" \
|
167 |
|
|
"\\^done,changelist=\\\[\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
168 |
|
|
"update all vars: lcharacter changed"
|
169 |
|
|
|
170 |
|
|
# Step over "lpcharacter = &lcharacter;"
|
171 |
|
|
mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests (4)"
|
172 |
|
|
|
173 |
|
|
# Test: c_variable-2.5
|
174 |
|
|
# Desc: check whether only lpcharacter changed
|
175 |
|
|
mi_gdb_test "-var-update *" \
|
176 |
|
|
"\\^done,changelist=\\\[\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
177 |
|
|
"update all vars: lpcharacter changed"
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
# Step over:
|
181 |
|
|
# llong = 2121L;
|
182 |
|
|
# lplong = &llong;
|
183 |
|
|
# lfloat = 2.1;
|
184 |
|
|
# lpfloat = &lfloat;
|
185 |
|
|
# ldouble = 2.718281828459045;
|
186 |
|
|
# lpdouble = &ldouble;
|
187 |
|
|
# lsimple.integer = 1234;
|
188 |
|
|
# lsimple.unsigned_integer = 255;
|
189 |
|
|
# lsimple.character = 'a';
|
190 |
|
|
|
191 |
|
|
mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
|
192 |
|
|
"var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests (5)"
|
193 |
|
|
|
194 |
|
|
# Test: c_variable-2.6
|
195 |
|
|
# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
|
196 |
|
|
# lsimple.unsigned_character lsimple.integer lsimple.character changed
|
197 |
|
|
mi_gdb_test "-var-update *" \
|
198 |
|
|
"\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpdouble\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpfloat\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lplong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
199 |
|
|
"update all vars: many changed"
|
200 |
|
|
|
201 |
|
|
# Step over:
|
202 |
|
|
# lsimple.signed_character = 21;
|
203 |
|
|
# lsimple.char_ptr = &lcharacter;
|
204 |
|
|
# lpsimple = &lsimple;
|
205 |
|
|
# func = nothing;
|
206 |
|
|
|
207 |
|
|
set line_dlt_4321 [gdb_get_line_number "linteger = 4321;"]
|
208 |
|
|
|
209 |
|
|
mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
|
210 |
|
|
"var-cmd.c" $line_dlt_4321 "" "step at do_locals_tests (6)"
|
211 |
|
|
|
212 |
|
|
# Test: c_variable-2.7
|
213 |
|
|
# Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed
|
214 |
|
|
mi_gdb_test "-var-update *" \
|
215 |
|
|
"\\^done,changelist=\\\[\{name=\"func\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpsimple\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
216 |
|
|
"update all vars: func and lpsimple changed"
|
217 |
|
|
|
218 |
|
|
# Step over
|
219 |
|
|
# linteger = 4321;
|
220 |
|
|
# lcharacter = 'b';
|
221 |
|
|
# llong = 1212L;
|
222 |
|
|
# lfloat = 1.2;
|
223 |
|
|
# ldouble = 5.498548281828172;
|
224 |
|
|
# lsimple.integer = 255;
|
225 |
|
|
# lsimple.unsigned_integer = 4321;
|
226 |
|
|
# lsimple.character = 'b';
|
227 |
|
|
|
228 |
|
|
mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
|
229 |
|
|
"var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests (7)"
|
230 |
|
|
|
231 |
|
|
# Test: c_variable-2.8
|
232 |
|
|
# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
|
233 |
|
|
# lpsimple.integer lsimple.character changed
|
234 |
|
|
# Note: this test also checks that lpsimple->integer and lsimple.integer have
|
235 |
|
|
# changed (they are the same)
|
236 |
|
|
mi_gdb_test "-var-update *" \
|
237 |
|
|
"\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
238 |
|
|
"update all vars: lsimple and others changed"
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
###
|
242 |
|
|
#
|
243 |
|
|
# Test assignment to variables. More tests on assignment are in other files.
|
244 |
|
|
#
|
245 |
|
|
###
|
246 |
|
|
mi_gdb_test "-var-assign global_simple 0" \
|
247 |
|
|
"\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \
|
248 |
|
|
"assign to global_simple"
|
249 |
|
|
|
250 |
|
|
mi_gdb_test "-var-assign linteger 3333" \
|
251 |
|
|
"\\^done,value=\"3333\"" \
|
252 |
|
|
"assign to linteger"
|
253 |
|
|
|
254 |
|
|
# Allow lpcharacter to update, optionally. Because it points to a
|
255 |
|
|
# char variable instead of a zero-terminated string, if linteger is
|
256 |
|
|
# directly after it in memory the printed characters may appear to
|
257 |
|
|
# change.
|
258 |
|
|
set lpchar_update "\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\},"
|
259 |
|
|
mi_gdb_test "-var-update *" \
|
260 |
|
|
"\\^done,changelist=\\\[($lpchar_update)?\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
261 |
|
|
"update all vars: linteger changed after assign"
|
262 |
|
|
|
263 |
|
|
mi_gdb_test "-var-assign linteger 3333" \
|
264 |
|
|
"\\^done,value=\"3333\"" \
|
265 |
|
|
"assign to linteger again, same value"
|
266 |
|
|
|
267 |
|
|
mi_gdb_test "-var-update *" \
|
268 |
|
|
"\\^done,changelist=\\\[\\\]" \
|
269 |
|
|
"update all vars: linteger not changed after same assign"
|
270 |
|
|
|
271 |
|
|
mi_gdb_test "-var-evaluate-expression linteger" \
|
272 |
|
|
"\\^done,value=\"3333\"" \
|
273 |
|
|
"eval linteger"
|
274 |
|
|
|
275 |
|
|
mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \
|
276 |
|
|
"\\^done,value=\"$hex\"" \
|
277 |
|
|
"assign to lpinteger"
|
278 |
|
|
|
279 |
|
|
mi_gdb_test "-var-update *" \
|
280 |
|
|
"\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
281 |
|
|
"update all vars: lpinteger changed after assign"
|
282 |
|
|
|
283 |
|
|
mi_gdb_test "-var-update *" \
|
284 |
|
|
"\\^done,changelist=\\\[\\\]" \
|
285 |
|
|
"update all vars: no changes on second update"
|
286 |
|
|
|
287 |
|
|
mi_gdb_test "-var-evaluate-expression lpinteger" \
|
288 |
|
|
"\\^done,value=\"$hex\"" \
|
289 |
|
|
"eval lpinteger"
|
290 |
|
|
|
291 |
|
|
# reset the values to the original ones so that the rest of the file doesn't suffer.
|
292 |
|
|
|
293 |
|
|
mi_gdb_test "-var-assign linteger 4321" \
|
294 |
|
|
"\\^done,value=\"4321\"" \
|
295 |
|
|
"assign to linteger"
|
296 |
|
|
|
297 |
|
|
mi_gdb_test "-var-assign lpinteger &linteger" \
|
298 |
|
|
"\\^done,value=\"$hex\"" \
|
299 |
|
|
"assign to lpinteger"
|
300 |
|
|
|
301 |
|
|
mi_gdb_test "-var-assign lcharacter 'z'" \
|
302 |
|
|
"\\^done,value=\"122 'z'\"" \
|
303 |
|
|
"assign to lcharacter"
|
304 |
|
|
|
305 |
|
|
mi_gdb_test "-var-evaluate-expression lcharacter" \
|
306 |
|
|
"\\^done,value=\"122 'z'\"" \
|
307 |
|
|
"eval lcharacter"
|
308 |
|
|
|
309 |
|
|
mi_gdb_test "-var-assign llong 1313L" \
|
310 |
|
|
"\\^done,value=\"1313\"" \
|
311 |
|
|
"assign to llong"
|
312 |
|
|
mi_gdb_test "-var-evaluate-expression llong" \
|
313 |
|
|
"\\^done,value=\"1313\"" \
|
314 |
|
|
"eval llong"
|
315 |
|
|
mi_gdb_test "-var-assign llong 1212L" \
|
316 |
|
|
"\\^done,value=\"1212\"" \
|
317 |
|
|
"assign to llong"
|
318 |
|
|
|
319 |
|
|
mi_gdb_test "-var-assign lplong &llong+4" \
|
320 |
|
|
"\\^done,value=\"$hex\"" \
|
321 |
|
|
"assign to lplong"
|
322 |
|
|
mi_gdb_test "-var-evaluate-expression lplong" \
|
323 |
|
|
"\\^done,value=\"$hex\"" \
|
324 |
|
|
"eval lplong"
|
325 |
|
|
mi_gdb_test "-var-assign lplong &llong" \
|
326 |
|
|
"\\^done,value=\"$hex\"" \
|
327 |
|
|
"assign to lplong"
|
328 |
|
|
|
329 |
|
|
mi_gdb_test "-var-assign lfloat 3.4567" \
|
330 |
|
|
"\\^done,value=\"3.45.*\"" \
|
331 |
|
|
"assign to lfloat"
|
332 |
|
|
mi_gdb_test "-var-evaluate-expression lfloat" \
|
333 |
|
|
"\\^done,value=\"3.45.*\"" \
|
334 |
|
|
"eval lfloat"
|
335 |
|
|
mi_gdb_test "-var-assign lfloat 1.2345" \
|
336 |
|
|
"\\^done,value=\"1.23.*\"" \
|
337 |
|
|
"assign to lfloat"
|
338 |
|
|
|
339 |
|
|
mi_gdb_test "-var-assign lpfloat &lfloat+4" \
|
340 |
|
|
"\\^done,value=\"$hex\"" \
|
341 |
|
|
"assign to lpfloat"
|
342 |
|
|
|
343 |
|
|
mi_gdb_test "-var-assign ldouble 5.333318284590435" \
|
344 |
|
|
"\\^done,value=\"5.333318284590435\"" \
|
345 |
|
|
"assign to ldouble"
|
346 |
|
|
|
347 |
|
|
mi_gdb_test "-var-assign func do_block_tests" \
|
348 |
|
|
"\\^done,value=\"$hex \"" \
|
349 |
|
|
"assign to func"
|
350 |
|
|
|
351 |
|
|
mi_gdb_test "-var-assign lsimple.character 'd'" \
|
352 |
|
|
"\\^done,value=\"100 'd'\"" \
|
353 |
|
|
"assign to lsimple.character"
|
354 |
|
|
|
355 |
|
|
mi_gdb_test "-var-assign lsimple->integer 222" \
|
356 |
|
|
"\\^done,value=\"222\"" \
|
357 |
|
|
"assign to lsimple->integer"
|
358 |
|
|
|
359 |
|
|
mi_gdb_test "-var-assign lsimple.integer 333" \
|
360 |
|
|
"\\^done,value=\"333\"" \
|
361 |
|
|
"assign to lsimple.integer"
|
362 |
|
|
|
363 |
|
|
######
|
364 |
|
|
# End of assign tests
|
365 |
|
|
#####
|
366 |
|
|
|
367 |
|
|
set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"]
|
368 |
|
|
|
369 |
|
|
mi_continue_to "subroutine1"
|
370 |
|
|
|
371 |
|
|
# Test: c_variable-2.10
|
372 |
|
|
# Desc: create variable for locals i,l in subroutine1
|
373 |
|
|
mi_create_varobj_checked i i int "create i"
|
374 |
|
|
|
375 |
|
|
mi_create_varobj_checked l l {long int \*} "create l"
|
376 |
|
|
|
377 |
|
|
# Test: c_variable-2.11
|
378 |
|
|
# Desc: create do_locals_tests local in subroutine1
|
379 |
|
|
mi_gdb_test "-var-create linteger * linteger" \
|
380 |
|
|
"\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
381 |
|
|
"create linteger"
|
382 |
|
|
|
383 |
|
|
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
|
384 |
|
|
"var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1"
|
385 |
|
|
|
386 |
|
|
# Test: c_variable-2.12
|
387 |
|
|
# Desc: change global_simple.integer
|
388 |
|
|
# Note: This also tests whether we are reporting changes in structs properly.
|
389 |
|
|
# gdb normally would say that global_simple has changed, but we
|
390 |
|
|
# special case that, since it is not what a human expects to
|
391 |
|
|
# see.
|
392 |
|
|
|
393 |
|
|
setup_xfail *-*-*
|
394 |
|
|
mi_gdb_test "-var-update *" \
|
395 |
|
|
"\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \
|
396 |
|
|
"update all vars: changed FIXME"
|
397 |
|
|
clear_xfail *-*-*
|
398 |
|
|
|
399 |
|
|
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
|
400 |
|
|
"var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)"
|
401 |
|
|
|
402 |
|
|
# Test: c_variable-2.13
|
403 |
|
|
# Desc: change subroutine1 local i
|
404 |
|
|
mi_gdb_test "-var-update *" \
|
405 |
|
|
"\\^done,changelist=\\\[\{name=\"i\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
406 |
|
|
"update all vars: i changed"
|
407 |
|
|
|
408 |
|
|
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
|
409 |
|
|
"var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)"
|
410 |
|
|
|
411 |
|
|
# Test: c_variable-2.14
|
412 |
|
|
# Desc: change do_locals_tests local llong
|
413 |
|
|
mi_gdb_test "-var-update *" \
|
414 |
|
|
"\\^done,changelist=\\\[\{name=\"llong\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
415 |
|
|
"update all vars: llong changed"
|
416 |
|
|
|
417 |
|
|
set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"]
|
418 |
|
|
mi_next_to "do_locals_tests" "" "var-cmd.c" \
|
419 |
|
|
[expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1"
|
420 |
|
|
|
421 |
|
|
# Test: c_variable-2.15
|
422 |
|
|
# Desc: check for out of scope subroutine1 locals
|
423 |
|
|
mi_gdb_test "-var-update *" \
|
424 |
|
|
"\\^done,changelist=\\\[\{name=\"l\",in_scope=\"false\"\,type_changed=\"false\",has_more=\"0\"},\{name=\"i\",in_scope=\"false\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
|
425 |
|
|
"update all vars: all now out of scope"
|
426 |
|
|
|
427 |
|
|
# Done with locals/globals tests. Erase all variables
|
428 |
|
|
#delete_all_variables
|
429 |
|
|
mi_gdb_test "-var-delete global_simple" \
|
430 |
|
|
"\\^done,ndeleted=\"1\"" \
|
431 |
|
|
"delete var"
|
432 |
|
|
|
433 |
|
|
mi_gdb_test "-var-delete linteger" \
|
434 |
|
|
"\\^done,ndeleted=\"1\"" \
|
435 |
|
|
"delete var linteger"
|
436 |
|
|
|
437 |
|
|
mi_gdb_test "-var-delete lpinteger" \
|
438 |
|
|
"\\^done,ndeleted=\"1\"" \
|
439 |
|
|
"delete var lpinteger"
|
440 |
|
|
|
441 |
|
|
mi_gdb_test "-var-delete lcharacter" \
|
442 |
|
|
"\\^done,ndeleted=\"1\"" \
|
443 |
|
|
"delete var lcharacter"
|
444 |
|
|
|
445 |
|
|
mi_gdb_test "-var-delete lpcharacter" \
|
446 |
|
|
"\\^done,ndeleted=\"1\"" \
|
447 |
|
|
"delete var lpcharacter"
|
448 |
|
|
|
449 |
|
|
mi_gdb_test "-var-delete llong" \
|
450 |
|
|
"\\^done,ndeleted=\"1\"" \
|
451 |
|
|
"delete var llong"
|
452 |
|
|
|
453 |
|
|
mi_gdb_test "-var-delete lplong" \
|
454 |
|
|
"\\^done,ndeleted=\"1\"" \
|
455 |
|
|
"delete var lplong"
|
456 |
|
|
|
457 |
|
|
mi_gdb_test "-var-delete lfloat" \
|
458 |
|
|
"\\^done,ndeleted=\"1\"" \
|
459 |
|
|
"delete var lfloat"
|
460 |
|
|
|
461 |
|
|
mi_gdb_test "-var-delete lpfloat" \
|
462 |
|
|
"\\^done,ndeleted=\"1\"" \
|
463 |
|
|
"delete var lpfloat"
|
464 |
|
|
|
465 |
|
|
mi_gdb_test "-var-delete ldouble" \
|
466 |
|
|
"\\^done,ndeleted=\"1\"" \
|
467 |
|
|
"delete var ldouble"
|
468 |
|
|
|
469 |
|
|
mi_gdb_test "-var-delete lpdouble" \
|
470 |
|
|
"\\^done,ndeleted=\"1\"" \
|
471 |
|
|
"delete var lpdouble"
|
472 |
|
|
|
473 |
|
|
mi_gdb_test "-var-delete lsimple" \
|
474 |
|
|
"\\^done,ndeleted=\"1\"" \
|
475 |
|
|
"delete var lsimple"
|
476 |
|
|
|
477 |
|
|
mi_gdb_test "-var-delete lpsimple" \
|
478 |
|
|
"\\^done,ndeleted=\"1\"" \
|
479 |
|
|
"delete var lpsimple"
|
480 |
|
|
|
481 |
|
|
mi_gdb_test "-var-delete func" \
|
482 |
|
|
"\\^done,ndeleted=\"1\"" \
|
483 |
|
|
"delete var func"
|
484 |
|
|
|
485 |
|
|
mi_gdb_test "-var-delete lsimple.character" \
|
486 |
|
|
"\\^done,ndeleted=\"1\"" \
|
487 |
|
|
"delete var lsimple.character"
|
488 |
|
|
|
489 |
|
|
mi_gdb_test "-var-delete lsimple->integer" \
|
490 |
|
|
"\\^done,ndeleted=\"1\"" \
|
491 |
|
|
"delete var lsimple->integer"
|
492 |
|
|
|
493 |
|
|
mi_gdb_test "-var-delete lsimple.integer" \
|
494 |
|
|
"\\^done,ndeleted=\"1\"" \
|
495 |
|
|
"delete var lsimple.integer"
|
496 |
|
|
|
497 |
|
|
mi_gdb_test "-var-delete i" \
|
498 |
|
|
"\\^done,ndeleted=\"1\"" \
|
499 |
|
|
"delete var i"
|
500 |
|
|
|
501 |
|
|
mi_gdb_test "-var-delete l" \
|
502 |
|
|
"\\^done,ndeleted=\"1\"" \
|
503 |
|
|
"delete var l"
|
504 |
|
|
|
505 |
|
|
# Test whether we can follow the name of a variable through multiple
|
506 |
|
|
# stack frames.
|
507 |
|
|
mi_continue_to do_special_tests
|
508 |
|
|
|
509 |
|
|
mi_gdb_test "-var-create selected_a @ a" \
|
510 |
|
|
{\^done,name="selected_a",numchild="0",value=".*",type="int".*} \
|
511 |
|
|
"create selected_a"
|
512 |
|
|
|
513 |
|
|
mi_continue_to incr_a
|
514 |
|
|
|
515 |
|
|
mi_gdb_test "-var-update selected_a" \
|
516 |
|
|
"\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"char\",new_num_children=\"0\"\,has_more=\"0\"}\\\]" \
|
517 |
|
|
"update selected_a in incr_a"
|
518 |
|
|
|
519 |
|
|
mi_next "step a line in incr_a"
|
520 |
|
|
mi_next "return from incr_a to do_special_tests"
|
521 |
|
|
|
522 |
|
|
mi_gdb_test "-var-update selected_a" \
|
523 |
|
|
"\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"int\",new_num_children=\"0\",has_more=\"0\"\}\\\]" \
|
524 |
|
|
"update selected_a in do_special_tests"
|
525 |
|
|
|
526 |
|
|
mi_gdb_test "-file-exec-and-symbols ${binfile}" "\\^done" \
|
527 |
|
|
"floating varobj invalidation"
|
528 |
|
|
|
529 |
|
|
|
530 |
|
|
mi_gdb_exit
|
531 |
|
|
return 0
|