Home | History | Annotate | Line # | Download | only in gdb.base
scope.exp revision 1.1.1.5
      1 # Copyright 1992-2019 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 {[build_executable "failed to build" ${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 
     43     # skip past init0.
     44     # This used to do an extra "next" if the first one didn't get us
     45     # over the call to init0, to handle calls to __main in the
     46     # prologue, etc.  But if a breakpoint at main doesn't leave us on
     47     # the first line of real code in the function, that's a GDB bug.
     48     gdb_test "next" "$decimal.*foo \\(\\);" "next over init0() in main"
     49 
     50     # Print scope0.c::filelocal, which is 1
     51 
     52     if [gdb_test "print filelocal" "\\\$$decimal = 1" "print filelocal" ] {
     53       gdb_suppress_tests
     54     }
     55 
     56 
     57     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"] {
     58       gdb_suppress_tests
     59     }
     60 
     61 
     62     # Print scope0.c::filelocal_bss, which is 101
     63 
     64     if [gdb_test "print filelocal_bss" "\\\$$decimal = 101" "print filelocal_bss" ] {
     65       gdb_suppress_tests
     66     }
     67 
     68 
     69     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"] {
     70       gdb_suppress_tests
     71     }
     72 
     73 
     74     # Print scope0.c::filelocal_ro, which is 201
     75 
     76     # No clue why the rs6000 fails this test.
     77     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     78     if [gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro in test_at_main" ] {
     79       gdb_suppress_tests
     80     }
     81 
     82 
     83     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     84     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"] {
     85       gdb_suppress_tests
     86     }
     87 
     88 
     89     # Print scope1.c::filelocal, which is 2
     90 
     91     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     92     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"] {
     93       gdb_suppress_tests
     94     }
     95 
     96 
     97     # Print scope1.c::filelocal_bss, which is 102
     98 
     99     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    100     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"] {
    101       gdb_suppress_tests
    102     }
    103 
    104 
    105     # Print scope1.c::filelocal_ro, which is 202
    106 
    107     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    108     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"] {
    109       gdb_suppress_tests
    110     }
    111 
    112 
    113     # Print scope1.c::foo::funclocal, which is 3
    114 
    115     if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal" ] {
    116       gdb_suppress_tests
    117     }
    118 
    119 
    120     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    121     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"] {
    122       gdb_suppress_tests
    123     }
    124 
    125 
    126     # Print scope1.c::foo::funclocal_ro, which is 203
    127 
    128     if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro" ] {
    129       gdb_suppress_tests
    130     }
    131 
    132 
    133     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    134     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"] {
    135       gdb_suppress_tests
    136     }
    137 
    138 
    139     # Print scope1.c::bar::funclocal, which is 4
    140 
    141     if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal" ] {
    142       gdb_suppress_tests
    143     }
    144 
    145 
    146     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    147     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"] {
    148       gdb_suppress_tests
    149     }
    150     gdb_stop_suppressing_tests
    151 
    152 }
    153 
    154 proc test_at_foo {} {
    155     global gdb_prompt
    156     global decimal
    157     global det_file
    158     global srcdir
    159     global subdir
    160 
    161     if [gdb_test "next" ".*bar \\(\\);" "" ] {
    162       gdb_suppress_tests
    163     }
    164 
    165 
    166     # Print scope0.c::filelocal, which is 1
    167 
    168     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"] {
    169       gdb_suppress_tests
    170     }
    171 
    172 
    173     # Print scope0.c::filelocal_bss, which is 101
    174 
    175     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"] {
    176       gdb_suppress_tests
    177     }
    178 
    179 
    180     # Print scope0.c::filelocal_ro, which is 201
    181 
    182     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    183     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"] {
    184       gdb_suppress_tests
    185     }
    186 
    187 
    188     gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo"
    189 
    190     # Print scope1.c::filelocal, which is 2
    191 
    192     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    193     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"] {
    194       gdb_suppress_tests
    195     }
    196 
    197 
    198     gdb_test "print filelocal_bss" "\\\$$decimal = 102" \
    199 	"print filelocal_bss at foo"
    200 
    201     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    202     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"
    203 
    204 
    205     gdb_test "print filelocal_ro" "\\\$$decimal = 202" \
    206 	"print filelocal_ro at foo"
    207 
    208     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    209     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"
    210 
    211 
    212     # Print scope1.c::foo::funclocal, which is 3
    213 
    214     gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo"
    215 
    216     gdb_test "print foo::funclocal" "\\\$$decimal = 3" \
    217 	"print foo::funclocal at foo"
    218 
    219     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    220     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"
    221 
    222 
    223     # Print scope1.c::foo::funclocal_bss, which is 103
    224 
    225     gdb_test "print funclocal_bss" "\\\$$decimal = 103" \
    226 	"print funclocal_bss at foo"
    227 
    228     gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \
    229 	"print foo::funclocal_bss at foo"
    230 
    231     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    232     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"
    233 
    234 
    235     # Print scope1.c::foo::funclocal_ro, which is 203
    236 
    237     gdb_test "print funclocal_ro" "\\\$$decimal = 203" \
    238 	"print funclocal_ro at foo"
    239 
    240     gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \
    241 	"print foo::funclocal_ro at foo"
    242 
    243     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    244     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"
    245 
    246 
    247     # Print scope1.c::bar::funclocal, which is 4
    248 
    249     gdb_test "print bar::funclocal" "\\\$$decimal = 4" \
    250 	"print bar::funclocal at foo"
    251 
    252     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    253     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"
    254     gdb_stop_suppressing_tests
    255 
    256 }
    257 
    258 proc test_at_bar {} {
    259     global gdb_prompt
    260     global decimal
    261     global det_file
    262     global srcdir
    263     global subdir
    264 
    265     if [gdb_test "next" ".*" "" ] {
    266       gdb_suppress_tests
    267     }
    268 
    269 
    270     # Print scope0.c::filelocal, which is 1
    271 
    272     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"] {
    273       gdb_suppress_tests
    274     }
    275 
    276 
    277    # Print scope0.c::filelocal_bss, which is 101
    278 
    279     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"] {
    280       gdb_suppress_tests
    281     }
    282 
    283 
    284    # Print scope0.c::filelocal_ro, which is 201
    285 
    286     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    287     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"] {
    288       gdb_suppress_tests
    289     }
    290 
    291 
    292     # Print scope1.c::filelocal, which is 2
    293 
    294     if [gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at bar" ] {
    295       gdb_suppress_tests
    296     }
    297 
    298 
    299     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    300     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"] {
    301       gdb_suppress_tests
    302     }
    303 
    304 
    305     # Print scope1.c::filelocal_bss, which is 102
    306 
    307     if [gdb_test "print filelocal_bss" "\\\$$decimal = 102" "print filelocal_bss at bar" ] {
    308       gdb_suppress_tests
    309     }
    310 
    311 
    312     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    313     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"] {
    314       gdb_suppress_tests
    315     }
    316 
    317 
    318     # Print scope1.c::filelocal_ro, which is 202
    319 
    320     if [gdb_test "print filelocal_ro" "\\\$$decimal = 202" "print filelocal_ro in test_at_bar" ] {
    321       gdb_suppress_tests
    322     }
    323 
    324 
    325     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    326     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"] {
    327       gdb_suppress_tests
    328     }
    329 
    330 
    331     # Print scope1.c::foo::funclocal, which is 3
    332 
    333     if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal at bar" ] {
    334       gdb_suppress_tests
    335     }
    336 
    337 
    338     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    339     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"] {
    340       gdb_suppress_tests
    341     }
    342 
    343 
    344     # Print scope1.c::foo::funclocal_bss, which is 103
    345 
    346     if [gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" "print foo::funclocal_bss at bar" ] {
    347       gdb_suppress_tests
    348     }
    349 
    350 
    351     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    352     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"] {
    353       gdb_suppress_tests
    354     }
    355 
    356 
    357     # Print scope1.c::foo::funclocal_ro, which is 203
    358 
    359     if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro at bar" ] {
    360       gdb_suppress_tests
    361     }
    362 
    363 
    364     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    365     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"] {
    366       gdb_suppress_tests
    367     }
    368 
    369 
    370     # Print scope1.c::bar::funclocal, which is 4
    371 
    372     if [gdb_test "print funclocal" "\\\$$decimal = 4" "print funclocal at bar" ] {
    373       gdb_suppress_tests
    374     }
    375 
    376 
    377     if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal at bar" ] {
    378       gdb_suppress_tests
    379     }
    380 
    381 
    382     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    383     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"] {
    384       gdb_suppress_tests
    385     }
    386 
    387 
    388     # Print scope1.c::bar::funclocal_bss, which is 104
    389 
    390     if [gdb_test "print funclocal_bss" "\\\$$decimal = 104" "print funclocal_bss at bar" ] {
    391       gdb_suppress_tests
    392     }
    393 
    394 
    395     if [gdb_test "print bar::funclocal_bss" "\\\$$decimal = 104" "print bar::funclocal_bss at bar" ] {
    396       gdb_suppress_tests
    397     }
    398 
    399 
    400     if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
    401     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"] {
    402       gdb_suppress_tests
    403     }
    404     gdb_stop_suppressing_tests
    405 
    406 }
    407 
    408 # This test has little to do with local scopes, but it is in scope.exp anyway.
    409 # That's life.
    410 
    411 proc test_at_autovars {} {
    412     global gdb_prompt
    413     global decimal
    414     global hex
    415     global srcfile
    416 
    417     # Test symbol table lookup with 100 local (auto) variables.
    418 
    419     gdb_breakpoint marker1
    420 
    421     if [gdb_test "cont" "Break.* marker1 \\(\\) at .*:$decimal.*" "continue to marker1"] {
    422 	gdb_suppress_tests
    423     }
    424 
    425     if [gdb_test "up" ".*autovars.*" "up from marker1 in scope.exp" ] {
    426 	gdb_suppress_tests
    427     }
    428 
    429     set count 0
    430     while {$count < 100} {
    431 	if [gdb_test "print i$count" ".* = $count" "" ] {
    432 	  gdb_suppress_tests
    433 	}
    434 
    435 	set count [expr $count+1]
    436     }
    437     clear_xfail "*-*-*"
    438     pass "$count auto variables correctly initialized"
    439 
    440     # Test that block variable sorting is not screwing us.
    441     gdb_test "frame" "#.*autovars \\(bcd=5, abc=6\\).*" "args in correct order"
    442 }
    443 
    444 proc test_at_localscopes {} {
    445     global gdb_prompt
    446     global decimal
    447     global hex
    448     global srcfile
    449 
    450     gdb_breakpoint marker2
    451     gdb_breakpoint marker3
    452     gdb_breakpoint marker4
    453 
    454     if [gdb_test "cont" "Break.* marker2 \\(\\) at .*:$decimal.*" "continue to marker2"] {
    455 	gdb_suppress_tests
    456     }
    457     if [gdb_test "up" ".*localscopes.*" "up from marker2 in scopes.exp" ] {
    458 	gdb_suppress_tests
    459     }
    460 
    461     # Should be at first (outermost) scope.  Check values.
    462 
    463     gdb_test "print localval" " = 10" "print localval, outer scope"
    464     gdb_test "print localval1" " = 11" "print localval1, outer scope"
    465     gdb_test "print localval2" "No symbol \"localval2\" in current context." \
    466 	"print localval2, outer scope"
    467     gdb_test "print localval3" "No symbol \"localval3\" in current context." \
    468 	"print localval3, outer scope"
    469 
    470     if [gdb_test "cont" "Break.* marker3 \\(\\) at .*:$decimal.*" \
    471 	"continue to marker3 in scope.exp"] then { gdb_suppress_tests }
    472     if [gdb_test "up" ".*localscopes.*" "up from marker3 in scope.exp"] {
    473 	gdb_suppress_tests
    474     }
    475 
    476     # Should be at next (first nested) scope.  Check values.
    477 
    478     gdb_test "print localval" " = 20" \
    479 	"print localval, first nested scope"
    480     gdb_test "print localval1" " = 11" "print localval1, first nested scope"
    481     gdb_test "print localval2" " = 12" "print localval2, first nested scope"
    482     gdb_test "print localval3" "No symbol \"localval3\" in current context." \
    483 	"print localval3, first nested scope"
    484 
    485     # This test will only fail if the file was compiled by gcc, but
    486     # there's no way to check that.
    487     if [gdb_test "cont" "Break.* marker4.*at .*:$decimal.*" \
    488 	"continue to marker4 in scope.exp"] then { gdb_suppress_tests }
    489     if [gdb_test "up" ".*localscopes.*" "up from marker4 in scope.exp"] {
    490 	gdb_suppress_tests
    491     }
    492 
    493     gdb_test "print localval" " = 30" "print localval, innermost scope"
    494     gdb_test "print localval1" " = 11" "print localval1, innermost scope"
    495     gdb_test "print localval2" " = 12" "print localval2, innermost scope"
    496     gdb_test "print localval3" " = 13" "print localval3, innermost scope"
    497     gdb_stop_suppressing_tests
    498 }
    499 
    500 # Note, we don't pass a binfile to clean_restart because we need to
    501 # avoid gdb_load here.  With remote targets, gdb_load connects to the
    502 # remote target, and we specificaly want the following tests to run
    503 # before the program is started.
    504 clean_restart
    505 gdb_file_cmd $binfile
    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 # Check that gdb can access bss memory if the inferior is not running.
    516 #
    517 # Note the care above about avoiding gdb_load.  Otherwise, for
    518 # embedded stub-like boards, this test would randomly fail.  If we'd
    519 # already put target remote on the target stack, we'd read memory from
    520 # the board instead of the program's binary, and we would have
    521 # connected before crt0.o had had a chance to clear bss.
    522 gdb_test "print 'scope0.c'::filelocal_bss" "= 0" \
    523     "print 'scope0.c'::filelocal_bss before run"
    524 
    525 gdb_test "print 'scope0.c'::filelocal" "= 1" \
    526     "print 'scope0.c'::filelocal before run"
    527 
    528 if [runto_main] then { test_at_main }
    529 if [runto foo] then { test_at_foo }
    530 if [runto bar] then { test_at_bar }
    531 if [runto localscopes] then { test_at_localscopes }
    532 if [runto autovars] then { test_at_autovars }
    533