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