Reviewed and approved by Jim Blandy
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / scope.exp
1 # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003,
2 # 2004 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 2 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, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 # Please email any bugs, comments, and/or additions to this file to:
19 # bug-gdb@prep.ai.mit.edu
20
21 # This file was written by Fred Fish. (fnf@cygnus.com)
22
23 if $tracelevel then {
24 strace $tracelevel
25 }
26
27 set prms_id 0
28 set bug_id 0
29
30 set testfile "scope"
31 set binfile ${objdir}/${subdir}/${testfile}
32
33
34 if { [gdb_compile "${srcdir}/${subdir}/scope0.c" "${binfile}0.o" object {debug}] != "" } {
35 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
36 }
37
38 if { [gdb_compile "${srcdir}/${subdir}/scope1.c" "${binfile}1.o" object {debug}] != "" } {
39 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
40 }
41
42 if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } {
43 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
44 }
45
46 # Create and source the file that provides information about the compiler
47 # used to compile the test case.
48 if [get_compiler_info ${binfile}] {
49 return -1;
50 }
51
52 # Test locating various things when stopped just inside main, after
53 # running init0(). To prevent cascading of errors, we report the
54 # first one and quit. If all pass, then we print the pass results.
55
56 proc test_at_main {} {
57 global gdb_prompt
58 global decimal
59 global det_file
60 global srcdir
61 global subdir
62 global hp_cc_compiler
63
64 # skip past init. There may be a call to __main at the start of
65 # main, so the first next may only get us to the init0 call.
66 gdb_test_multiple "next" "next over init0() in main" {
67 -re "$decimal.*foo \\(\\).*$gdb_prompt $" {
68 pass "next over init0() in main"
69 }
70 -re "$decimal.*init0 \\(\\).*$gdb_prompt $" {
71 send_gdb "next\n"
72 exp_continue
73 }
74 -re ".*$gdb_prompt $" {
75 fail "next over init0() in main"
76 gdb_suppress_tests
77 }
78 }
79
80
81 # Print scope0.c::filelocal, which is 1
82
83 if [gdb_test "print filelocal" "\\\$$decimal = 1" "print filelocal" ] {
84 gdb_suppress_tests ;
85 }
86
87
88 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at main" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal"] {
89 gdb_suppress_tests ;
90 }
91
92
93 # Print scope0.c::filelocal_bss, which is 101
94
95 if [gdb_test "print filelocal_bss" "\\\$$decimal = 101" "print filelocal_bss" ] {
96 gdb_suppress_tests ;
97 }
98
99
100 if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_main" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] {
101 gdb_suppress_tests ;
102 }
103
104
105 # Print scope0.c::filelocal_ro, which is 201
106
107 # No clue why the rs6000 fails this test.
108 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
109 if [gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro in test_at_main" ] {
110 gdb_suppress_tests ;
111 }
112
113
114 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
115 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] {
116 gdb_suppress_tests ;
117 }
118
119
120 # Print scope1.c::filelocal, which is 2
121
122 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
123 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] {
124 gdb_suppress_tests ;
125 }
126
127
128 # Print scope1.c::filelocal_bss, which is 102
129
130 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
131 if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"] {
132 gdb_suppress_tests ;
133 }
134
135
136 # Print scope1.c::filelocal_ro, which is 202
137
138 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
139 if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs}
140 if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"] {
141 gdb_suppress_tests ;
142 }
143
144
145 # Print scope1.c::foo::funclocal, which is 3
146
147 if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal" ] {
148 gdb_suppress_tests ;
149 }
150
151
152 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
153 if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"] {
154 gdb_suppress_tests ;
155 }
156
157
158 # Print scope1.c::foo::funclocal_ro, which is 203
159
160 if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro" ] {
161 gdb_suppress_tests ;
162 }
163
164
165 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
166 if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] {
167 gdb_suppress_tests ;
168 }
169
170
171 # Print scope1.c::bar::funclocal, which is 4
172
173 if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal" ] {
174 gdb_suppress_tests ;
175 }
176
177
178 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
179 if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"] {
180 gdb_suppress_tests ;
181 }
182 gdb_stop_suppressing_tests;
183
184 }
185
186 proc test_at_foo {} {
187 global gdb_prompt
188 global decimal
189 global det_file
190 global srcdir
191 global subdir
192
193 if [gdb_test "next" ".*bar \\(\\);" "" ] {
194 gdb_suppress_tests ;
195 }
196
197
198 # Print scope0.c::filelocal, which is 1
199
200 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at foo" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal"] {
201 gdb_suppress_tests ;
202 }
203
204
205 # Print scope0.c::filelocal_bss, which is 101
206
207 if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_foo" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] {
208 gdb_suppress_tests ;
209 }
210
211
212 # Print scope0.c::filelocal_ro, which is 201
213
214 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
215 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] {
216 gdb_suppress_tests ;
217 }
218
219
220 gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo"
221
222 # Print scope1.c::filelocal, which is 2
223
224 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
225 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] {
226 gdb_suppress_tests ;
227 }
228
229
230 gdb_test "print filelocal_bss" "\\\$$decimal = 102" \
231 "print filelocal_bss at foo"
232
233 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
234 gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"
235
236
237 gdb_test "print filelocal_ro" "\\\$$decimal = 202" \
238 "print filelocal_ro at foo"
239
240 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
241 gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"
242
243
244 # Print scope1.c::foo::funclocal, which is 3
245
246 gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo"
247
248 gdb_test "print foo::funclocal" "\\\$$decimal = 3" \
249 "print foo::funclocal at foo"
250
251 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
252 gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"
253
254
255 # Print scope1.c::foo::funclocal_bss, which is 103
256
257 gdb_test "print funclocal_bss" "\\\$$decimal = 103" \
258 "print funclocal_bss at foo"
259
260 gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \
261 "print foo::funclocal_bss at foo"
262
263 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
264 gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss"
265
266
267 # Print scope1.c::foo::funclocal_ro, which is 203
268
269 gdb_test "print funclocal_ro" "\\\$$decimal = 203" \
270 "print funclocal_ro at foo"
271
272 gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \
273 "print foo::funclocal_ro at foo"
274
275 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
276 gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"
277
278
279 # Print scope1.c::bar::funclocal, which is 4
280
281 gdb_test "print bar::funclocal" "\\\$$decimal = 4" \
282 "print bar::funclocal at foo"
283
284 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
285 gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"
286 gdb_stop_suppressing_tests;
287
288 }
289
290 proc test_at_bar {} {
291 global gdb_prompt
292 global decimal
293 global det_file
294 global srcdir
295 global subdir
296
297 if [gdb_test "next" ".*" "" ] {
298 gdb_suppress_tests ;
299 }
300
301
302 # Print scope0.c::filelocal, which is 1
303
304 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal"] {
305 gdb_suppress_tests ;
306 }
307
308
309 # Print scope0.c::filelocal_bss, which is 101
310
311 if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] {
312 gdb_suppress_tests ;
313 }
314
315
316 # Print scope0.c::filelocal_ro, which is 201
317
318 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
319 if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro at bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] {
320 gdb_suppress_tests ;
321 }
322
323
324 # Print scope1.c::filelocal, which is 2
325
326 if [gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at bar" ] {
327 gdb_suppress_tests ;
328 }
329
330
331 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
332 if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] {
333 gdb_suppress_tests ;
334 }
335
336
337 # Print scope1.c::filelocal_bss, which is 102
338
339 if [gdb_test "print filelocal_bss" "\\\$$decimal = 102" "print filelocal_bss at bar" ] {
340 gdb_suppress_tests ;
341 }
342
343
344 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
345 if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"] {
346 gdb_suppress_tests ;
347 }
348
349
350 # Print scope1.c::filelocal_ro, which is 202
351
352 if [gdb_test "print filelocal_ro" "\\\$$decimal = 202" "print filelocal_ro in test_at_bar" ] {
353 gdb_suppress_tests ;
354 }
355
356
357 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
358 if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"] {
359 gdb_suppress_tests ;
360 }
361
362
363 # Print scope1.c::foo::funclocal, which is 3
364
365 if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal at bar" ] {
366 gdb_suppress_tests ;
367 }
368
369
370 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
371 if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"] {
372 gdb_suppress_tests ;
373 }
374
375
376 # Print scope1.c::foo::funclocal_bss, which is 103
377
378 if [gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" "print foo::funclocal_bss at bar" ] {
379 gdb_suppress_tests ;
380 }
381
382
383 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
384 if [gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss"] {
385 gdb_suppress_tests ;
386 }
387
388
389 # Print scope1.c::foo::funclocal_ro, which is 203
390
391 if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro at bar" ] {
392 gdb_suppress_tests ;
393 }
394
395
396 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
397 if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] {
398 gdb_suppress_tests ;
399 }
400
401
402 # Print scope1.c::bar::funclocal, which is 4
403
404 if [gdb_test "print funclocal" "\\\$$decimal = 4" "print funclocal at bar" ] {
405 gdb_suppress_tests ;
406 }
407
408
409 if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal at bar" ] {
410 gdb_suppress_tests ;
411 }
412
413
414 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
415 if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"] {
416 gdb_suppress_tests ;
417 }
418
419
420 # Print scope1.c::bar::funclocal_bss, which is 104
421
422 if [gdb_test "print funclocal_bss" "\\\$$decimal = 104" "print funclocal_bss at bar" ] {
423 gdb_suppress_tests ;
424 }
425
426
427 if [gdb_test "print bar::funclocal_bss" "\\\$$decimal = 104" "print bar::funclocal_bss at bar" ] {
428 gdb_suppress_tests ;
429 }
430
431
432 if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
433 if [gdb_test "print 'scope1.c'::bar::funclocal_bss" "\\\$$decimal = 104" "print 'scope1.c'::bar::funclocal_bss at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss"] {
434 gdb_suppress_tests ;
435 }
436 gdb_stop_suppressing_tests;
437
438 }
439
440 # This test has little to do with local scopes, but it is in scope.exp anyway.
441 # That's life.
442
443 proc test_at_autovars {} {
444 global gdb_prompt
445 global decimal
446 global hex
447 global srcfile
448
449 # Test symbol table lookup with 100 local (auto) variables.
450
451 gdb_breakpoint marker1
452
453 if [gdb_test "cont" "Break.* marker1 \\(\\) at .*:$decimal.*" "continue to marker1"] {
454 gdb_suppress_tests;
455 }
456
457 if [gdb_test "up" ".*autovars.*" "up from marker1 in scope.exp" ] {
458 gdb_suppress_tests ;
459 }
460
461 set count 0
462 while {$count < 100} {
463 if [gdb_test "print i$count" ".* = $count" "" ] {
464 gdb_suppress_tests ;
465 }
466
467 set count [expr $count+1]
468 }
469 clear_xfail "*-*-*"
470 pass "$count auto variables correctly initialized"
471
472 # Test that block variable sorting is not screwing us.
473 gdb_test "frame" "#.*autovars \\(bcd=5, abc=6\\).*" "args in correct order"
474 }
475
476 proc test_at_localscopes {} {
477 global gdb_prompt
478 global decimal
479 global hex
480 global srcfile
481
482 gdb_breakpoint marker2
483 gdb_breakpoint marker3
484 gdb_breakpoint marker4
485
486 if [gdb_test "cont" "Break.* marker2 \\(\\) at .*:$decimal.*" "continue to marker2"] {
487 gdb_suppress_tests;
488 }
489 if [gdb_test "up" ".*localscopes.*" "up from marker2 in scopes.exp" ] {
490 gdb_suppress_tests ;
491 }
492
493 # Should be at first (outermost) scope. Check values.
494
495 gdb_test "print localval" " = 10" "print localval, outer scope"
496 gdb_test "print localval1" " = 11" "print localval1, outer scope"
497 gdb_test "print localval2" "No symbol \"localval2\" in current context." \
498 "print localval2, outer scope"
499 gdb_test "print localval3" "No symbol \"localval3\" in current context." \
500 "print localval3, outer scope"
501
502 if [gdb_test "cont" "Break.* marker3 \\(\\) at .*:$decimal.*" \
503 "continue to marker3 in scope.exp"] then { gdb_suppress_tests }
504 if [gdb_test "up" ".*localscopes.*" "up from marker3 in scope.exp"] {
505 gdb_suppress_tests
506 }
507
508 # Should be at next (first nested) scope. Check values.
509
510 gdb_test "print localval" " = 20" \
511 "print localval, first nested scope"
512 gdb_test "print localval1" " = 11" "print localval1, first nested scope"
513 gdb_test "print localval2" " = 12" "print localval2, first nested scope"
514 gdb_test "print localval3" "No symbol \"localval3\" in current context." \
515 "print localval3, first nested scope"
516
517 # This test will only fail if the file was compiled by gcc, but
518 # there's no way to check that.
519 if [gdb_test "cont" "Break.* marker4.*at .*:$decimal.*" \
520 "continue to marker4 in scope.exp"] then { gdb_suppress_tests }
521 if [gdb_test "up" ".*localscopes.*" "up from marker4 in scope.exp"] {
522 gdb_suppress_tests
523 }
524
525 gdb_test "print localval" " = 30" "print localval, innermost scope"
526 gdb_test "print localval1" " = 11" "print localval1, innermost scope"
527 gdb_test "print localval2" " = 12" "print localval2, innermost scope"
528 gdb_test "print localval3" " = 13" "print localval3, innermost scope"
529 gdb_stop_suppressing_tests;
530 }
531
532 # Start with a fresh gdb.
533
534 gdb_exit
535 gdb_start
536 gdb_reinitialize_dir $srcdir/$subdir
537 gdb_load ${binfile}
538
539 if [istarget "*-*-vxworks*"] {
540 set timeout 120
541 verbose "Timeout is now $timeout seconds" 2
542 }
543
544 # Test that variables in various segments print out correctly before
545 # the program is run.
546
547 # AIX--sections get mapped to the same address so we can't get the right one.
548 setup_xfail "rs6000-*-*"
549
550 gdb_test "print 'scope0.c'::filelocal_ro" "= 201"
551
552 # gdb currently cannot access bss memory on some targets if the inferior
553 # is not running.
554 #
555 # For PA boards using monitor/remote-pa.c, the bss test is going to
556 # randomly fail. We've already put remote-pa on the target stack,
557 # so we actually read memory from the board. Problem is crt0.o
558 # is responsible for clearing bss and that hasnt' happened yet.
559 #
560 # This is a problem for all non-native targets. -- manson
561 if [is_remote target] {
562 unsupported "print 'scope0.c'::filelocal_bss before run"
563 } else {
564 gdb_test "print 'scope0.c'::filelocal_bss" "= 0" \
565 "print 'scope0.c'::filelocal_bss before run"
566 }
567
568 gdb_test "print 'scope0.c'::filelocal" "= 1" \
569 "print 'scope0.c'::filelocal before run"
570
571 if [runto_main] then { test_at_main }
572 if [istarget "mips-idt-*"] then {
573 # Restart because IDT/SIM runs out of file descriptors.
574 gdb_exit
575 gdb_start
576 gdb_reinitialize_dir $srcdir/$subdir
577 gdb_load ${binfile}
578 }
579 if [runto foo] then { test_at_foo }
580 if [istarget "mips-idt-*"] then {
581 # Restart because IDT/SIM runs out of file descriptors.
582 gdb_exit
583 gdb_start
584 gdb_reinitialize_dir $srcdir/$subdir
585 gdb_load ${binfile}
586 }
587 if [runto bar] then { test_at_bar }
588 if [istarget "mips-idt-*"] then {
589 # Restart because IDT/SIM runs out of file descriptors.
590 gdb_exit
591 gdb_start
592 gdb_reinitialize_dir $srcdir/$subdir
593 gdb_load ${binfile}
594 }
595 if [runto localscopes] then { test_at_localscopes }
596 if [istarget "mips-idt-*"] then {
597 # Restart because IDT/SIM runs out of file descriptors.
598 gdb_exit
599 gdb_start
600 gdb_reinitialize_dir $srcdir/$subdir
601 gdb_load ${binfile}
602 }
603 if [runto autovars] then { test_at_autovars }
604
605 if [istarget "*-*-vxworks*"] {
606 set timeout 120
607 verbose "Timeout is now $timeout seconds" 2
608 }
This page took 0.041782 seconds and 4 git commands to generate.