OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.mi/] [mi-var-cmd.exp] - Blame information for rev 299

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# Copyright 1999, 2000, 2001, 2002, 2004, 2005, 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=mi"
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 mi-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
mi_gdb_test "-var-update *" \
395
        "\\^done,changelist=.*" \
396
        "var update"
397
 
398
# Check that assignment of function and array values
399
# promotes the assigned value to function pointer/data
400
# pointer before comparing with the existing value,
401
# and does not incorrectly make the value as changed.
402
mi_gdb_test "-var-assign func do_block_tests" \
403
        "\\^done,value=\"$hex \"" \
404
        "assign same value to func"
405
 
406
mi_gdb_test "-var-update *" \
407
        "\\^done,changelist=\\\[\\\]" \
408
        "assign same value to func (update)"
409
 
410
mi_gdb_test "-var-create array_ptr * array_ptr" \
411
        "\\^done,name=\"array_ptr\",numchild=\"1\",value=\"$hex\",type=\"int \\*\"" \
412
        "create global variable array_ptr"
413
 
414
mi_gdb_test "-var-assign array_ptr array2" \
415
        "\\^done,value=\"$hex\"" \
416
        "assign array to pointer"
417
 
418
mi_gdb_test "-var-update *" \
419
        "\\^done,changelist=\\\[\{name=\"array_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
420
        "assign array to pointer (update)"
421
 
422
mi_gdb_test "-var-assign array_ptr array2" \
423
        "\\^done,value=\"$hex\"" \
424
        "assign same array to pointer"
425
 
426
mi_gdb_test "-var-update *" \
427
        "\\^done,changelist=\\\[\\\]" \
428
        "assign same array to pointer (update)"
429
 
430
 
431
######
432
# End of assign tests
433
#####
434
 
435
set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"]
436
 
437
mi_continue_to subroutine1
438
 
439
# Test: c_variable-2.10
440
# Desc: create variable for locals i,l in subroutine1
441
mi_gdb_test "-var-create i  * i" \
442
        "\\^done,name=\"i\",numchild=\"0\",value=\"4321\",type=\"int\"" \
443
        "create i"
444
 
445
mi_gdb_test "-var-create l * l" \
446
        "\\^done,name=\"l\",numchild=\"1\",value=\"$hex\",type=\"long int \\*\"" \
447
        "create l"
448
 
449
# Test: c_variable-2.11
450
# Desc: create do_locals_tests local in subroutine1
451
mi_gdb_test "-var-create linteger * linteger" \
452
        "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
453
        "create linteger"
454
 
455
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
456
        "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1"
457
 
458
# Test: c_variable-2.12
459
# Desc: change global_simple.integer
460
# Note: This also tests whether we are reporting changes in structs properly.
461
#       gdb normally would say that global_simple has changed, but we
462
#       special case that, since it is not what a human expects to
463
#       see.
464
 
465
setup_xfail *-*-*
466
mi_gdb_test "-var-update *" \
467
        "\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \
468
        "update all vars: changed FIXME"
469
clear_xfail *-*-*
470
 
471
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
472
        "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)"
473
 
474
# Test: c_variable-2.13
475
# Desc: change subroutine1 local i
476
mi_gdb_test "-var-update *" \
477
        "\\^done,changelist=\\\[\{name=\"i\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
478
        "update all vars: i changed"
479
 
480
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
481
        "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)"
482
 
483
# Test: c_variable-2.14
484
# Desc: change do_locals_tests local llong
485
mi_gdb_test "-var-update *" \
486
        "\\^done,changelist=\\\[\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
487
        "update all vars: llong changed"
488
 
