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