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