489
set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"]
490
mi_next_to "do_locals_tests" "" "var-cmd.c" \
491
  [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1"
492
 
493
# Test: c_variable-2.15
494
# Desc: check for out of scope subroutine1 locals
495
mi_gdb_test "-var-update *" \
496
        "\\^done,changelist=\\\[\{name=\"l\",in_scope=\"false\"\},\{name=\"i\",in_scope=\"false\"\}\\\]" \
497
        "update all vars: all now out of scope"
498
 
499
# Done with locals/globals tests. Erase all variables
500
#delete_all_variables
501
mi_gdb_test "-var-delete global_simple" \
502
        "\\^done,ndeleted=\"1\"" \
503
        "delete var"
504
 
505
mi_gdb_test "-var-delete linteger" \
506
        "\\^done,ndeleted=\"1\"" \
507
        "delete var linteger"
508
 
509
mi_gdb_test "-var-delete lpinteger" \
510
        "\\^done,ndeleted=\"1\"" \
511
        "delete var lpinteger"
512
 
513
mi_gdb_test "-var-delete lcharacter" \
514
        "\\^done,ndeleted=\"1\"" \
515
        "delete var lcharacter"
516
 
517
mi_gdb_test "-var-delete lpcharacter" \
518
        "\\^done,ndeleted=\"1\"" \
519
        "delete var lpcharacter"
520
 
521
mi_gdb_test "-var-delete llong" \
522
        "\\^done,ndeleted=\"1\"" \
523
        "delete var llong"
524
 
525
mi_gdb_test "-var-delete lplong" \
526
        "\\^done,ndeleted=\"1\"" \
527
        "delete var lplong"
528
 
529
mi_gdb_test "-var-delete lfloat" \
530
        "\\^done,ndeleted=\"1\"" \
531
        "delete var lfloat"
532
 
533
mi_gdb_test "-var-delete lpfloat" \
534
        "\\^done,ndeleted=\"1\"" \
535
        "delete var lpfloat"
536
 
537
mi_gdb_test "-var-delete ldouble" \
538
        "\\^done,ndeleted=\"1\"" \
539
        "delete var ldouble"
540
 
541
mi_gdb_test "-var-delete lpdouble" \
542
        "\\^done,ndeleted=\"1\"" \
543
        "delete var lpdouble"
544
 
545
mi_gdb_test "-var-delete lsimple" \
546
        "\\^done,ndeleted=\"1\"" \
547
        "delete var lsimple"
548
 
549
mi_gdb_test "-var-delete lpsimple" \
550
        "\\^done,ndeleted=\"1\"" \
551
        "delete var lpsimple"
552
 
553
mi_gdb_test "-var-delete func" \
554
        "\\^done,ndeleted=\"1\"" \
555
        "delete var func"
556
 
557
mi_gdb_test "-var-delete lsimple.character" \
558
        "\\^done,ndeleted=\"1\"" \
559
        "delete var lsimple.character"
560
 
561
mi_gdb_test "-var-delete  lsimple->integer" \
562
        "\\^done,ndeleted=\"1\"" \
563
        "delete var  lsimple->integer"
564
 
565
mi_gdb_test "-var-delete lsimple.integer" \
566
        "\\^done,ndeleted=\"1\"" \
567
        "delete var lsimple.integer"
568
 
569
mi_gdb_test "-var-delete i" \
570
        "\\^done,ndeleted=\"1\"" \
571
        "delete var i"
572
 
573
mi_gdb_test "-var-delete l" \
574
        "\\^done,ndeleted=\"1\"" \
575
        "delete var l"
576
 
577
# Test whether we can follow the name of a variable through multiple
578
# stack frames.
579
mi_continue_to do_special_tests
580
 
581
mi_gdb_test "-var-create selected_a @ a" \
582
  {\^done,name="selected_a",numchild="0",value=\".*\",type="int"} \
583
  "create selected_a"
584
 
585
mi_continue_to incr_a
586
 
587
mi_gdb_test "-var-update selected_a" \
588
        "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"char\",new_num_children=\"0\"\}\\\]" \
589
        "update selected_a in incr_a"
590
 
591
mi_next "step a line in incr_a"
592
mi_next "return from incr_a to do_special_tests"
593
 
594
mi_gdb_test "-var-update selected_a" \
595
        "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"int\",new_num_children=\"0\"\}\\\]" \
596
        "update selected_a in do_special_tests"
597
 
598
mi_delete_varobj selected_a "delete selected_a"
599
mi_delete_varobj array_ptr "delete array_ptr"
600
 
601
proc set_frozen {varobjs flag} {
602
    foreach v $varobjs {
603
        mi_gdb_test "-var-set-frozen $v $flag" \
604
            "\\^done" \
605
            "-var-set-frozen $v $flag"
606
    }
607
}
608
 
609
mi_prepare_inline_tests $srcfile
610
mi_run_inline_test frozen
611
 
612
# Test whether bad varobjs crash GDB.
613
 
614
# A varobj we fail to read during -var-update should be considered
615
# out of scope.
616
mi_gdb_test "-var-create null_ptr * **0" \
617
    {\^done,name="null_ptr",numchild="0",value=".*",type="int"} \
618
    "create null_ptr"
619
 
620
# Allow this to succeed, if address zero is readable, although it
621
# will not test what it was meant to.  Most important is that GDB
622
# does not crash.
623
mi_gdb_test "-var-update null_ptr" \
624
    {\^done,changelist=\[.*\]} \
625
    "update null_ptr"
626
 
627
mi_gdb_test "-var-delete null_ptr" \
628
    "\\^done,ndeleted=\"1\"" \
629
    "delete null_ptr"
630
 
631
# When we fail to read a varobj created from a named variable,
632
# we evaluate its type instead.  Make sure that doesn't blow
633
# up by trying to read it again.  We can use _end when not running
634
# the program to simulate an unreadable variable, if this platform
635
# provides _end, but cope if it's missing.
636
 
637
mi_gdb_test "kill" \
638
    {&"kill\\n".*\^done} \
639
    "kill program before endvar"
640
 
641
mi_gdb_test "-var-create endvar * _end" \
642
    {(\^done,name="endvar",numchild="0",value=".*",type=".*"|&".*unable to.*".*\^error,msg=".*")} \
643
    "create endvar"
644
 
645
# Allow this to succeed whether the value is readable, unreadable, or
646
# missing.  Most important is that GDB does not crash.
647
mi_gdb_test "-var-update endvar" \
648
    {(\^done,changelist=\[.*\]|^".*".*\^error,msg=".*not found")} \
649
    "update endvar"
650
 
651
mi_gdb_test "-var-delete endvar" \
652
    "\\^done,ndeleted=\"1\"" \
653
    "delete endvar"
654
 
655
mi_gdb_exit
656
return 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.