diff options
author | Jason Molenda <jmolenda@apple.com> | 1999-08-31 01:14:27 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1999-08-31 01:14:27 +0000 |
commit | 104c1213b4821a4b8664e66db4643a951b461576 (patch) | |
tree | d77adb32fcf044a485e1d4e0bb58e9da0ce39671 /gdb/testsuite/gdb.base | |
parent | fd485a97b145f7b8abe7c5f5ec63edd8268a4182 (diff) | |
download | gdb-104c1213b4821a4b8664e66db4643a951b461576.zip gdb-104c1213b4821a4b8664e66db4643a951b461576.tar.gz gdb-104c1213b4821a4b8664e66db4643a951b461576.tar.bz2 |
import gdb-1999-08-30 snapshot
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r-- | gdb/testsuite/gdb.base/async.c | 48 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/async.exp | 153 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/break.exp | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/display.exp | 21 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/dollar.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/ending-run.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/signals.exp | 2 |
7 files changed, 231 insertions, 6 deletions
diff --git a/gdb/testsuite/gdb.base/async.c b/gdb/testsuite/gdb.base/async.c new file mode 100644 index 0000000..0d9c875 --- /dev/null +++ b/gdb/testsuite/gdb.base/async.c @@ -0,0 +1,48 @@ + + +#ifdef PROTOTYPES +int +foo (void) +#else +int +foo () +#endif +{ + int x, y; + + x = 5; + y = 3; + + return x + y; +} + +#ifdef PROTOTYPES +int +main (void) +#else +int +main () +#endif +{ + int y, z; + + y = 2; + z = 9; + y = foo (); + z = y; + y = y + 2; + y = baz (); + return 0; +} + + +#ifdef PROTOTYPES +int +baz (void) +#else +int +baz () +#endif +{ + return 5; +} diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp new file mode 100644 index 0000000..4a97f9c --- /dev/null +++ b/gdb/testsuite/gdb.base/async.exp @@ -0,0 +1,153 @@ +# Copyright (C) 1999 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + + +if $tracelevel then { + strace $tracelevel +} + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "async" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile}] { + return -1 +} + +######################################## +## +## Don't do any of these tests until we reach consensus on this file. +## +return 0 +######################################## + +set board [target_info name] +set current_target [target_info gdb_protocol] +if { $current_target == "remote" } { + unset_board_info "gdb_protocol" + set_board_info "gdb_protocol" "async" + } else { + return 0 + } + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} +if [target_info exists gdb_stub] { + gdb_step_for_stub; +} + +# +# set it up at a breakpoint so we can play with it +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +gdb_test "break baz" "" "" + +# +# Make sure we get a 'completed' message when the target is done. +# +gdb_test "set display-exec-done on" "" "" + + +send_gdb "next&\n" +gdb_expect { + -re "^next&\r\n$gdb_prompt.*z = 9.*completed\.\r\n" { pass "next &" } + -re "$gdb_prompt.*completed\.$" { fail "next &" } + timeout { fail "(timeout) next &" } +} + +send_gdb "step&\n" +gdb_expect { + -re "^step&\r\n$gdb_prompt.*y = foo \\(\\).*completed\.\r\n" { pass "step &" } + -re "$gdb_prompt.*completed\.$" { fail "step &" } + timeout { fail "(timeout) step &" } +} + +send_gdb "step&\n" +gdb_expect { + -re "^step&\r\n$gdb_prompt foo \\(\\) at .*async.c.*x = 5.*completed\.\r\n" \ + { pass "step &" } + -re "$gdb_prompt.*completed\.$" { fail "step &" } + timeout { fail "(timeout) step &" } +} + +send_gdb "stepi&\n" +gdb_expect { + -re "^stepi&\r\n$gdb_prompt.*$hex.*x = 5.*completed\.\r\n" { pass "stepi &" } + -re "$gdb_prompt.*completed\.$" { fail "stepi &" } + timeout { fail "(timeout) stepi &" } +} + +send_gdb "nexti&\n" +gdb_expect { + -re "^nexti&\r\n$gdb_prompt.*y = 3.*completed\.\r\n" { pass "nexti &" } + -re "$gdb_prompt.*completed\.$" { fail "nexti &" } + timeout { fail "(timeout) nexti &" } +} + +send_gdb "finish&\n" +gdb_expect { + -re "^finish&\r\nRun till exit from #0 foo \\(\\) at.*async.c.*\r\n$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = foo \\(\\).*Value returned is.*= 8.*completed\.\r\n" \ + { pass "finish &" } + -re "$gdb_prompt.*completed\.$" { fail "finish &" } + timeout { fail "(timeout) finish &" } +} + +send_gdb "jump 33&\n" +gdb_expect { + -re "^jump 33&.*Continuing at $hex.*$gdb_prompt.*Breakpoint 2, baz \\(\\) at.*async.c.*return 5.*completed\.\r\n" \ + { pass "jump &" } + -re ".*$gdb_prompt.*completed\.$" { fail "jump &" } + timeout { fail "(timeout) jump &" } +} + +send_gdb "until 35&\n" +gdb_expect { + -re "^until 35&.*$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = baz \\(\\).*completed\.\r\n" \ + { pass "until &" } + -re "$gdb_prompt.*completed\.$" { fail "until &" } + timeout { fail "(timeout) until &" } +} + +gdb_test "set display-exec-done off" "" "" + +unset_board_info "gdb_protocol" +set_board_info "gdb_protocol" "remote" + + + + + + diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 115cd80..454d08b 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -559,9 +559,10 @@ gdb_expect { if [istarget "hppa*-*-hpux*"] then { send_gdb "bt\n" gdb_expect { - -re "#0\[ \t\]*marker2.*:4\[49\]\r\n#1.*_sr4export.*$gdb_prompt $"\ + -re "#0\[ \t\]*0x\[0-9\]* in marker2.*:4\[49\]\r\n#1.*_sr4export.*$gdb_prompt $"\ {pass "backtrace while in called function"} - -re "#0\[ \t\]*marker2.*:4\[49\]\r\n#1.*function called from gdb.*$gdb_prompt $"\ + -re "#0\[ \t\]*0x\[0-9\]* in marker2.*:4\[49\]\r\n#1.*function called from gdb.*$gdb_prompt $"\ + {pass "backtrace while in called function"} -re "$gdb_prompt $"\ {fail "backtrace while in called function"} @@ -573,6 +574,8 @@ if [istarget "hppa*-*-hpux*"] then { {pass "finish from called function"} -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*function called from gdb.*$gdb_prompt $"\ {pass "finish from called function"} + -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*Value returned.*$gdb_prompt $"\ + {pass "finish from called function"} -re "$gdb_prompt $"\ {fail "finish from called function"} timeout {fail "(timeout) finish from called function"} diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp index 98cd73c..7a3519e 100644 --- a/gdb/testsuite/gdb.base/display.exp +++ b/gdb/testsuite/gdb.base/display.exp @@ -130,7 +130,22 @@ gdb_test "c" ".*Breakpoint 4.*" "watch off" # Now the printf tests # -gdb_test "fin" ".*Run till exit.*Value returned is.*= 10.*" "finish" +# The "finish" command may leave us mid-line in the caller on some +# targets, including but not limited to the m68k, i386 & PA. So we +# have to arrange to step until we hit the line with the call to +# "do_vars". +send_gdb "finish\n" +gdb_expect { + -re ".*do_loops();.*$gdb_prompt $" { + send_gdb "step\n" + exp_continue + } + -re ".*do_vars.*$gdb_prompt $" { + pass "finish" + } + default { fail "finish" ; gdb_suppress_tests; } +} + gdb_test "s" ".*do_vars.*.*27.*" gdb_test "tb 37" ".*Breakpoint 5 a.*" gdb_test "c" ".*do_vars.*37.*37.*" @@ -165,7 +180,9 @@ gdb_test "p/0 j" ".*Item count other than 1 is meaningless.*" "p/0 j" gdb_test "p/s sum" ".*Format letter.*is meaningless.*" " no s" gdb_test "p/i sum" ".*Format letter.*is meaningless.*.*" "no i" gdb_test "p/a &sum" ".*= $hex.*<sum>.*" -gdb_test "p/a main+1000" ".*= $hex.*<.*>.*" +# If the constant below is larger than the length of main, then +# this test will (incorrectly) fail. So use a small number. +gdb_test "p/a main+4" ".*= $hex.*<.*>.*" gdb_test "p/a \$pc" ".*= $hex.*<do_vars+.*>.*" gdb_test "p/a &&j" ".*A parse error.*" diff --git a/gdb/testsuite/gdb.base/dollar.exp b/gdb/testsuite/gdb.base/dollar.exp index 1efb9c9..a7a977e 100644 --- a/gdb/testsuite/gdb.base/dollar.exp +++ b/gdb/testsuite/gdb.base/dollar.exp @@ -34,7 +34,7 @@ if ![ istarget "*-*-hpux*" ] then { # When we are in "wide" mode we do not necessary have $$dyncall as a symbol # name, which makes all these tests useless -if ![ istarget "hppa*w-*-hpux11*" ] then { +if [ istarget "hppa*w-*-hpux11*" ] then { return } diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index 790a98c..d67af48 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -141,6 +141,10 @@ gdb_expect { -re ".*in.*start.*$gdb_prompt $" { pass "step out of main" } + -re ".*in .nope ().*$gdb_prompt $" { + # This is what happens on Solaris currently -sts 1999-08-25 + pass "step out of main on Solaris" + } -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { pass "step out of main" } diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp index ad875cc..adbb95b 100644 --- a/gdb/testsuite/gdb.base/signals.exp +++ b/gdb/testsuite/gdb.base/signals.exp @@ -347,7 +347,7 @@ proc test_handle_all_print {} { || [istarget "*-*-mach*"] ) } { gdb_test "handle all print" "Signal\[ \]+Stop\[ \]+Print\[ \]+Pass to program\[ \]+Description\r\nSIGHUP\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Hangup.*SIG63\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Real-time event 63.*EXC_BREAKPOINT\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Breakpoint" } else { - gdb_test "handle all print" "Signal\[ \]+Stop\[ \]+Print\[ \]+Pass to program\[ \]+Description\r\nSIGHUP\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Hangup.*SIG63\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Real-time event 63" + gdb_test "handle all print" "Signal\[ \]+Stop\[ \]+Print\[ \]+Pass to program\[ \]+Description\r\nSIGHUP\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Hangup.*SIG63\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Real-time event 63.*" } set timeout $oldtimeout verbose "Timeout restored to $timeout seconds" 2 |