1 |
106 |
markom |
# Copyright (C) 1999 2000 Cygnus Solutions
|
2 |
|
|
#
|
3 |
|
|
# This Program Is Free software; you can redistribute it and/or modify
|
4 |
|
|
# it under the terms of the GNU General Public License as published by
|
5 |
|
|
# the Free Software Foundation; either version 2 of the License, or
|
6 |
|
|
# (at your option) any later version.
|
7 |
|
|
#
|
8 |
|
|
# This program is distributed in the hope that it will be useful,
|
9 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11 |
|
|
# GNU General Public License for more details.
|
12 |
|
|
#
|
13 |
|
|
# You should have received a copy of the GNU General Public License
|
14 |
|
|
# along with this program; if not, write to the Free Software
|
15 |
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
16 |
|
|
|
17 |
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
18 |
|
|
# bug-gdb@prep.ai.mit.edu
|
19 |
|
|
|
20 |
|
|
# Test essential Machine interface (MI) operations
|
21 |
|
|
#
|
22 |
|
|
# Verify that, using the MI, we can create, update, delete variables.
|
23 |
|
|
#
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
load_lib mi-support.exp
|
27 |
|
|
|
28 |
|
|
gdb_exit
|
29 |
|
|
if [mi_gdb_start] {
|
30 |
|
|
continue
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
set testfile "var-cmd"
|
34 |
|
|
set srcfile ${testfile}.c
|
35 |
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
36 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
37 |
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
mi_delete_breakpoints
|
41 |
|
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
42 |
|
|
mi_gdb_load ${binfile}
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
##### #####
|
46 |
|
|
# #
|
47 |
|
|
# Variable Creation tests #
|
48 |
|
|
# #
|
49 |
|
|
##### #####
|
50 |
|
|
|
51 |
|
|
# Test: c_variable-1.1
|
52 |
|
|
# Desc: Create global variable
|
53 |
|
|
|
54 |
|
|
mi_gdb_test "111-var-create global_simple * global_simple" \
|
55 |
|
|
"111\\^done,name=\"global_simple\",numchild=\"6\",type=\"simpleton\"" \
|
56 |
|
|
"create global variable"
|
57 |
|
|
|
58 |
|
|
# Test: c_variable-1.2
|
59 |
|
|
# Desc: Create non-existent variable
|
60 |
|
|
|
61 |
|
|
mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \
|
62 |
|
|
"&\"mi_cmd_var_create: unable to create variable object\\\\n\".*112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
63 |
|
|
"create non-existent variable"
|
64 |
|
|
|
65 |
|
|
# Test: c_variable-1.3
|
66 |
|
|
# Desc: Create out of scope variable
|
67 |
|
|
|
68 |
|
|
mi_gdb_test "113-var-create argc * argc" \
|
69 |
|
|
"&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
70 |
|
|
"create out of scope variable"
|
71 |
|
|
|
72 |
|
|
mi_gdb_test "200-break-insert do_locals_tests" \
|
73 |
|
|
"200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_locals_tests\",file=\".*var-cmd.c\",line=\"106\",times=\"0\"\}" \
|
74 |
|
|
"break-insert operation"
|
75 |
|
|
|
76 |
|
|
mi_run_cmd
|
77 |
|
|
# The running part has been checked already by mi_run_cmd
|
78 |
|
|
gdb_expect {
|
79 |
|
|
-re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"106\"\}\r\n$mi_gdb_prompt$" {
|
80 |
|
|
pass "run to do_locals_tests"
|
81 |
|
|
}
|
82 |
|
|
-re ".*$mi_gdb_prompt$" {fail "run todo_locals_tests (2)"}
|
83 |
|
|
timeout {fail "run to do_locals_tests (timeout 2)"}
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
# Test: c_variable-1.4
|
87 |
|
|
# Desc: create local variables
|
88 |
|
|
|
89 |
|
|
mi_gdb_test "-var-create linteger * linteger" \
|
90 |
|
|
"\\^done,name=\"linteger\",numchild=\"0\",type=\"int\"" \
|
91 |
|
|
"create local variable linteger"
|
92 |
|
|
|
93 |
|
|
mi_gdb_test "-var-create lpinteger * lpinteger" \
|
94 |
|
|
"\\^done,name=\"lpinteger\",numchild=\"1\",type=\"int \\*\"" \
|
95 |
|
|
"create local variable lpinteger"
|
96 |
|
|
|
97 |
|
|
mi_gdb_test "-var-create lcharacter * lcharacter" \
|
98 |
|
|
"\\^done,name=\"lcharacter\",numchild=\"0\",type=\"char\"" \
|
99 |
|
|
"create local variablelcharacter "
|
100 |
|
|
|
101 |
|
|
mi_gdb_test "-var-create lpcharacter * lpcharacter" \
|
102 |
|
|
"\\^done,name=\"lpcharacter\",numchild=\"0\",type=\"char \\*\"" \
|
103 |
|
|
"create local variable lpcharacter"
|
104 |
|
|
|
105 |
|
|
mi_gdb_test "-var-create llong * llong" \
|
106 |
|
|
"\\^done,name=\"llong\",numchild=\"0\",type=\"long int\"" \
|
107 |
|
|
"create local variable llong"
|
108 |
|
|
|
109 |
|
|
mi_gdb_test "-var-create lplong * lplong" \
|
110 |
|
|
"\\^done,name=\"lplong\",numchild=\"1\",type=\"long int \\*\"" \
|
111 |
|
|
"create local variable lplong"
|
112 |
|
|
|
113 |
|
|
mi_gdb_test "-var-create lfloat * lfloat" \
|
114 |
|
|
"\\^done,name=\"lfloat\",numchild=\"0\",type=\"float\"" \
|
115 |
|
|
"create local variable lfloat"
|
116 |
|
|
|
117 |
|
|
mi_gdb_test "-var-create lpfloat * lpfloat" \
|
118 |
|
|
"\\^done,name=\"lpfloat\",numchild=\"1\",type=\"float \\*\"" \
|
119 |
|
|
"create local variable lpfloat"
|
120 |
|
|
|
121 |
|
|
mi_gdb_test "-var-create ldouble * ldouble" \
|
122 |
|
|
"\\^done,name=\"ldouble\",numchild=\"0\",type=\"double\"" \
|
123 |
|
|
"create local variable ldouble"
|
124 |
|
|
|
125 |
|
|
mi_gdb_test "-var-create lpdouble * lpdouble" \
|
126 |
|
|
"\\^done,name=\"lpdouble\",numchild=\"1\",type=\"double \\*\"" \
|
127 |
|
|
"create local variable lpdouble"
|
128 |
|
|
|
129 |
|
|
mi_gdb_test "-var-create lsimple * lsimple" \
|
130 |
|
|
"\\^done,name=\"lsimple\",numchild=\"6\",type=\"struct _simple_struct\"" \
|
131 |
|
|
"create local variable lsimple"
|
132 |
|
|
|
133 |
|
|
mi_gdb_test "-var-create lpsimple * lpsimple" \
|
134 |
|
|
"\\^done,name=\"lpsimple\",numchild=\"6\",type=\"struct _simple_struct \\*\"" \
|
135 |
|
|
"create local variable lpsimple"
|
136 |
|
|
|
137 |
|
|
mi_gdb_test "-var-create func * func" \
|
138 |
|
|
"\\^done,name=\"func\",numchild=\"0\",type=\"void \\(\\*\\)\\(\\)\"" \
|
139 |
|
|
"create local variable func"
|
140 |
|
|
|
141 |
|
|
# Test: c_variable-1.5
|
142 |
|
|
# Desc: create lsimple.character
|
143 |
|
|
mi_gdb_test "-var-create lsimple.character * lsimple.character" \
|
144 |
|
|
"\\^done,name=\"lsimple.character\",numchild=\"0\",type=\"char\"" \
|
145 |
|
|
"create lsimple.character"
|
146 |
|
|
|
147 |
|
|
# Test: c_variable-1.6
|
148 |
|
|
# Desc: create lpsimple->integer
|
149 |
|
|
mi_gdb_test "-var-create lsimple->integer * lsimple->integer" \
|
150 |
|
|
"\\^done,name=\"lsimple->integer\",numchild=\"0\",type=\"int\"" \
|
151 |
|
|
"create lsimple->integer"
|
152 |
|
|
|
153 |
|
|
# Test: c_variable-1.7
|
154 |
|
|
# Desc: ceate lsimple.integer
|
155 |
|
|
mi_gdb_test "-var-create lsimple.integer * lsimple.integer" \
|
156 |
|
|
"\\^done,name=\"lsimple.integer\",numchild=\"0\",type=\"int\"" \
|
157 |
|
|
"create lsimple->integer"
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
# Test: c_variable-1.9
|
161 |
|
|
# Desc: create type name
|
162 |
|
|
# Type names (like int, long, etc..) are all proper expressions to gdb.
|
163 |
|
|
# make sure variable code does not allow users to create variables, though.
|
164 |
|
|
mi_gdb_test "-var-create int * int" \
|
165 |
|
|
"&\"Attempt to use a type name as an expression.mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
166 |
|
|
"create int"
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
##### #####
|
170 |
|
|
# #
|
171 |
|
|
# Value changed tests #
|
172 |
|
|
# #
|
173 |
|
|
##### #####
|
174 |
|
|
|
175 |
|
|
# Test: c_variable-2.1
|
176 |
|
|
# Desc: check whether values changed at do_block_tests
|
177 |
|
|
mi_gdb_test "-var-update *" \
|
178 |
|
|
"\\^done,changelist=\{\}" \
|
179 |
|
|
"update all vars"
|
180 |
|
|
|
181 |
|
|
# Step over "linteger = 1234;"
|
182 |
|
|
send_gdb "-exec-step\n"
|
183 |
|
|
gdb_expect {
|
184 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"107\"\}\r\n$mi_gdb_prompt$" {
|
185 |
|
|
pass "step at do_locals_tests"
|
186 |
|
|
}
|
187 |
|
|
timeout {
|
188 |
|
|
fail "step at do_locals_tests (timeout)"
|
189 |
|
|
}
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
# Test: c_variable-2.2
|
193 |
|
|
# Desc: check whether only linteger changed values
|
194 |
|
|
mi_gdb_test "-var-update *" \
|
195 |
|
|
"\\^done,changelist=\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \
|
196 |
|
|
"update all vars: linteger changed"
|
197 |
|
|
|
198 |
|
|
# Step over "lpinteger = &linteger;"
|
199 |
|
|
send_gdb "-exec-step\n"
|
200 |
|
|
gdb_expect {
|
201 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"108\"\}\r\n$mi_gdb_prompt$" {
|
202 |
|
|
pass "step at do_locals_tests"
|
203 |
|
|
}
|
204 |
|
|
timeout {
|
205 |
|
|
fail "step at do_locals_tests (timeout)"
|
206 |
|
|
}
|
207 |
|
|
}
|
208 |
|
|
|
209 |
|
|
# Test: c_variable-2.3
|
210 |
|
|
# Desc: check whether only lpinteger changed
|
211 |
|
|
mi_gdb_test "-var-update *" \
|
212 |
|
|
"\\^done,changelist=\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}" \
|
213 |
|
|
"update all vars: lpinteger changed"
|
214 |
|
|
|
215 |
|
|
# Step over "lcharacter = 'a';"
|
216 |
|
|
send_gdb "-exec-step\n"
|
217 |
|
|
gdb_expect {
|
218 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"109\"\}\r\n$mi_gdb_prompt$" {
|
219 |
|
|
pass "step at do_locals_tests"
|
220 |
|
|
}
|
221 |
|
|
timeout {
|
222 |
|
|
fail "step at do_locals_tests (timeout)"
|
223 |
|
|
}
|
224 |
|
|
}
|
225 |
|
|
|
226 |
|
|
# Test: c_variable-2.4
|
227 |
|
|
# Desc: check whether only lcharacter changed
|
228 |
|
|
mi_gdb_test "-var-update *" \
|
229 |
|
|
"\\^done,changelist=\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\}" \
|
230 |
|
|
"update all vars: lcharacter changed"
|
231 |
|
|
|
232 |
|
|
# Step over "lpcharacter = &lcharacter;"
|
233 |
|
|
send_gdb "-exec-step\n"
|
234 |
|
|
gdb_expect {
|
235 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"110\"\}\r\n$mi_gdb_prompt$" {
|
236 |
|
|
pass "step at do_locals_tests"
|
237 |
|
|
}
|
238 |
|
|
timeout {
|
239 |
|
|
fail "step at do_locals_tests (timeout)"
|
240 |
|
|
}
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
# Test: c_variable-2.5
|
244 |
|
|
# Desc: check whether only lpcharacter changed
|
245 |
|
|
mi_gdb_test "-var-update *" \
|
246 |
|
|
"\\^done,changelist=\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\}" \
|
247 |
|
|
"update all vars: lpcharacter changed"
|
248 |
|
|
|
249 |
|
|
|
250 |
|
|
# Step over:
|
251 |
|
|
# llong = 2121L;
|
252 |
|
|
# lplong = &llong;
|
253 |
|
|
# lfloat = 2.1;
|
254 |
|
|
# lpfloat = &lfloat;
|
255 |
|
|
# ldouble = 2.718281828459045;
|
256 |
|
|
# lpdouble = &ldouble;
|
257 |
|
|
# lsimple.integer = 1234;
|
258 |
|
|
# lsimple.unsigned_integer = 255;
|
259 |
|
|
# lsimple.character = 'a';
|
260 |
|
|
|
261 |
|
|
send_gdb "-exec-step 9\n"
|
262 |
|
|
gdb_expect {
|
263 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"119\"\}\r\n$mi_gdb_prompt$" {
|
264 |
|
|
pass "step at do_locals_tests"
|
265 |
|
|
}
|
266 |
|
|
timeout {
|
267 |
|
|
fail "step at do_locals_tests (timeout)"
|
268 |
|
|
}
|
269 |
|
|
}
|
270 |
|
|
|
271 |
|
|
# Test: c_variable-2.6
|
272 |
|
|
# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
|
273 |
|
|
# lsimple.unsigned_character lsimple.integer lsimple.character changed
|
274 |
|
|
mi_gdb_test "-var-update *" \
|
275 |
|
|
"\\^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\"\}" \
|
276 |
|
|
"update all vars: many changed"
|
277 |
|
|
|
278 |
|
|
# Step over:
|
279 |
|
|
# lsimple.signed_character = 21;
|
280 |
|
|
# lsimple.char_ptr = &lcharacter;
|
281 |
|
|
# lpsimple = &lsimple;
|
282 |
|
|
# func = nothing;
|
283 |
|
|
|
284 |
|
|
send_gdb "-exec-step 4\n"
|
285 |
|
|
gdb_expect {
|
286 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"125\"\}\r\n$mi_gdb_prompt$" {
|
287 |
|
|
pass "step at do_locals_tests"
|
288 |
|
|
}
|
289 |
|
|
timeout {
|
290 |
|
|
fail "step at do_locals_tests (timeout)"
|
291 |
|
|
}
|
292 |
|
|
}
|
293 |
|
|
|
294 |
|
|
# Test: c_variable-2.7
|
295 |
|
|
# Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed
|
296 |
|
|
mi_gdb_test "-var-update *" \
|
297 |
|
|
"\\^done,changelist=\{name=\"func\",in_scope=\"true\",type_changed=\"false\",name=\"lpsimple\",in_scope=\"true\",type_changed=\"false\"\}" \
|
298 |
|
|
"update all vars: func and lpsimple changed"
|
299 |
|
|
|
300 |
|
|
# Step over
|
301 |
|
|
# linteger = 4321;
|
302 |
|
|
# lcharacter = 'b';
|
303 |
|
|
# llong = 1212L;
|
304 |
|
|
# lfloat = 1.2;
|
305 |
|
|
# ldouble = 5.498548281828172;
|
306 |
|
|
# lsimple.integer = 255;
|
307 |
|
|
# lsimple.unsigned_integer = 4321;
|
308 |
|
|
# lsimple.character = 'b';
|
309 |
|
|
|
310 |
|
|
send_gdb "-exec-step 8\n"
|
311 |
|
|
gdb_expect {
|
312 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"133\"\}\r\n$mi_gdb_prompt$" {
|
313 |
|
|
pass "step at do_locals_tests"
|
314 |
|
|
}
|
315 |
|
|
timeout {
|
316 |
|
|
fail "step at do_locals_tests (timeout)"
|
317 |
|
|
}
|
318 |
|
|
}
|
319 |
|
|
|
320 |
|
|
# Test: c_variable-2.8
|
321 |
|
|
# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
|
322 |
|
|
# lpsimple.integer lsimple.character changed
|
323 |
|
|
# Note: this test also checks that lpsimple->integer and lsimple.integer have
|
324 |
|
|
# changed (they are the same)
|
325 |
|
|
mi_gdb_test "-var-update *" \
|
326 |
|
|
"\\^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=\"lcharacter\",in_scope=\"true\",type_changed=\"false\",name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \
|
327 |
|
|
"update all vars: func and lpsimple changed"
|
328 |
|
|
|
329 |
|
|
|
330 |
|
|
###
|
331 |
|
|
#
|
332 |
|
|
# Test assignment to variables. More tests on assignment are in other files.
|
333 |
|
|
#
|
334 |
|
|
###
|
335 |
|
|
mi_gdb_test "-var-assign global_simple 0" \
|
336 |
|
|
"&\"mi_cmd_var_assign: Variable object is not editable\\\\n\".*\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \
|
337 |
|
|
"assign to global_simple"
|
338 |
|
|
|
339 |
|
|
mi_gdb_test "-var-assign linteger 3333" \
|
340 |
|
|
"\\^done,value=\"3333\"" \
|
341 |
|
|
"assign to linteger"
|
342 |
|
|
|
343 |
|
|
mi_gdb_test "-var-evaluate-expression linteger" \
|
344 |
|
|
"\\^done,value=\"3333\"" \
|
345 |
|
|
"eval linteger"
|
346 |
|
|
|
347 |
|
|
mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \
|
348 |
|
|
"\\^done,value=\"$hex\"" \
|
349 |
|
|
"assign to lpinteger"
|
350 |
|
|
|
351 |
|
|
mi_gdb_test "-var-evaluate-expression lpinteger" \
|
352 |
|
|
"\\^done,value=\"$hex\"" \
|
353 |
|
|
"eval lpinteger"
|
354 |
|
|
|
355 |
|
|
# reset the values to the original ones so that the rest of the file doesn't suffer.
|
356 |
|
|
|
357 |
|
|
mi_gdb_test "-var-assign linteger 4321" \
|
358 |
|
|
"\\^done,value=\"4321\"" \
|
359 |
|
|
"assign to linteger"
|
360 |
|
|
|
361 |
|
|
mi_gdb_test "-var-assign lpinteger &linteger" \
|
362 |
|
|
"\\^done,value=\"$hex\"" \
|
363 |
|
|
"assign to lpinteger"
|
364 |
|
|
|
365 |
|
|
mi_gdb_test "-var-assign lcharacter 'z'" \
|
366 |
|
|
"\\^done,value=\"122 'z'\"" \
|
367 |
|
|
"assign to lcharacter"
|
368 |
|
|
|
369 |
|
|
mi_gdb_test "-var-evaluate-expression lcharacter" \
|
370 |
|
|
"\\^done,value=\"122 'z'\"" \
|
371 |
|
|
"eval lcharacter"
|
372 |
|
|
|
373 |
|
|
mi_gdb_test "-var-assign llong 1313L" \
|
374 |
|
|
"\\^done,value=\"1313\"" \
|
375 |
|
|
"assign to llong"
|
376 |
|
|
mi_gdb_test "-var-evaluate-expression llong" \
|
377 |
|
|
"\\^done,value=\"1313\"" \
|
378 |
|
|
"eval llong"
|
379 |
|
|
mi_gdb_test "-var-assign llong 1212L" \
|
380 |
|
|
"\\^done,value=\"1212\"" \
|
381 |
|
|
"assign to llong"
|
382 |
|
|
|
383 |
|
|
mi_gdb_test "-var-assign lplong &llong+4" \
|
384 |
|
|
"\\^done,value=\"$hex\"" \
|
385 |
|
|
"assign to lplong"
|
386 |
|
|
mi_gdb_test "-var-evaluate-expression lplong" \
|
387 |
|
|
"\\^done,value=\"$hex\"" \
|
388 |
|
|
"eval lplong"
|
389 |
|
|
mi_gdb_test "-var-assign lplong &llong" \
|
390 |
|
|
"\\^done,value=\"$hex\"" \
|
391 |
|
|
"assign to lplong"
|
392 |
|
|
|
393 |
|
|
mi_gdb_test "-var-assign lfloat 3.4" \
|
394 |
|
|
"\\^done,value=\"3.4.*\"" \
|
395 |
|
|
"assign to lfloat"
|
396 |
|
|
mi_gdb_test "-var-evaluate-expression lfloat" \
|
397 |
|
|
"\\^done,value=\"3.4.*\"" \
|
398 |
|
|
"eval lfloat"
|
399 |
|
|
mi_gdb_test "-var-assign lfloat 1.2" \
|
400 |
|
|
"\\^done,value=\"1.2.*\"" \
|
401 |
|
|
"assign to lfloat"
|
402 |
|
|
|
403 |
|
|
mi_gdb_test "-var-assign lpfloat &lfloat+4" \
|
404 |
|
|
"\\^done,value=\"$hex\"" \
|
405 |
|
|
"assign to lpfloat"
|
406 |
|
|
|
407 |
|
|
mi_gdb_test "-var-assign ldouble 5.333318284590435" \
|
408 |
|
|
"\\^done,value=\"5.333318284590435\"" \
|
409 |
|
|
"assign to ldouble"
|
410 |
|
|
|
411 |
|
|
mi_gdb_test "-var-assign func do_block_tests" \
|
412 |
|
|
"\\^done,value=\"$hex \"" \
|
413 |
|
|
"assign to func"
|
414 |
|
|
|
415 |
|
|
mi_gdb_test "-var-assign lsimple.character 'd'" \
|
416 |
|
|
"\\^done,value=\"100 'd'\"" \
|
417 |
|
|
"assign to lsimple.character"
|
418 |
|
|
|
419 |
|
|
mi_gdb_test "-var-assign lsimple->integer 222" \
|
420 |
|
|
"\\^done,value=\"222\"" \
|
421 |
|
|
"assign to lsimple->integer"
|
422 |
|
|
|
423 |
|
|
mi_gdb_test "-var-assign lsimple.integer 333" \
|
424 |
|
|
"\\^done,value=\"333\"" \
|
425 |
|
|
"assign to lsimple.integer"
|
426 |
|
|
|
427 |
|
|
######
|
428 |
|
|
# End of assign tests
|
429 |
|
|
#####
|
430 |
|
|
|
431 |
|
|
mi_gdb_test "-break-insert subroutine1" \
|
432 |
|
|
"\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"146\",times=\"0\"\}" \
|
433 |
|
|
"break-insert subroutine1"
|
434 |
|
|
send_gdb "-exec-continue\n"
|
435 |
|
|
gdb_expect {
|
436 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}\},file=\".*var-cmd.c\",line=\"146\"\}\r\n$mi_gdb_prompt$" {
|
437 |
|
|
pass "continue to subroutine1"
|
438 |
|
|
}
|
439 |
|
|
timeout {
|
440 |
|
|
fail "continue to subroutine1 (timeout)"
|
441 |
|
|
}
|
442 |
|
|
}
|
443 |
|
|
|
444 |
|
|
# Test: c_variable-2.10
|
445 |
|
|
# Desc: create variable for locals i,l in subroutine1
|
446 |
|
|
mi_gdb_test "-var-create i * i" \
|
447 |
|
|
"\\^done,name=\"i\",numchild=\"0\",type=\"int\"" \
|
448 |
|
|
"create i"
|
449 |
|
|
|
450 |
|
|
mi_gdb_test "-var-create l * l" \
|
451 |
|
|
"\\^done,name=\"l\",numchild=\"1\",type=\"long int \\*\"" \
|
452 |
|
|
"create l"
|
453 |
|
|
|
454 |
|
|
# Test: c_variable-2.11
|
455 |
|
|
# Desc: create do_locals_tests local in subroutine1
|
456 |
|
|
mi_gdb_test "-var-create linteger * linteger" \
|
457 |
|
|
"&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
458 |
|
|
"create linteger"
|
459 |
|
|
|
460 |
|
|
send_gdb "-exec-step\n"
|
461 |
|
|
gdb_expect {
|
462 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\},file=\".*var-cmd.c\",line=\"147\"\}\r\n$mi_gdb_prompt$" {
|
463 |
|
|
pass "step at subroutine1"
|
464 |
|
|
}
|
465 |
|
|
timeout {
|
466 |
|
|
fail "step at subroutine1 (timeout)"
|
467 |
|
|
}
|
468 |
|
|
}
|
469 |
|
|
|
470 |
|
|
# Test: c_variable-2.12
|
471 |
|
|
# Desc: change global_simple.integer
|
472 |
|
|
# Note: This also tests whether we are reporting changes in structs properly.
|
473 |
|
|
# gdb normally would say that global_simple has changed, but we
|
474 |
|
|
# special case that, since it is not what a human expects to
|
475 |
|
|
# see.
|
476 |
|
|
|
477 |
|
|
setup_xfail *-*-*
|
478 |
|
|
mi_gdb_test "-var-update *" \
|
479 |
|
|
"\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \
|
480 |
|
|
"update all vars: changed FIXME"
|
481 |
|
|
clear_xfail *-*-*
|
482 |
|
|
|
483 |
|
|
send_gdb "-exec-step\n"
|
484 |
|
|
gdb_expect {
|
485 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\},file=\".*var-cmd.c\",line=\"148\"\}\r\n$mi_gdb_prompt$" {
|
486 |
|
|
pass "step at subroutine1"
|
487 |
|
|
}
|
488 |
|
|
timeout { fail "step at subroutine1 (timeout)" }
|
489 |
|
|
}
|
490 |
|
|
|
491 |
|
|
# Test: c_variable-2.13
|
492 |
|
|
# Desc: change subroutine1 local i
|
493 |
|
|
mi_gdb_test "-var-update *" \
|
494 |
|
|
"\\^done,changelist=\{name=\"i\",in_scope=\"true\",type_changed=\"false\"\}" \
|
495 |
|
|
"update all vars: i changed"
|
496 |
|
|
|
497 |
|
|
send_gdb "-exec-step\n"
|
498 |
|
|
gdb_expect {
|
499 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\},file=\".*var-cmd.c\",line=\"149\"\}\r\n$mi_gdb_prompt$" {
|
500 |
|
|
pass "step at subroutine1"
|
501 |
|
|
}
|
502 |
|
|
timeout { fail "step at subroutine1 (timeout)" }
|
503 |
|
|
}
|
504 |
|
|
|
505 |
|
|
# Test: c_variable-2.14
|
506 |
|
|
# Desc: change do_locals_tests local llong
|
507 |
|
|
mi_gdb_test "-var-update *" \
|
508 |
|
|
"\\^done,changelist=\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}" \
|
509 |
|
|
"update all vars: llong changed"
|
510 |
|
|
|
511 |
|
|
send_gdb "-exec-next\n"
|
512 |
|
|
gdb_expect {
|
513 |
|
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"136\"\}\r\n$mi_gdb_prompt$" {
|
514 |
|
|
pass "next out of subroutine1"
|
515 |
|
|
}
|
516 |
|
|
timeout { fail "next out of subroutine1 (timeout)" }
|
517 |
|
|
}
|
518 |
|
|
|
519 |
|
|
# Test: c_variable-2.15
|
520 |
|
|
# Desc: check for out of scope subroutine1 locals
|
521 |
|
|
mi_gdb_test "-var-update *" \
|
522 |
|
|
"\\^done,changelist=\{name=\"l\",in_scope=\"false\",name=\"i\",in_scope=\"false\"\}" \
|
523 |
|
|
"update all vars: all now out of scope"
|
524 |
|
|
|
525 |
|
|
# Done with locals/globals tests. Erase all variables
|
526 |
|
|
#delete_all_variables
|
527 |
|
|
mi_gdb_test "-var-delete global_simple" \
|
528 |
|
|
"\\^done,ndeleted=\"1\"" \
|
529 |
|
|
"delete var"
|
530 |
|
|
|
531 |
|
|
mi_gdb_test "-var-delete linteger" \
|
532 |
|
|
"\\^done,ndeleted=\"1\"" \
|
533 |
|
|
"delete var linteger"
|
534 |
|
|
|
535 |
|
|
mi_gdb_test "-var-delete lpinteger" \
|
536 |
|
|
"\\^done,ndeleted=\"1\"" \
|
537 |
|
|
"delete var lpinteger"
|
538 |
|
|
|
539 |
|
|
mi_gdb_test "-var-delete lcharacter" \
|
540 |
|
|
"\\^done,ndeleted=\"1\"" \
|
541 |
|
|
"delete var lcharacter"
|
542 |
|
|
|
543 |
|
|
mi_gdb_test "-var-delete lpcharacter" \
|
544 |
|
|
"\\^done,ndeleted=\"1\"" \
|
545 |
|
|
"delete var lpcharacter"
|
546 |
|
|
|
547 |
|
|
mi_gdb_test "-var-delete llong" \
|
548 |
|
|
"\\^done,ndeleted=\"1\"" \
|
549 |
|
|
"delete var llong"
|
550 |
|
|
|
551 |
|
|
mi_gdb_test "-var-delete lplong" \
|
552 |
|
|
"\\^done,ndeleted=\"1\"" \
|
553 |
|
|
"delete var lplong"
|
554 |
|
|
|
555 |
|
|
mi_gdb_test "-var-delete lfloat" \
|
556 |
|
|
"\\^done,ndeleted=\"1\"" \
|
557 |
|
|
"delete var lfloat"
|
558 |
|
|
|
559 |
|
|
mi_gdb_test "-var-delete lpfloat" \
|
560 |
|
|
"\\^done,ndeleted=\"1\"" \
|
561 |
|
|
"delete var lpfloat"
|
562 |
|
|
|
563 |
|
|
mi_gdb_test "-var-delete ldouble" \
|
564 |
|
|
"\\^done,ndeleted=\"1\"" \
|
565 |
|
|
"delete var ldouble"
|
566 |
|
|
|
567 |
|
|
mi_gdb_test "-var-delete lpdouble" \
|
568 |
|
|
"\\^done,ndeleted=\"1\"" \
|
569 |
|
|
"delete var lpdouble"
|
570 |
|
|
|
571 |
|
|
mi_gdb_test "-var-delete lsimple" \
|
572 |
|
|
"\\^done,ndeleted=\"1\"" \
|
573 |
|
|
"delete var lsimple"
|
574 |
|
|
|
575 |
|
|
mi_gdb_test "-var-delete lpsimple" \
|
576 |
|
|
"\\^done,ndeleted=\"1\"" \
|
577 |
|
|
"delete var lpsimple"
|
578 |
|
|
|
579 |
|
|
mi_gdb_test "-var-delete func" \
|
580 |
|
|
"\\^done,ndeleted=\"1\"" \
|
581 |
|
|
"delete var func"
|
582 |
|
|
|
583 |
|
|
mi_gdb_test "-var-delete lsimple.character" \
|
584 |
|
|
"\\^done,ndeleted=\"1\"" \
|
585 |
|
|
"delete var lsimple.character"
|
586 |
|
|
|
587 |
|
|
mi_gdb_test "-var-delete lsimple->integer" \
|
588 |
|
|
"\\^done,ndeleted=\"1\"" \
|
589 |
|
|
"delete var lsimple->integer"
|
590 |
|
|
|
591 |
|
|
mi_gdb_test "-var-delete lsimple.integer" \
|
592 |
|
|
"\\^done,ndeleted=\"1\"" \
|
593 |
|
|
"delete var lsimple.integer"
|
594 |
|
|
|
595 |
|
|
mi_gdb_test "-var-delete i" \
|
596 |
|
|
"\\^done,ndeleted=\"1\"" \
|
597 |
|
|
"delete var i"
|
598 |
|
|
|
599 |
|
|
mi_gdb_test "-var-delete l" \
|
600 |
|
|
"\\^done,ndeleted=\"1\"" \
|
601 |
|
|
"delete var l"
|
602 |
|
|
|
603 |
|
|
mi_gdb_exit
|
604 |
|
|
return 0
|
605 |
|
|
|
606 |
|
|
# Local variables:
|
607 |
|
|
# change-log-default-name: "ChangeLog-mi"
|
608 |
|
|
# End:
|
609 |
|
|
|