OSDN Git Service

2002-02-14 Daniel Jacobowitz <drow@mvista.com>
[pf3gnuchains/pf3gnuchains4x.git] / gdb / testsuite / gdb.base / scope.exp
1 # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000
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 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 gcc_compiled
63     global hp_cc_compiler
64
65     # skip past init.  There may be a call to __main at the start of
66     # main, so the first next may only get us to the init0 call.
67     if [gdb_test "next" "$decimal.*foo \\(\\);" "next over init0() in main"  "$decimal.*init0 \\(\\);" "next"] { 
68       gdb_suppress_tests ; 
69     }
70
71
72     # Print scope0.c::filelocal, which is 1
73
74     if [gdb_test "print filelocal" "\\\$$decimal = 1" "print filelocal" ] { 
75       gdb_suppress_tests ; 
76     }
77
78
79     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"] { 
80       gdb_suppress_tests ; 
81     }
82
83
84     # Print scope0.c::filelocal_bss, which is 101
85
86     if [gdb_test "print filelocal_bss" "\\\$$decimal = 101" "print filelocal_bss" ] { 
87       gdb_suppress_tests ; 
88     }
89
90
91     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"] { 
92       gdb_suppress_tests ; 
93     }
94
95
96     # Print scope0.c::filelocal_ro, which is 201
97
98     # No clue why the powerpc fails this test.
99     setup_xfail "powerpc-*-*"
100     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
101     if [gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro in test_at_main" ] { 
102       gdb_suppress_tests ; 
103     }
104
105
106     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
107     setup_xfail "powerpc-*-*"
108     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"] { 
109       gdb_suppress_tests ; 
110     }
111
112
113     # Print scope1.c::filelocal, which is 2
114
115     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
116     if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs}
117     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"] { 
118       gdb_suppress_tests ; 
119     }
120
121
122     # Print scope1.c::filelocal_bss, which is 102
123
124     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
125     if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs}
126     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"] { 
127       gdb_suppress_tests ; 
128     }
129
130
131     # Print scope1.c::filelocal_ro, which is 202
132
133     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
134     if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs}
135     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"] { 
136       gdb_suppress_tests ; 
137     }
138
139
140     # Print scope1.c::foo::funclocal, which is 3
141
142     if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal" ] { 
143       gdb_suppress_tests ; 
144     }
145
146
147     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
148     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"] { 
149       gdb_suppress_tests ; 
150     }
151
152
153     # Print scope1.c::foo::funclocal_ro, which is 203
154
155     if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro" ] { 
156       gdb_suppress_tests ; 
157     }
158
159
160     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
161     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"] { 
162       gdb_suppress_tests ; 
163     }
164
165
166     # Print scope1.c::bar::funclocal, which is 4
167
168     if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal" ] { 
169       gdb_suppress_tests ; 
170     }
171
172
173     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
174     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"] { 
175       gdb_suppress_tests ; 
176     }
177     gdb_stop_suppressing_tests;
178
179 }
180
181 proc test_at_foo {} {
182     global gdb_prompt
183     global decimal
184     global det_file
185     global srcdir
186     global subdir
187     global gcc_compiled
188
189     if [gdb_test "next" ".*bar \\(\\);" "" ] { 
190       gdb_suppress_tests ; 
191     }
192
193
194     # Print scope0.c::filelocal, which is 1
195
196     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"] { 
197       gdb_suppress_tests ; 
198     }
199
200
201     # Print scope0.c::filelocal_bss, which is 101
202
203     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"] { 
204       gdb_suppress_tests ; 
205     }
206
207
208     # Print scope0.c::filelocal_ro, which is 201
209
210     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
211     setup_xfail "powerpc-*-*"
212     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"] { 
213       gdb_suppress_tests ; 
214     }
215
216
217     gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo"
218
219     # Print scope1.c::filelocal, which is 2
220
221     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
222     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"] { 
223       gdb_suppress_tests ; 
224     }
225
226
227     gdb_test "print filelocal_bss" "\\\$$decimal = 102" \
228         "print filelocal_bss at foo"
229
230     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
231     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"
232
233
234     gdb_test "print filelocal_ro" "\\\$$decimal = 202" \
235         "print filelocal_ro at foo"
236
237     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
238     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"
239
240
241     # Print scope1.c::foo::funclocal, which is 3
242
243     gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo"
244
245     gdb_test "print foo::funclocal" "\\\$$decimal = 3" \
246         "print foo::funclocal at foo"
247
248     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
249     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"
250
251
252     # Print scope1.c::foo::funclocal_bss, which is 103
253
254     gdb_test "print funclocal_bss" "\\\$$decimal = 103" \
255         "print funclocal_bss at foo"
256
257     gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \
258         "print foo::funclocal_bss at foo"
259
260     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
261     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"
262
263
264     # Print scope1.c::foo::funclocal_ro, which is 203
265
266     gdb_test "print funclocal_ro" "\\\$$decimal = 203" \
267         "print funclocal_ro at foo"
268
269     gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \
270         "print foo::funclocal_ro at foo"
271
272     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
273     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"
274
275
276     # Print scope1.c::bar::funclocal, which is 4
277
278     gdb_test "print bar::funclocal" "\\\$$decimal = 4" \
279         "print bar::funclocal at foo"
280
281     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
282     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"
283     gdb_stop_suppressing_tests;
284
285 }
286
287 proc test_at_bar {} {
288     global gdb_prompt
289     global decimal
290     global det_file
291     global srcdir
292     global subdir
293     global gcc_compiled
294
295     if [gdb_test "next" ".*" "" ] { 
296       gdb_suppress_tests ; 
297     }
298
299
300     # Print scope0.c::filelocal, which is 1
301
302     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"] { 
303       gdb_suppress_tests ; 
304     }
305
306
307    # Print scope0.c::filelocal_bss, which is 101
308
309     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"] { 
310       gdb_suppress_tests ; 
311     }
312
313
314    # Print scope0.c::filelocal_ro, which is 201
315
316     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
317     setup_xfail "powerpc-*-*"
318     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"] { 
319       gdb_suppress_tests ; 
320     }
321
322
323     # Print scope1.c::filelocal, which is 2
324
325     if [gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at bar" ] { 
326       gdb_suppress_tests ; 
327     }
328
329
330     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
331     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"] { 
332       gdb_suppress_tests ; 
333     }
334
335
336     # Print scope1.c::filelocal_bss, which is 102
337
338     if [gdb_test "print filelocal_bss" "\\\$$decimal = 102" "print filelocal_bss at bar" ] { 
339       gdb_suppress_tests ; 
340     }
341
342
343     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
344     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"] { 
345       gdb_suppress_tests ; 
346     }
347
348
349     # Print scope1.c::filelocal_ro, which is 202
350
351     if [gdb_test "print filelocal_ro" "\\\$$decimal = 202" "print filelocal_ro in test_at_bar" ] { 
352       gdb_suppress_tests ; 
353     }
354
355
356     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
357     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"] { 
358       gdb_suppress_tests ; 
359     }
360
361
362     # Print scope1.c::foo::funclocal, which is 3
363
364     if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal at bar" ] { 
365       gdb_suppress_tests ; 
366     }
367
368
369     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
370     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"] { 
371       gdb_suppress_tests ; 
372     }
373
374
375     # Print scope1.c::foo::funclocal_bss, which is 103
376
377     if [gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" "print foo::funclocal_bss at bar" ] { 
378       gdb_suppress_tests ; 
379     }
380
381
382     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
383     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"] { 
384       gdb_suppress_tests ; 
385     }
386
387
388     # Print scope1.c::foo::funclocal_ro, which is 203
389
390     if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro at bar" ] { 
391       gdb_suppress_tests ; 
392     }
393
394
395     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
396     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"] { 
397       gdb_suppress_tests ; 
398     }
399
400
401     # Print scope1.c::bar::funclocal, which is 4
402
403     if [gdb_test "print funclocal" "\\\$$decimal = 4" "print funclocal at bar" ] { 
404       gdb_suppress_tests ; 
405     }
406
407
408     if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal at bar" ] { 
409       gdb_suppress_tests ; 
410     }
411
412
413     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
414     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"] { 
415       gdb_suppress_tests ; 
416     }
417
418
419     # Print scope1.c::bar::funclocal_bss, which is 104
420
421     if [gdb_test "print funclocal_bss" "\\\$$decimal = 104" "print funclocal_bss at bar" ] { 
422       gdb_suppress_tests ; 
423     }
424
425
426     if [gdb_test "print bar::funclocal_bss" "\\\$$decimal = 104" "print bar::funclocal_bss at bar" ] { 
427       gdb_suppress_tests ; 
428     }
429
430
431     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
432     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"] { 
433       gdb_suppress_tests ; 
434     }
435     gdb_stop_suppressing_tests;
436
437 }
438
439 # This test has little to do with local scopes, but it is in scope.exp anyway.
440 # That's life.
441
442 proc test_at_autovars {} {
443     global gdb_prompt
444     global decimal
445     global hex
446     global srcfile
447
448     # Test symbol table lookup with 100 local (auto) variables.
449
450     gdb_breakpoint marker1
451
452     if [gdb_test "cont" "Break.* marker1 \\(\\) at .*:$decimal.*" "continue to marker1"] {
453         gdb_suppress_tests;
454     }
455
456     if [gdb_test "up" ".*autovars.*" "up from marker1 in scope.exp" ] { 
457         gdb_suppress_tests ; 
458     }
459
460     set count 0
461     while {$count < 100} {
462         if [gdb_test "print i$count" ".* = $count" "" ] { 
463           gdb_suppress_tests ; 
464         }
465
466         set count [expr $count+1]
467     }
468     clear_xfail "*-*-*"
469     pass "$count auto variables correctly initialized"
470
471     # Test that block variable sorting is not screwing us.
472     gdb_test "frame" "#.*autovars \\(bcd=5, abc=6\\).*" "args in correct order"
473 }
474
475 proc test_at_localscopes {} {
476     global gdb_prompt
477     global decimal
478     global hex
479     global srcfile
480
481     gdb_breakpoint marker2
482     gdb_breakpoint marker3
483     gdb_breakpoint marker4
484
485     if [gdb_test "cont" "Break.* marker2 \\(\\) at .*:$decimal.*" "continue to marker2"] {
486         gdb_suppress_tests;
487     }
488     if [gdb_test "up" ".*localscopes.*" "up from marker2 in scopes.exp" ] { 
489         gdb_suppress_tests ; 
490     }
491
492     # Should be at first (outermost) scope.  Check values.
493
494     gdb_test "print localval" " = 10" "print localval, outer scope"
495     gdb_test "print localval1" " = 11" "print localval1, outer scope"
496     gdb_test "print localval2" "No symbol \"localval2\" in current context." \
497         "print localval2, outer scope"
498     gdb_test "print localval3" "No symbol \"localval3\" in current context." \
499         "print localval3, outer scope"
500
501     if [gdb_test "cont" "Break.* marker3 \\(\\) at .*:$decimal.*" \
502         "continue to marker3 in scope.exp"] then { gdb_suppress_tests }
503     if [gdb_test "up" ".*localscopes.*" "up from marker3 in scope.exp"] { 
504         gdb_suppress_tests 
505     }
506
507     # Should be at next (first nested) scope.  Check values.
508
509     gdb_test "print localval" " = 20" \
510         "print localval, first nested scope"
511     gdb_test "print localval1" " = 11" "print localval1, first nested scope"
512     gdb_test "print localval2" " = 12" "print localval2, first nested scope"
513     gdb_test "print localval3" "No symbol \"localval3\" in current context." \
514         "print localval3, first nested scope"
515
516     # This test will only fail if the file was compiled by gcc, but
517     # there's no way to check that.
518     # OBSOLETE setup_xfail "a29k-*-udi" 2423
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 setup_xfail "powerpc-*-*"
550
551 gdb_test "print 'scope0.c'::filelocal_ro" "= 201"
552
553 # gdb currently cannot access bss memory on some targets if the inferior
554 # is not running.
555 #
556 # For PA boards using monitor/remote-pa.c, the bss test is going to 
557 # randomly fail.  We've already put remote-pa on the target stack,
558 # so we actually read memory from the board.  Problem is crt0.o
559 # is responsible for clearing bss and that hasnt' happened yet.
560 #
561 # This is a problem for all non-native targets. -- manson
562 if [is_remote target] {
563     unsupported "print 'scope0.c'::filelocal_bss before run"
564 } else {
565     gdb_test "print 'scope0.c'::filelocal_bss" "= 0" \
566         "print 'scope0.c'::filelocal_bss before run"
567 }
568
569 gdb_test "print 'scope0.c'::filelocal" "= 1" \
570     "print 'scope0.c'::filelocal before run"
571
572 if [runto_main] then { test_at_main }
573 if [istarget "mips-idt-*"] then {
574     # Restart because IDT/SIM runs out of file descriptors.
575     gdb_exit
576     gdb_start
577     gdb_reinitialize_dir $srcdir/$subdir
578     gdb_load ${binfile}
579 }
580 if [runto foo] then { test_at_foo }
581 if [istarget "mips-idt-*"] then {
582     # Restart because IDT/SIM runs out of file descriptors.
583     gdb_exit
584     gdb_start
585     gdb_reinitialize_dir $srcdir/$subdir
586     gdb_load ${binfile}
587 }
588 if [runto bar] then { test_at_bar }
589 if [istarget "mips-idt-*"] then {
590     # Restart because IDT/SIM runs out of file descriptors.
591     gdb_exit
592     gdb_start
593     gdb_reinitialize_dir $srcdir/$subdir
594     gdb_load ${binfile}
595 }
596 if [runto localscopes] then { test_at_localscopes }
597 if [istarget "mips-idt-*"] then {
598     # Restart because IDT/SIM runs out of file descriptors.
599     gdb_exit
600     gdb_start
601     gdb_reinitialize_dir $srcdir/$subdir
602     gdb_load ${binfile}
603 }
604 if [runto autovars] then { test_at_autovars }
605
606 if [istarget "*-*-vxworks*"] {
607     set timeout 120
608     verbose "Timeout is now $timeout seconds" 2
609 }