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