diff options
author | Bob Manson <manson@cygnus> | 1997-01-29 09:40:31 +0000 |
---|---|---|
committer | Bob Manson <manson@cygnus> | 1997-01-29 09:40:31 +0000 |
commit | 787f6220773d9174a9675dedd3bbfc8f070511a6 (patch) | |
tree | 64911c10d46bc93973cc825a730b4173b3367a49 /gdb/testsuite/gdb.base/scope.exp | |
parent | 1a2faf1f1e335ff32c1d8c5c7675cd7ce9055e33 (diff) | |
download | gdb-787f6220773d9174a9675dedd3bbfc8f070511a6.zip gdb-787f6220773d9174a9675dedd3bbfc8f070511a6.tar.gz gdb-787f6220773d9174a9675dedd3bbfc8f070511a6.tar.bz2 |
Major revision to testsuites for cross-testing and DOS testing support.
Diffstat (limited to 'gdb/testsuite/gdb.base/scope.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/scope.exp | 415 |
1 files changed, 250 insertions, 165 deletions
diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp index 5d3cf8f..e5a4fe8 100644 --- a/gdb/testsuite/gdb.base/scope.exp +++ b/gdb/testsuite/gdb.base/scope.exp @@ -26,15 +26,18 @@ if $tracelevel then { set prms_id 0 set bug_id 0 -set binfile "scope" -set srcfile $binfile.c - -if ![file exists $objdir/$subdir/$binfile] then { - perror "$objdir/$subdir/$binfile does not exist." - return 0 +set testfile "scope" +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/scope0.c ${srcdir}/${subdir}/scope1.c" "${binfile}" executable {debug}] != "" } { + perror "Couldn't compile scope0.c to object" + return -1 } -source gdb.base/scope0.ci +# Create and source the file that provides information about the compiler +# used to compile the test case. +if [get_compiler_info ${binfile}] { + return -1; +} # Test locating various things when stopped just inside main, after # running init(). To prevent cascading of errors, we report the @@ -50,20 +53,20 @@ proc test_at_main {} { # skip past init. There may be a call to __main at the start of # main, so the first next may only get us to the init call. - send "next\n" + send_gdb "next\n" expect { -re "$decimal.*foo \\(\\);\r\n$prompt $" { pass "next over init() in main" } -re "$decimal.*init \\(\\);\r\n$prompt $"\ - { send "next\n" ; exp_continue } + { send_gdb "next\n" ; exp_continue } -re "$prompt $" { fail "next over init() in main" ; return } timeout { fail "(timeout) next over init() in main" ; return } } # Print scope0.c::filelocal, which is 1 - send "print filelocal\n" + send_gdb "print filelocal\n" expect { -re "\\\$$decimal = 1\r\n$prompt $" { pass "print filelocal" } -re "$prompt $" { fail "print filelocal" ; return } @@ -72,13 +75,13 @@ proc test_at_main {} { } } - send "print 'scope0.c'::filelocal\n" + send_gdb "print 'scope0.c'::filelocal\n" expect { -re "\\\$$decimal = 1\r\n$prompt $" { pass "print 'scope0.c'::filelocal at main" } -re "No symbol \"scope0.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope0.c'::filelocal\n" + send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal\n" exp_continue } -re "$prompt $" { fail "print 'scope0.c'::filelocal at main" ; return } @@ -89,7 +92,7 @@ proc test_at_main {} { # Print scope0.c::filelocal_bss, which is 101 - send "print filelocal_bss\n" + send_gdb "print filelocal_bss\n" expect { -re "\\\$$decimal = 101\r\n$prompt $" { pass "print filelocal_bss" @@ -100,13 +103,13 @@ proc test_at_main {} { } } - send "print 'scope0.c'::filelocal_bss\n" + send_gdb "print 'scope0.c'::filelocal_bss\n" expect { -re "\\\$$decimal = 101\r\n$prompt $" { pass "print 'scope0.c'::filelocal_bss in test_at_main" } -re "No symbol \"scope0.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n" + send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n" exp_continue } -re "$prompt $" { @@ -123,7 +126,7 @@ proc test_at_main {} { # No clue why the powerpc fails this test. setup_xfail "powerpc-*-*" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print filelocal_ro\n" + send_gdb "print filelocal_ro\n" expect { -re "\\\$$decimal = 201\r\n$prompt $" { pass "print filelocal_ro in test_at_main" @@ -140,13 +143,13 @@ proc test_at_main {} { if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } setup_xfail "powerpc-*-*" - send "print 'scope0.c'::filelocal_ro\n" + send_gdb "print 'scope0.c'::filelocal_ro\n" expect { -re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" } -re "No symbol \"scope0.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n" + send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n" exp_continue } -re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return } @@ -158,13 +161,13 @@ proc test_at_main {} { # Print scope1.c::filelocal, which is 2 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::filelocal\n" + send_gdb "print 'scope1.c'::filelocal\n" expect { -re "\\\$$decimal = 2\r\n$prompt $" { pass "print 'scope1.c'::filelocal" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::filelocal\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::filelocal" ; return } @@ -176,13 +179,13 @@ proc test_at_main {} { # Print scope1.c::filelocal_bss, which is 102 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::filelocal_bss\n" + send_gdb "print 'scope1.c'::filelocal_bss\n" expect { -re "\\\$$decimal = 102\r\n$prompt $" { pass "print 'scope1.c'::filelocal_bss" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::filelocal_bss" ; return } @@ -194,13 +197,13 @@ proc test_at_main {} { # Print scope1.c::filelocal_ro, which is 202 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::filelocal_ro\n" + send_gdb "print 'scope1.c'::filelocal_ro\n" expect { -re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n" exp_continue } -re "$prompt " {fail "print 'scope1.c'::filelocal_ro" ; return } @@ -211,7 +214,8 @@ proc test_at_main {} { # Print scope1.c::foo::funclocal, which is 3 - send "print foo::funclocal\n" + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } + send_gdb "print foo::funclocal\n" expect { -re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" } -re "$prompt $" { fail "print foo::funclocal" ; return } @@ -221,13 +225,13 @@ proc test_at_main {} { } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::foo::funclocal\n" + send_gdb "print 'scope1.c'::foo::funclocal\n" expect { -re "\\\$$decimal = 3\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal" ; return } @@ -238,7 +242,7 @@ proc test_at_main {} { # Print scope1.c::foo::funclocal_ro, which is 203 - send "print foo::funclocal_ro\n" + send_gdb "print foo::funclocal_ro\n" expect { -re "\\\$$decimal = 203\r\n$prompt $" { pass "print foo::funclocal_ro" @@ -250,12 +254,12 @@ proc test_at_main {} { } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::foo::funclocal_ro\n" + send_gdb "print 'scope1.c'::foo::funclocal_ro\n" expect { -re "\\\$$decimal = 203\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_ro" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro" ; return } @@ -266,7 +270,7 @@ proc test_at_main {} { # Print scope1.c::bar::funclocal, which is 4 - send "print bar::funclocal\n" + send_gdb "print bar::funclocal\n" expect { -re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" } -re "$prompt $" { fail "print bar::funclocal" ; return } @@ -276,18 +280,18 @@ proc test_at_main {} { } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::bar::funclocal\n" + send_gdb "print 'scope1.c'::bar::funclocal\n" expect { -re "\\\$$decimal = 4\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal" ; return } timeout { - fail "print 'scope1.c'::bar::funclocal" ; return + fail "(timeout) print 'scope1.c'::bar::funclocal" ; return } } } @@ -300,7 +304,7 @@ proc test_at_foo {} { global subdir global gcc_compiled - send "next\n" + send_gdb "next\n" expect { -re ".*bar \\(\\);\r\n$prompt $" {} -re "$prompt $" { fail "continue to foo()" ; return } @@ -309,13 +313,13 @@ proc test_at_foo {} { # Print scope0.c::filelocal, which is 1 - send "print 'scope0.c'::filelocal\n" + send_gdb "print 'scope0.c'::filelocal\n" expect { -re "\\\$$decimal = 1\r\n$prompt $" { pass "print 'scope0.c'::filelocal at foo" } -re "No symbol \"scope0.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope0.c'::filelocal\n" + send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal\n" exp_continue } -re "$prompt $" { fail "print 'scope0.c'::filelocal at foo" ; return } @@ -326,13 +330,13 @@ proc test_at_foo {} { # Print scope0.c::filelocal_bss, which is 101 - send "print 'scope0.c'::filelocal_bss\n" + send_gdb "print 'scope0.c'::filelocal_bss\n" expect { -re "\\\$$decimal = 101\r\n$prompt $" { pass "print 'scope0.c'::filelocal_bss in test_at_foo" } -re "No symbol \"scope0.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n" + send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n" exp_continue } -re "$prompt $" { @@ -349,11 +353,11 @@ proc test_at_foo {} { if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } setup_xfail "powerpc-*-*" - send "print 'scope0.c'::filelocal_ro\n" + send_gdb "print 'scope0.c'::filelocal_ro\n" expect { -re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" } -re "No symbol \"scope0.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n" + send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n" exp_continue } -re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return } @@ -367,13 +371,13 @@ proc test_at_foo {} { # Print scope1.c::filelocal, which is 2 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::filelocal\n" + send_gdb "print 'scope1.c'::filelocal\n" expect { -re "\\\$$decimal = 2\r\n$prompt $" { pass "print 'scope1.c'::filelocal at foo" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::filelocal\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::filelocal at foo" ; return } @@ -386,13 +390,13 @@ proc test_at_foo {} { "print filelocal_bss at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::filelocal_bss\n" + send_gdb "print 'scope1.c'::filelocal_bss\n" expect { -re "\\\$$decimal = 102\r\n$prompt $" { pass "print 'scope1.c'::filelocal_bss at foo" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::filelocal_bss at foo" } @@ -405,11 +409,11 @@ proc test_at_foo {} { "print filelocal_ro at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::filelocal_ro\n" + send_gdb "print 'scope1.c'::filelocal_ro\n" expect { -re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro at foo" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::filelocal_ro at foo" } @@ -422,17 +426,19 @@ proc test_at_foo {} { gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo" + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print foo::funclocal" "\\\$$decimal = 3" \ "print foo::funclocal at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::foo::funclocal\n" + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } + send_gdb "print 'scope1.c'::foo::funclocal\n" expect { -re "\\\$$decimal = 3\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal at foo" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal at foo" } @@ -446,17 +452,19 @@ proc test_at_foo {} { gdb_test "print funclocal_bss" "\\\$$decimal = 103" \ "print funclocal_bss at foo" + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \ "print foo::funclocal_bss at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::foo::funclocal_bss\n" + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } + send_gdb "print 'scope1.c'::foo::funclocal_bss\n" expect { -re "\\\$$decimal = 103\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_bss at foo" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n" exp_continue } -re "$prompt $" { @@ -472,17 +480,19 @@ proc test_at_foo {} { gdb_test "print funclocal_ro" "\\\$$decimal = 203" \ "print funclocal_ro at foo" + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \ "print foo::funclocal_ro at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::foo::funclocal_ro\n" + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } + send_gdb "print 'scope1.c'::foo::funclocal_ro\n" expect { -re "\\\$$decimal = 203\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_ro at foo" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro at foo" } @@ -493,17 +503,19 @@ proc test_at_foo {} { # Print scope1.c::bar::funclocal, which is 4 + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print bar::funclocal" "\\\$$decimal = 4" \ "print bar::funclocal at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::bar::funclocal\n" + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } + send_gdb "print 'scope1.c'::bar::funclocal\n" expect { -re "\\\$$decimal = 4\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal at foo" } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n" exp_continue } -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal at foo" } @@ -521,24 +533,26 @@ proc test_at_bar {} { global subdir global gcc_compiled - send "next\n" + send_gdb "next\n" expect { -re ".*$prompt $" {} - timeout { fail "next in bar()" ; return } + timeout { fail "(timeout) next in bar()" ; return } } # Print scope0.c::filelocal, which is 1 - send "print 'scope0.c'::filelocal\n" + send_gdb "print 'scope0.c'::filelocal\n" expect { -re "\\\$$decimal = 1\r\n$prompt $" { pass "print 'scope0.c'::filelocal at bar" } -re "No symbol \"scope0.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope0.c'::filelocal\n" + send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal\n" exp_continue } - -re "$prompt $" { fail "print 'scope0.c'::filelocal at bar" ; return } + -re "$prompt $" { + fail "print 'scope0.c'::filelocal at bar" ; return + } timeout { fail "(timeout) print 'scope0.c'::filelocal at bar" ; return } @@ -546,13 +560,13 @@ proc test_at_bar {} { # Print scope0.c::filelocal_bss, which is 101 - send "print 'scope0.c'::filelocal_bss\n" + send_gdb "print 'scope0.c'::filelocal_bss\n" expect { -re "\\\$$decimal = 101\r\n$prompt $" { pass "print 'scope0.c'::filelocal_bss in test_at_bar" } -re "No symbol \"scope0.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n" + send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n" exp_continue } -re "$prompt $" { @@ -569,72 +583,92 @@ proc test_at_bar {} { if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } setup_xfail "powerpc-*-*" - send "print 'scope0.c'::filelocal_ro\n" + send_gdb "print 'scope0.c'::filelocal_ro\n" expect { - -re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" } + -re "\\\$$decimal = 201\r\n$prompt $" { + pass "print 'scope0.c'::filelocal_ro at bar" + } -re "No symbol \"scope0.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n" + send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n" exp_continue } - -re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return } + -re "$prompt $" { + fail "print 'scope0.c'::filelocal_ro at bar" ; return + } timeout { - fail "(timeout) print 'scope0.c'::filelocal_ro" ; return + fail "(timeout) print 'scope0.c'::filelocal_ro at bar" ; return } } # Print scope1.c::filelocal, which is 2 - send "print filelocal\n" + send_gdb "print filelocal\n" expect { - -re "\\\$$decimal = 2\r\n$prompt $" { pass "print filelocal" } - -re "$prompt $" { fail "print filelocal" ; return } + -re "\\\$$decimal = 2\r\n$prompt $" { + pass "print filelocal at bar" + } + -re "$prompt $" { + fail "print filelocal at bar" ; return + } timeout { - fail "(timeout) print filelocal" ; return + fail "(timeout) print filelocal at bar" ; return } } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::filelocal\n" + send_gdb "print 'scope1.c'::filelocal\n" expect { - -re "\\\$$decimal = 2\r\n$prompt $" { pass "print 'scope1.c'::filelocal" } + -re "\\\$$decimal = 2\r\n$prompt $" { + pass "print 'scope1.c'::filelocal at bar" + } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::filelocal\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal\n" exp_continue } - -re "$prompt $" { fail "print 'scope1.c'::filelocal" ; return } + -re "$prompt $" { + fail "print 'scope1.c'::filelocal at bar" ; return + } timeout { - fail "(timeout) print 'scope1.c'::filelocal" ; return + fail "(timeout) print 'scope1.c'::filelocal at bar" ; return } } # Print scope1.c::filelocal_bss, which is 102 - send "print filelocal_bss\n" + send_gdb "print filelocal_bss\n" expect { - -re "\\\$$decimal = 102\r\n$prompt $" { pass "print filelocal_bss" } - -re "$prompt $" { fail "print filelocal_bss" ; return } + -re "\\\$$decimal = 102\r\n$prompt $" { + pass "print filelocal_bss at bar" + } + -re "$prompt $" { + fail "print filelocal_bss at bar" ; return + } timeout { - fail "(timeout) print filelocal_bss" ; return + fail "(timeout) print filelocal_bss at bar" ; return } } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::filelocal_bss\n" + send_gdb "print 'scope1.c'::filelocal_bss\n" expect { - -re "\\\$$decimal = 102\r\n$prompt $" { pass "print 'scope1.c'::filelocal_bss" } + -re "\\\$$decimal = 102\r\n$prompt $" { + pass "print 'scope1.c'::filelocal_bss at bar" + } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n" exp_continue } - -re "$prompt $" { fail "print 'scope1.c'::filelocal_bss" ; return } + -re "$prompt $" { + fail "print 'scope1.c'::filelocal_bss at bar" ; return + } timeout { - fail "(timeout) print 'scope1.c'::filelocal_bss" ; return + fail "(timeout) print 'scope1.c'::filelocal_bss at bar" ; return } } # Print scope1.c::filelocal_ro, which is 202 - send "print filelocal_ro\n" + send_gdb "print filelocal_ro\n" expect { -re "\\\$$decimal = 202\r\n$prompt $" { pass "print filelocal_ro in test_at_bar" @@ -650,159 +684,212 @@ proc test_at_bar {} { } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::filelocal_ro\n" + send_gdb "print 'scope1.c'::filelocal_ro\n" expect { - -re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro" } + -re "\\\$$decimal = 202\r\n$prompt $" { + pass "print 'scope1.c'::filelocal_ro at bar" + } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n" exp_continue } - -re "$prompt $" { fail "print 'scope1.c'::filelocal_ro" ; return } + -re "$prompt $" { + fail "print 'scope1.c'::filelocal_ro at bar" ; return + } timeout { - fail "(timeout) print 'scope1.c'::filelocal_ro" ; return + fail "(timeout) print 'scope1.c'::filelocal_ro at bar" ; return } } # Print scope1.c::foo::funclocal, which is 3 - send "print foo::funclocal\n" + if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } + send_gdb "print foo::funclocal\n" expect { - -re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" } - -re "$prompt $" { fail "print foo::funclocal" ; return } + -re "\\\$$decimal = 3\r\n$prompt $" { + pass "print foo::funclocal at bar" + } + -re "$prompt $" { + fail "print foo::funclocal at bar" ; return + } timeout { - fail "(timeout) print foo::funclocal" ; return + fail "(timeout) print foo::funclocal at bar" ; return } } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::foo::funclocal\n" + send_gdb "print 'scope1.c'::foo::funclocal\n" expect { - -re "\\\$$decimal = 3\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal" } + -re "\\\$$decimal = 3\r\n$prompt $" { + pass "print 'scope1.c'::foo::funclocal at bar" + } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n" exp_continue } - -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal" ; return } + -re "$prompt $" { + fail "print 'scope1.c'::foo::funclocal at bar" ; return + } timeout { - fail "(timeout) print 'scope1.c'::foo::funclocal" ; return + fail "(timeout) print 'scope1.c'::foo::funclocal at bar" ; return } } # Print scope1.c::foo::funclocal_bss, which is 103 - send "print foo::funclocal_bss\n" + send_gdb "print foo::funclocal_bss\n" expect { - -re "\\\$$decimal = 103\r\n$prompt $" { pass "print foo::funclocal_bss" } - -re "$prompt $" { fail "print foo::funclocal_bss" ; return } + -re "\\\$$decimal = 103\r\n$prompt $" { + pass "print foo::funclocal_bss at bar" + } + -re "$prompt $" { + fail "print foo::funclocal_bss at bar" ; return + } timeout { - fail "(timeout) print foo::funclocal_bss" ; return + fail "(timeout) print foo::funclocal_bss at bar" ; return } } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::foo::funclocal_bss\n" + send_gdb "print 'scope1.c'::foo::funclocal_bss\n" expect { - -re "\\\$$decimal = 103\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_bss" } + -re "\\\$$decimal = 103\r\n$prompt $" { + pass "print 'scope1.c'::foo::funclocal_bss at bar" + } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n" exp_continue } - -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_bss" ; return } + -re "$prompt $" { + fail "print 'scope1.c'::foo::funclocal_bss at bar" ; return + } timeout { - fail "(timeout) print 'scope1.c'::foo::funclocal_bss" ; return + fail "(timeout) print 'scope1.c'::foo::funclocal_bss at bar" ; return } } # Print scope1.c::foo::funclocal_ro, which is 203 - send "print foo::funclocal_ro\n" + send_gdb "print foo::funclocal_ro\n" expect { - -re "\\\$$decimal = 203\r\n$prompt $" { pass "print foo::funclocal_ro" } - -re "$prompt $" { fail "print foo::funclocal_ro" ; return } + -re "\\\$$decimal = 203\r\n$prompt $" { + pass "print foo::funclocal_ro at bar" + } + -re "$prompt $" { + fail "print foo::funclocal_ro at bar" ; return + } timeout { - fail "(timeout) print foo::funclocal_ro" ; return + fail "(timeout) print foo::funclocal_ro at bar" ; return } } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::foo::funclocal_ro\n" + send_gdb "print 'scope1.c'::foo::funclocal_ro\n" expect { - -re "\\\$$decimal = 203\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_ro" } + -re "\\\$$decimal = 203\r\n$prompt $" { + pass "print 'scope1.c'::foo::funclocal_ro at bar" + } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n" exp_continue } - -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro" ; return } + -re "$prompt $" { + fail "print 'scope1.c'::foo::funclocal_ro at bar" ; return + } timeout { - fail "(timeout) print 'scope1.c'::foo::funclocal_ro" ; return + fail "(timeout) print 'scope1.c'::foo::funclocal_ro at bar" ; return } } # Print scope1.c::bar::funclocal, which is 4 - send "print funclocal\n" + send_gdb "print funclocal\n" expect { - -re "\\\$$decimal = 4\r\n$prompt $" { pass "print funclocal" } - -re "$prompt $" { fail "print funclocal" ; return } + -re "\\\$$decimal = 4\r\n$prompt $" { + pass "print funclocal at bar" + } + -re "$prompt $" { + fail "print funclocal at bar" ; return + } timeout { - fail "(timeout) print funclocal" ; return + fail "(timeout) print funclocal at bar" ; return } } - send "print bar::funclocal\n" + send_gdb "print bar::funclocal\n" expect { - -re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" } - -re "$prompt $" { fail "print bar::funclocal" ; return } + -re "\\\$$decimal = 4\r\n$prompt $" { + pass "print bar::funclocal at bar" + } + -re "$prompt $" { + fail "print bar::funclocal at bar" ; return + } timeout { - fail "(timeout) print bar::funclocal" ; return + fail "(timeout) print bar::funclocal at bar" ; return } } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::bar::funclocal\n" + send_gdb "print 'scope1.c'::bar::funclocal\n" expect { - -re "\\\$$decimal = 4\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal" } + -re "\\\$$decimal = 4\r\n$prompt $" { + pass "print 'scope1.c'::bar::funclocal at bar" + } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n" exp_continue } - -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal" ; return } + -re "$prompt $" { + fail "print 'scope1.c'::bar::funclocal at bar" ; return + } timeout { - fail "(timeout) print 'scope1.c'::bar::funclocal" ; return + fail "(timeout) print 'scope1.c'::bar::funclocal at bar" ; return } } # Print scope1.c::bar::funclocal_bss, which is 104 - send "print funclocal_bss\n" + send_gdb "print funclocal_bss\n" expect { - -re "\\\$$decimal = 104\r\n$prompt $" { pass "print funclocal_bss" } - -re "$prompt $" { fail "print funclocal_bss" ; return } + -re "\\\$$decimal = 104\r\n$prompt $" { + pass "print funclocal_bss at bar" + } + -re "$prompt $" { + fail "print funclocal_bss at bar" ; return + } timeout { - fail "(timeout) print funclocal_bss" ; return + fail "(timeout) print funclocal_bss at bar" ; return } } - send "print bar::funclocal_bss\n" + send_gdb "print bar::funclocal_bss\n" expect { - -re "\\\$$decimal = 104\r\n$prompt $" { pass "print bar::funclocal_bss" } - -re "$prompt $" { fail "print bar::funclocal_bss" ; return } + -re "\\\$$decimal = 104\r\n$prompt $" { + pass "print bar::funclocal_bss at bar" + } + -re "$prompt $" { + fail "print bar::funclocal_bss at bar" ; return + } timeout { - fail "(timeout) print bar::funclocal_bss" ; return + fail "(timeout) print bar::funclocal_bss at bar" ; return } } if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - send "print 'scope1.c'::bar::funclocal_bss\n" + send_gdb "print 'scope1.c'::bar::funclocal_bss\n" expect { - -re "\\\$$decimal = 104\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal_bss" } + -re "\\\$$decimal = 104\r\n$prompt $" { + pass "print 'scope1.c'::bar::funclocal_bss at bar" + } -re "No symbol \"scope1.c\" in current context.*$prompt $" { - send "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss\n" + send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss\n" exp_continue } - -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal_bss" ; return } + -re "$prompt $" { + fail "print 'scope1.c'::bar::funclocal_bss at bar" ; return + } timeout { - fail "(timeout) print 'scope1.c'::bar::funclocal_bss" ; return + fail "(timeout) print 'scope1.c'::bar::funclocal_bss at bar" ; return } } } @@ -818,15 +905,15 @@ proc test_at_autovars {} { # Test symbol table lookup with 100 local (auto) variables. - send "break marker1\n" ; expect -re ".*$prompt $" + send_gdb "break marker1\n" ; expect -re ".*$prompt $" - send "cont\n" + send_gdb "cont\n" expect { -re "Break.* marker1 \\(\\) at .*:$decimal.*$prompt $" { - send "up\n" + send_gdb "up\n" expect { -re ".*$prompt $" {} - timeout { fail "up from marker1" ; return } + timeout { fail "(timeout) up from marker1" ; return } } } -re "$prompt $" { fail "continue to marker1" ; return } @@ -835,7 +922,7 @@ proc test_at_autovars {} { set count 0 while {$count < 100} { - send "print i$count\n" + send_gdb "print i$count\n" expect { -re ".* = $count\r\n$prompt $" {} -re "$prompt $" { @@ -860,17 +947,17 @@ proc test_at_localscopes {} { global hex global srcfile - send "break marker2\n" ; expect -re ".*$prompt $" - send "break marker3\n" ; expect -re ".*$prompt $" - send "break marker4\n" ; expect -re ".*$prompt $" + send_gdb "break marker2\n" ; expect -re ".*$prompt $" + send_gdb "break marker3\n" ; expect -re ".*$prompt $" + send_gdb "break marker4\n" ; expect -re ".*$prompt $" - send "cont\n" + send_gdb "cont\n" expect { -re "Break.* marker2 \\(\\) at .*:$decimal.*$prompt $" { - send "up\n" + send_gdb "up\n" expect { -re ".*$prompt $" {} - timeout { fail "up from marker2" ; return } + timeout { fail "(timeout) up from marker2" ; return } } } -re "$prompt $" { fail "continue to marker2" ; return } @@ -917,10 +1004,11 @@ proc test_at_localscopes {} { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -gdb_load $objdir/$subdir/$binfile +gdb_load ${binfile} if [istarget "*-*-vxworks*"] { set timeout 120 + verbose "Timeout is now $timeout seconds" 2 } # Test that variables in various segments print out correctly before @@ -940,8 +1028,7 @@ gdb_test "print 'scope0.c'::filelocal_ro" "= 201" # so we actually read memory from the board. Problem is crt0.o # is responsible for clearing bss and that hasnt' happened yet. setup_xfail "hppa*-*-*pro*" -if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } -send "print 'scope0.c'::filelocal_bss\n" +send_gdb "print 'scope0.c'::filelocal_bss\n" expect { -re " = 0\r\n$prompt $" { pass "print 'scope0.c'::filelocal_bss before run" @@ -958,9 +1045,6 @@ expect { } } -# AIX--sections get mapped to the same address so we can't get the right one. -setup_xfail "rs6000-*-*" - gdb_test "print 'scope0.c'::filelocal" "= 1" \ "print 'scope0.c'::filelocal before run" @@ -970,7 +1054,7 @@ if [istarget "mips-idt-*"] then { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load $objdir/$subdir/$binfile + gdb_load ${binfile} } if [runto foo] then { test_at_foo } if [istarget "mips-idt-*"] then { @@ -978,7 +1062,7 @@ if [istarget "mips-idt-*"] then { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load $objdir/$subdir/$binfile + gdb_load ${binfile} } if [runto bar] then { test_at_bar } if [istarget "mips-idt-*"] then { @@ -986,7 +1070,7 @@ if [istarget "mips-idt-*"] then { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load $objdir/$subdir/$binfile + gdb_load ${binfile} } if [runto localscopes] then { test_at_localscopes } if [istarget "mips-idt-*"] then { @@ -994,10 +1078,11 @@ if [istarget "mips-idt-*"] then { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load $objdir/$subdir/$binfile + gdb_load ${binfile} } if [runto autovars] then { test_at_autovars } if [istarget "*-*-vxworks*"] { set timeout 120 + verbose "Timeout is now $timeout seconds" 2 } |