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