2010-05-20 Michael Snyder * gdb.base/fileio.exp: Replace send_gdb with gdb_test. * gdb.base/finish.exp: Replace send_gdb with gdb_test. * gdb.base/foll-fork.exp: Replace send_gdb with gdb_test. * gdb.base/funcargs.exp: Replace send_gdb with gdb_test. * gdb.base/gcore-buffer-overflow.exp: Replace send_gdb with gdb_test. * gdb.base/gcore.exp: Replace send_gdb with gdb_test. * gdb.base/gdb1090.exp: Replace send_gdb with gdb_test. * gdb.base/gdbvars.exp: Replace send_gdb with gdb_test. * gdb.base/help.exp: Replace send_gdb with gdb_test. * gdb.base/info-proc.exp: Replace send_gdb with gdb_test. * gdb.base/jump.exp: Replace send_gdb with gdb_test. * gdb.base/long_long.exp: Replace send_gdb with gdb_test. Index: fileio.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/fileio.exp,v retrieving revision 1.17 diff -u -p -r1.17 fileio.exp --- fileio.exp 5 May 2010 18:06:57 -0000 1.17 +++ fileio.exp 21 May 2010 20:12:01 -0000 @@ -54,17 +54,17 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $" -send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $" -send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" - +gdb_test_no_output "set print sevenbit-strings" +gdb_test_no_output "set print address off" +gdb_test_no_output "set width 0" if ![runto_main] then { perror "couldn't run to breakpoint" continue } -send_gdb "break stop\n" ; gdb_expect -re "Breakpoint .*$srcfile.*$gdb_prompt $" +gdb_test "break stop" "Breakpoint .*$srcfile.*" + set stop_msg ".*Breakpoint .* stop \\(\\) at.*$srcfile:.*static void stop \\(\\) {}.*" gdb_test continue \ @@ -83,7 +83,8 @@ gdb_test continue \ "Continuing\\..*open 4:.*ENOENT$stop_msg" \ "Opening nonexistant file returns ENOENT" -send_gdb "continue\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test "continue" "" "" + catch "system \"chmod -f -w nowrt.fileio.test\"" gdb_test continue \ @@ -179,7 +180,8 @@ gdb_test continue \ "Continuing\\..*system 1:.*OK$stop_msg" \ "System says shell is available" -send_gdb "set remote system-call-allowed 1\n"; gdb_expect -re ".*$gdb_prompt $" +gdb_test_no_output "set remote system-call-allowed 1" + gdb_test continue \ "Continuing\\..*system 2:.*OK$stop_msg" \ "System(3) call" Index: finish.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/finish.exp,v retrieving revision 1.17 diff -u -p -r1.17 finish.exp --- finish.exp 5 May 2010 18:06:57 -0000 1.17 +++ finish.exp 21 May 2010 20:12:01 -0000 @@ -32,8 +32,7 @@ proc finish_1 { type } { "set break on ${type}_func" gdb_test "continue" "Breakpoint.* ${type}_func.*" \ "continue to ${type}_func" - send_gdb "finish\n" - gdb_expect { + gdb_test_multiple "finish" "finish from ${type}_func" { -re ".*Value returned is .* = 49 '1'\r\n$gdb_prompt $" { if { $type == "char" } { pass "finish from char_func" @@ -51,12 +50,6 @@ proc finish_1 { type } { -re ".*Value returned is .* = 1\r\n$gdb_prompt $" { pass "finish from ${type}_func" } - -re ".*$gdb_prompt $" { - fail "finish from ${type}_func" - } - timeout { - fail "finish from ${type}_func (timeout)" - } } } @@ -67,24 +60,17 @@ proc finish_void { } { "set break on void_func" gdb_test "continue" "Breakpoint.* void_func.*" \ "continue to void_func" - send_gdb "finish\n" # Some architectures will have one or more instructions after the # call instruction which still is part of the call sequence, so we # must be prepared for a "finish" to show us the void_func call # again as well as the statement after. - gdb_expect { + gdb_test_multiple "finish" "finish from void_func" { -re ".*void_checkpoint.*$gdb_prompt $" { pass "finish from void_func" } -re "0x\[0-9a-fA-F\]+ in main.*call to void_func.*$gdb_prompt $" { pass "finish from void_func" } - -re ".*$gdb_prompt $" { - fail "finish from void_func" - } - timeout { - fail "finish from void_func (timeout)" - } } } Index: foll-fork.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/foll-fork.exp,v retrieving revision 1.18 diff -u -p -r1.18 foll-fork.exp --- foll-fork.exp 5 May 2010 18:06:58 -0000 1.18 +++ foll-fork.exp 21 May 2010 20:12:01 -0000 @@ -61,369 +61,282 @@ proc check_fork_catchpoints {} { } proc default_fork_parent_follow {} { - global gdb_prompt + global gdb_prompt - send_gdb "show follow-fork\n" - gdb_expect { - -re "Debugger response to a program call of fork or vfork is \"parent\"..*$gdb_prompt $"\ - {pass "default show parent follow, no catchpoints"} - -re "$gdb_prompt $" {fail "default show parent follow, no catchpoints"} - timeout {fail "(timeout) default show parent follow, no catchpoints"} - } - send_gdb "next 2\n" - gdb_expect { - -re "Detaching after fork from.*$gdb_prompt $"\ - {pass "default parent follow, no catchpoints"} - -re "$gdb_prompt $" {fail "default parent follow, no catchpoints"} - timeout {fail "(timeout) default parent follow, no catchpoints" } - } - # The child has been detached; allow time for any output it might - # generate to arrive, so that output doesn't get confused with - # any expected debugger output from a subsequent testpoint. - # - exec sleep 1 + gdb_test "show follow-fork" \ + "Debugger response to a program call of fork or vfork is \"parent\".*" \ + "default show parent follow, no catchpoints" + + gdb_test "next 2" \ + "Detaching after fork from.*" \ + "default parent follow, no catchpoints" + + # The child has been detached; allow time for any output it might + # generate to arrive, so that output doesn't get confused with + # any expected debugger output from a subsequent testpoint. + # + exec sleep 1 } proc explicit_fork_parent_follow {} { - global gdb_prompt + global gdb_prompt - send_gdb "set follow-fork parent\n" - gdb_expect { - -re "$gdb_prompt $" {pass "set follow-fork parent"} - timeout {fail "(timeout) set follow-fork parent"} - } - send_gdb "show follow-fork\n" - gdb_expect { - -re "Debugger response to a program call of fork or vfork is \"parent\"..*$gdb_prompt $"\ - {pass "explicit show parent follow, no catchpoints"} - -re "$gdb_prompt $" {fail "explicit show parent follow, no catchpoints"} - timeout {fail "(timeout) explicit show parent follow, no catchpoints"} - } - send_gdb "next 2\n" - gdb_expect { - -re "Detaching after fork from.*$gdb_prompt $"\ - {pass "explicit parent follow, no catchpoints"} - -re "$gdb_prompt $" {fail "explicit parent follow, no catchpoints"} - timeout {fail "(timeout) explicit parent follow, no catchpoints"} - } - # The child has been detached; allow time for any output it might - # generate to arrive, so that output doesn't get confused with - # any expected debugger output from a subsequent testpoint. - # - exec sleep 1 + gdb_test_no_output "set follow-fork parent" + + gdb_test "show follow-fork" \ + "Debugger response to a program call of fork or vfork is \"parent\"." \ + "explicit show parent follow, no catchpoints" + + gdb_test "next 2" "Detaching after fork from.*" \ + "explicit parent follow, no catchpoints" + + # The child has been detached; allow time for any output it might + # generate to arrive, so that output doesn't get confused with + # any expected debugger output from a subsequent testpoint. + # + exec sleep 1 } proc explicit_fork_child_follow {} { - global gdb_prompt + global gdb_prompt + + gdb_test_no_output "set follow-fork child" - send_gdb "set follow-fork child\n" - gdb_expect { - -re "$gdb_prompt $" {pass "set follow-fork child"} - timeout {fail "(timeout) set follow-fork child"} - } - send_gdb "show follow-fork\n" - gdb_expect { - -re "Debugger response to a program call of fork or vfork is \"child\"..*$gdb_prompt $"\ - {pass "explicit show child follow, no catchpoints"} - -re "$gdb_prompt $" {fail "explicit show child follow, no catchpoints"} - timeout {fail "(timeout) explicit show child follow, no catchpoints"} - } - send_gdb "next 2\n" - gdb_expect { - -re "Attaching after.* fork to.*$gdb_prompt $"\ - {pass "explicit child follow, no catchpoints"} - -re "$gdb_prompt $" {fail "explicit child follow, no catchpoints"} - timeout {fail "(timeout) explicit child follow, no catchpoints"} - } - # The child has been detached; allow time for any output it might - # generate to arrive, so that output doesn't get confused with - # any gdb_expected debugger output from a subsequent testpoint. - # - exec sleep 1 + gdb_test "show follow-fork" \ + "Debugger response to a program call of fork or vfork is \"child\"." \ + "explicit show child follow, no catchpoints" + + gdb_test "next 2" "Attaching after.* fork to.*" \ + "explicit child follow, no catchpoints" + + # The child has been detached; allow time for any output it might + # generate to arrive, so that output doesn't get confused with + # any gdb_expected debugger output from a subsequent testpoint. + # + exec sleep 1 } proc catch_fork_child_follow {} { - global gdb_prompt - global srcfile + global gdb_prompt + global srcfile - set bp_after_fork [gdb_get_line_number "set breakpoint here"] + set bp_after_fork [gdb_get_line_number "set breakpoint here"] - send_gdb "catch fork\n" - gdb_expect { - -re "Catchpoint .*(fork).*$gdb_prompt $"\ - {pass "explicit child follow, set catch fork"} - -re "$gdb_prompt $" {fail "explicit child follow, set catch fork"} - timeout {fail "(timeout) explicit child follow, set catch fork"} - } - - # Verify that the catchpoint is mentioned in an "info breakpoints", - # and further that the catchpoint mentions no process id. - # - set test_name "info shows catchpoint without pid" - gdb_test_multiple "info breakpoints" "$test_name" { - -re ".*catchpoint.*keep y.*fork\[\r\n\]+$gdb_prompt $" { - pass "$test_name" - } - } - - send_gdb "continue\n" - gdb_expect { - -re "Catchpoint.*(forked process.*),.*in .*(fork|__kernel_v?syscall).*$gdb_prompt $"\ - {pass "explicit child follow, catch fork"} - -re "$gdb_prompt $" {fail "explicit child follow, catch fork"} - timeout {fail "(timeout) explicit child follow, catch fork"} - } - - # Verify that the catchpoint is mentioned in an "info breakpoints", - # and further that the catchpoint managed to capture a process id. - # - set test_name "info shows catchpoint without pid" - gdb_test_multiple "info breakpoints" "$test_name" { - -re ".*catchpoint.*keep y.*fork, process.*$gdb_prompt $" { - pass "$test_name" - } - } - - send_gdb "set follow-fork child\n" - gdb_expect { - -re "$gdb_prompt $" {pass "set follow-fork child"} - timeout {fail "(timeout) set follow-fork child"} - } - send_gdb "tbreak ${srcfile}:$bp_after_fork\n" - gdb_expect { - -re "Temporary breakpoint.*, line $bp_after_fork.*$gdb_prompt $"\ - {pass "set follow-fork child, tbreak"} - -re "$gdb_prompt $" {fail "set follow-fork child, tbreak"} - timeout {fail "(timeout) set follow-fork child, tbreak"} - } - send_gdb "continue\n" - gdb_expect { - -re "Attaching after.* fork to.* at .*$bp_after_fork.*$gdb_prompt $"\ - {pass "set follow-fork child, hit tbreak"} - -re "$gdb_prompt $" {fail "set follow-fork child, hit tbreak"} - timeout {fail "(timeout) set follow-fork child, hit tbreak"} - } - # The parent has been detached; allow time for any output it might - # generate to arrive, so that output doesn't get confused with - # any expected debugger output from a subsequent testpoint. - # - exec sleep 1 - send_gdb "delete breakpoints\n" - gdb_expect { - -re "Delete all breakpoints.*$" { - send_gdb "y\n" - gdb_expect { - -re "$gdb_prompt $"\ - {pass "set follow-fork child, cleanup"} - timeout {fail "(timeout) set follow-fork child, cleanup"} - } - } - -re "$gdb_prompt $" {fail "set follow-fork child, cleanup"} - timeout {fail "(timeout) set follow-fork child, cleanup"} - } + gdb_test "catch fork" "Catchpoint .*(fork).*" \ + "explicit child follow, set catch fork" + + # Verify that the catchpoint is mentioned in an "info breakpoints", + # and further that the catchpoint mentions no process id. + # + set test_name "info shows catchpoint without pid" + gdb_test_multiple "info breakpoints" "$test_name" { + -re ".*catchpoint.*keep y.*fork\[\r\n\]+$gdb_prompt $" { + pass "$test_name" + } + } + + gdb_test "continue" \ + "Catchpoint.*(forked process.*),.*in .*(fork|__kernel_v?syscall).*" \ + "explicit child follow, catch fork" + + # Verify that the catchpoint is mentioned in an "info breakpoints", + # and further that the catchpoint managed to capture a process id. + # + set test_name "info shows catchpoint without pid" + gdb_test_multiple "info breakpoints" "$test_name" { + -re ".*catchpoint.*keep y.*fork, process.*$gdb_prompt $" { + pass "$test_name" + } + } + + gdb_test_no_output "set follow-fork child" + + gdb_test "tbreak ${srcfile}:$bp_after_fork" \ + "Temporary breakpoint.*, line $bp_after_fork.*" \ + "set follow-fork child, tbreak" + + gdb_test "continue" \ + "Attaching after.* fork to.* at .*$bp_after_fork.*" \ + "set follow-fork child, hit tbreak" + + # The parent has been detached; allow time for any output it might + # generate to arrive, so that output doesn't get confused with + # any expected debugger output from a subsequent testpoint. + # + exec sleep 1 + + gdb_test "delete breakpoints" \ + "" \ + "set follow-fork child, cleanup" \ + "Delete all breakpoints.*$" \ + "y" } proc catch_fork_unpatch_child {} { - global gdb_prompt - global srcfile - - set bp_exit [gdb_get_line_number "at exit"] + global gdb_prompt + global srcfile - gdb_test "break callee" "file .*$srcfile, line .*" "unpatch child, break at callee" - gdb_test "catch fork" "Catchpoint \[0-9\]* \\(fork\\)" "unpatch child, set catch fork" + set bp_exit [gdb_get_line_number "at exit"] - gdb_test "continue" \ - "Catchpoint.*\\(forked process.*\\).*,.*in .*(fork|__kernel_v?syscall).*" \ - "unpatch child, catch fork" - - # Delete all breakpoints and catchpoints. - delete_breakpoints - - # Force $srcfile as the current GDB source can be in glibc sourcetree. - gdb_test "break $srcfile:$bp_exit" \ - "Breakpoint .*file .*$srcfile, line .*" \ - "unpatch child, breakpoint at exit call" - - gdb_test "set follow-fork child" "" "unpatch child, set follow-fork child" - - set test "unpatch child, unpatched parent breakpoints from child" - gdb_test_multiple "continue" $test { - -re "at exit.*$gdb_prompt $" { - pass "$test" - } - -re "SIGTRAP.*$gdb_prompt $" { - fail "$test" - - # Explicitly kill this child, so we can continue gracefully - # with further testing... - send_gdb "kill\n" - gdb_expect { - -re ".*Kill the program being debugged.*y or n. $" { - send_gdb "y\n" - gdb_expect -re "$gdb_prompt $" {} - } - } - } - -re ".*$gdb_prompt $" { - fail "$test (unknown output)" - } - timeout { - fail "$test (timeout)" - } - } + gdb_test "break callee" "file .*$srcfile, line .*" \ + "unpatch child, break at callee" + gdb_test "catch fork" "Catchpoint \[0-9\]* \\(fork\\)" \ + "unpatch child, set catch fork" + + gdb_test "continue" \ + "Catchpoint.*\\(forked process.*\\).*,.*in .*(fork|__kernel_v?syscall).*" \ + "unpatch child, catch fork" + + # Delete all breakpoints and catchpoints. + delete_breakpoints + + # Force $srcfile as the current GDB source can be in glibc sourcetree. + gdb_test "break $srcfile:$bp_exit" \ + "Breakpoint .*file .*$srcfile, line .*" \ + "unpatch child, breakpoint at exit call" + + gdb_test "set follow-fork child" "" "unpatch child, set follow-fork child" + + set test "unpatch child, unpatched parent breakpoints from child" + gdb_test_multiple "continue" $test { + -re "at exit.*$gdb_prompt $" { + pass "$test" + } + -re "SIGTRAP.*$gdb_prompt $" { + fail "$test" + + # Explicitly kill this child, so we can continue gracefully + # with further testing... + send_gdb "kill\n" + gdb_expect { + -re ".*Kill the program being debugged.*y or n. $" { + send_gdb "y\n" + gdb_expect -re "$gdb_prompt $" {} + } + } + } + -re ".*$gdb_prompt $" { + fail "$test (unknown output)" + } + timeout { + fail "$test (timeout)" + } + } } proc tcatch_fork_parent_follow {} { - global gdb_prompt - global srcfile + global gdb_prompt + global srcfile - set bp_after_fork [gdb_get_line_number "set breakpoint here"] + set bp_after_fork [gdb_get_line_number "set breakpoint here"] + + gdb_test "catch fork" "Catchpoint .*(fork).*" \ + "explicit parent follow, set tcatch fork" - send_gdb "catch fork\n" - gdb_expect { - -re "Catchpoint .*(fork).*$gdb_prompt $"\ - {pass "explicit parent follow, set tcatch fork"} - -re "$gdb_prompt $" {fail "explicit parent follow, set tcatch fork"} - timeout {fail "(timeout) explicit parent follow, set tcatch fork"} - } # ??rehrauer: I don't yet know how to get the id of the tcatch # via this script, so that I can add a -do list to it. For now, # do the follow stuff after the catch happens. - send_gdb "continue\n" - gdb_expect { - -re ".*in .*(fork|__kernel_v?syscall).*$gdb_prompt $"\ - {pass "explicit parent follow, tcatch fork"} - -re "$gdb_prompt $" {fail "explicit parent follow, tcatch fork"} - timeout {fail "(timeout) explicit parent follow, tcatch fork"} - } - send_gdb "set follow-fork parent\n" - gdb_expect { - -re "$gdb_prompt $" {pass "set follow-fork parent"} - timeout {fail "(timeout) set follow-fork parent"} - } - send_gdb "tbreak ${srcfile}:$bp_after_fork\n" - gdb_expect { - -re "Temporary breakpoint.*, line $bp_after_fork.*$gdb_prompt $"\ - {pass "set follow-fork parent, tbreak"} - -re "$gdb_prompt $" {fail "set follow-fork parent, tbreak"} - timeout {fail "(timeout) set follow-fork child, tbreak"} - } - send_gdb "continue\n" - gdb_expect { - -re ".*Detaching after fork from.* at .*$bp_after_fork.*$gdb_prompt $"\ - {pass "set follow-fork parent, hit tbreak"} - -re "$gdb_prompt $" {fail "set follow-fork parent, hit tbreak"} - timeout {fail "(timeout) set follow-fork parent, hit tbreak"} - } - # The child has been detached; allow time for any output it might - # generate to arrive, so that output doesn't get confused with - # any expected debugger output from a subsequent testpoint. - # - exec sleep 1 - send_gdb "delete breakpoints\n" - gdb_expect { - -re "Delete all breakpoints.*$" { - send_gdb "y\n" - gdb_expect { - -re "$gdb_prompt $"\ - {pass "set follow-fork parent, cleanup"} - timeout {fail "(timeout) set follow-fork parent, cleanup"} - } - } - -re "$gdb_prompt $" {fail "set follow-fork parent, cleanup"} - timeout {fail "(timeout) set follow-fork parent, cleanup"} - } + gdb_test "continue" "in .*(fork|__kernel_v?syscall).*" \ + "explicit parent follow, tcatch fork" + + gdb_test_no_output "set follow-fork parent" + + gdb_test "tbreak ${srcfile}:$bp_after_fork" \ + "Temporary breakpoint.*, line $bp_after_fork.*" \ + "set follow-fork parent, tbreak" + + gdb_test "continue" \ + "Detaching after fork from.* at .*$bp_after_fork.*" \ + "set follow-fork parent, hit tbreak" + + # The child has been detached; allow time for any output it might + # generate to arrive, so that output doesn't get confused with + # any expected debugger output from a subsequent testpoint. + # + exec sleep 1 + + gdb_test "delete breakpoints" \ + "" \ + "set follow-fork parent, cleanup" \ + "Delete all breakpoints.*$" \ + "y" } proc do_fork_tests {} { - global gdb_prompt + global gdb_prompt - # Verify that help is available for "set follow-fork-mode". - # - send_gdb "help set follow-fork-mode\n" - gdb_expect { - -re "Set debugger response to a program call of fork or vfork..* + # Verify that help is available for "set follow-fork-mode". + # + gdb_test "help set follow-fork-mode" \ + "Set debugger response to a program call of fork or vfork..* A fork or vfork creates a new process. follow-fork-mode can be:.* .*parent - the original process is debugged after a fork.* .*child - the new process is debugged after a fork.* The unfollowed process will continue to run..* -By default, the debugger will follow the parent process..*$gdb_prompt $"\ - { pass "help set follow-fork" } - -re "$gdb_prompt $" { fail "help set follow" } - timeout { fail "(timeout) help set follow-fork" } - } - - # Verify that we can set follow-fork-mode, using an abbreviation - # for both the flag and its value. - # - send_gdb "set follow-fork ch\n" - send_gdb "show follow-fork\n" - gdb_expect { - -re "Debugger response to a program call of fork or vfork is \"child\".*$gdb_prompt $"\ - {pass "set follow-fork, using abbreviations"} - timeout {fail "(timeout) set follow-fork, using abbreviations"} - } - - # Verify that we cannot set follow-fork-mode to nonsense. - # - send_gdb "set follow-fork chork\n" - gdb_expect { - -re "Undefined item: \"chork\".*$gdb_prompt $"\ - {pass "set follow-fork to nonsense is prohibited"} - -re "$gdb_prompt $" {fail "set follow-fork to nonsense is prohibited"} - timeout {fail "(timeout) set follow-fork to nonsense is prohibited"} - } - send_gdb "set follow-fork parent\n" - gdb_expect { - -re "$gdb_prompt $" {pass "set follow-fork to nonsense is prohibited (reset parent)"} - timeout {fail "set follow-fork to nonsense is prohibited (reset parent)"} - } - - # Check that fork catchpoints are supported, as an indicator for whether - # fork-following is supported. - if [runto_main] then { check_fork_catchpoints } - - # Test the default behaviour, which is to follow the parent of a - # fork, and detach from the child. Do this without catchpoints. - # - if [runto_main] then { default_fork_parent_follow } - - # Test the ability to explicitly follow the parent of a fork, and - # detach from the child. Do this without catchpoints. - # - if [runto_main] then { explicit_fork_parent_follow } - - # Test the ability to follow the child of a fork, and detach from - # the parent. Do this without catchpoints. - # - if [runto_main] then { explicit_fork_child_follow } - - # Test the ability to follow both child and parent of a fork. Do - # this without catchpoints. - # ??rehrauer: NYI. Will add testpoints here when implemented. - # - - # Test the ability to have the debugger ask the user at fork-time - # whether to follow the parent, child or both. Do this without - # catchpoints. - # ??rehrauer: NYI. Will add testpoints here when implemented. - # - - # Test the ability to catch a fork, specify that the child be - # followed, and continue. Make the catchpoint permanent. - # - if [runto_main] then { catch_fork_child_follow } - - # Test that parent breakpoints are successfully detached from the - # child at fork time, even if the user removes them from the - # breakpoints list after stopping at a fork catchpoint. - if [runto_main] then { catch_fork_unpatch_child } - - # Test the ability to catch a fork, specify via a -do clause that - # the parent be followed, and continue. Make the catchpoint temporary. - # - if [runto_main] then { tcatch_fork_parent_follow } +By default, the debugger will follow the parent process..*" \ + "help set follow-fork" + + # Verify that we can set follow-fork-mode, using an abbreviation + # for both the flag and its value. + # + gdb_test_no_output "set follow-fork ch" + + gdb_test "show follow-fork" \ + "Debugger response to a program call of fork or vfork is \"child\".*" \ + "set follow-fork, using abbreviations" + + # Verify that we cannot set follow-fork-mode to nonsense. + # + gdb_test "set follow-fork chork" "Undefined item: \"chork\".*" \ + "set follow-fork to nonsense is prohibited" + + gdb_test_no_output "set follow-fork parent" "reset parent" + + # Check that fork catchpoints are supported, as an indicator for whether + # fork-following is supported. + if [runto_main] then { check_fork_catchpoints } + + # Test the default behaviour, which is to follow the parent of a + # fork, and detach from the child. Do this without catchpoints. + # + if [runto_main] then { default_fork_parent_follow } + + # Test the ability to explicitly follow the parent of a fork, and + # detach from the child. Do this without catchpoints. + # + if [runto_main] then { explicit_fork_parent_follow } + + # Test the ability to follow the child of a fork, and detach from + # the parent. Do this without catchpoints. + # + if [runto_main] then { explicit_fork_child_follow } + + # Test the ability to follow both child and parent of a fork. Do + # this without catchpoints. + # ??rehrauer: NYI. Will add testpoints here when implemented. + # + + # Test the ability to have the debugger ask the user at fork-time + # whether to follow the parent, child or both. Do this without + # catchpoints. + # ??rehrauer: NYI. Will add testpoints here when implemented. + # + + # Test the ability to catch a fork, specify that the child be + # followed, and continue. Make the catchpoint permanent. + # + if [runto_main] then { catch_fork_child_follow } + + # Test that parent breakpoints are successfully detached from the + # child at fork time, even if the user removes them from the + # breakpoints list after stopping at a fork catchpoint. + if [runto_main] then { catch_fork_unpatch_child } + + # Test the ability to catch a fork, specify via a -do clause that + # the parent be followed, and continue. Make the catchpoint temporary. + # + if [runto_main] then { tcatch_fork_parent_follow } } # Start with a fresh gdb Index: funcargs.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/funcargs.exp,v retrieving revision 1.18 diff -u -p -r1.18 funcargs.exp --- funcargs.exp 5 May 2010 18:06:58 -0000 1.18 +++ funcargs.exp 21 May 2010 20:12:01 -0000 @@ -455,28 +455,13 @@ proc discard_and_shuffle {} { setup_xfail "mips-sgi-irix5*" } - send_gdb "backtrace 100\n" - gdb_expect { - -re "backtrace 100\[\r\n\]+ -.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r -.* main \\(.*\\) .*\r -$gdb_prompt $" { + gdb_test_multiple "backtrace 100" "backtrace from call6a" { + -re " call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .* main \\(.*\\) .*$gdb_prompt $" { pass "backtrace from call6a" } - -re "backtrace 100\[\r\n\]+ -.* call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r -.* main \\(.*\\) .*\r -$gdb_prompt $" { + -re " call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .* main \\(.*\\) .*$gdb_prompt $" { xfail "backtrace from call6a" } - -re "$gdb_prompt $" { - fail "backtrace from call6a" - gdb_suppress_tests - } - timeout { - fail "(timeout) backtrace from call6a" - gdb_suppress_tests - } } # Continue; should stop at call6b and print actual arguments. @@ -707,22 +692,13 @@ proc shuffle_round_robin {} { } if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" } - send_gdb "backtrace 100\n" - gdb_expect { - -re "backtrace 100\[\r\n\]+ -.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r -.* main \\(.*\\) .*\r -$gdb_prompt $" { + gdb_test_multiple "backtrace 100" "backtrace from call7a" { + -re " call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .* main \\(.*\\) .*$gdb_prompt $" { pass "backtrace from call7a" } - -re "backtrace 100\[\r\n\]+ -.* call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r -.* main \\(.*\\) .*\r -$gdb_prompt $" { + -re " call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .* main \\(.*\\) .*$gdb_prompt $" { xfail "backtrace from call7a" } - -re "$gdb_prompt $" { fail "backtrace from call7a" ; return } - timeout { fail "(timeout) backtrace from call7a" ; return } } # Continue; should stop at call7b and print actual arguments. @@ -1057,22 +1033,25 @@ proc localvars_in_indirect_call { } { # second indirect call. # - send_gdb "finish\n" - gdb_expect { - -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" { -#On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than -#hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary to continue the test. + gdb_test_multiple "finish" "finish from indirectly called function" { + -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" { + #On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than + #hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary + #to continue the test. send_gdb "step\n" exp_continue } - -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" { + -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" { pass "finish from indirectly called function" } - -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { fail "finish from indirectly called function" gdb_suppress_tests; } - default { fail "finish from indirectly called function" ; gdb_suppress_tests; } + default { + fail "finish from indirectly called function" + gdb_suppress_tests; + } } if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } @@ -1095,19 +1074,21 @@ proc test_stepping_over_trampolines { } if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; } # Cater for gdb stopping in midline, see comment for finish above. - send_gdb "finish\n" - gdb_expect { - -re "marker_call_with_trampolines ..;.*$gdb_prompt $" { + gdb_test_multiple "finish" "finish from marker_call_with_trampolines" { + -re "marker_call_with_trampolines ..;.*$gdb_prompt $" { send_gdb "step\n" exp_continue } - -re "pointer_to_call_with_trampolines.*$gdb_prompt $" { + -re "pointer_to_call_with_trampolines.*$gdb_prompt $" { pass "finish from marker_call_with_trampolines" } - -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { fail "finish from marker_call_with_trampolines" } - default { fail "finish from marker_call_with_trampolines" ; gdb_suppress_tests; } + default { + fail "finish from marker_call_with_trampolines" + gdb_suppress_tests + } } # Try to step into the target function. @@ -1122,20 +1103,22 @@ proc test_stepping_over_trampolines { } # Stepping back to main might stop again after the gdb_suppress_tests; statement # or immediately transfer control back to main if optimizations # are performed. - send_gdb "step\n" - gdb_expect { - -re "main .* at.*$gdb_prompt $" { - pass "stepping back to main from function called with trampolines" ; - gdb_suppress_tests + gdb_test_multiple "step" "stepping back to main from function called with trampolines" { + -re "main .* at.*$gdb_prompt $" { + pass "stepping back to main from function called with trampolines" + gdb_suppress_tests } - -re "\}.*End of call_with_trampolines.*$gdb_prompt $" { + -re "\}.*End of call_with_trampolines.*$gdb_prompt $" { send_gdb "step\n" exp_continue } - -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { + fail "stepping back to main from function called with trampolines" + } + default { fail "stepping back to main from function called with trampolines" + gdb_suppress_tests } - default { fail "stepping back to main from function called with trampolines" ; gdb_suppress_tests; } } gdb_stop_suppressing_tests; } @@ -1157,38 +1140,41 @@ if [istarget "mips*tx39-*"] { # Determine expected output for unsigned long variables, # the output varies with sizeof (unsigned long). -set target_sizeof_long 4 -send_gdb "print sizeof (long)\n" -gdb_expect { - -re ".\[0-9\]* = 4.*$gdb_prompt $" { } - -re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_long 8 } - -re ".*$gdb_prompt $" { - fail "getting sizeof long" - } - default { fail "(timeout) getting sizeof long" } -} - -set target_sizeof_int 4 -send_gdb "print sizeof (int)\n" -gdb_expect { - -re ".\[0-9\]* = 2.*$gdb_prompt $" { set target_sizeof_int 2 } - -re ".\[0-9\]* = 4.*$gdb_prompt $" { } - -re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_int 8 } - -re ".*$gdb_prompt $" { - fail "getting sizeof unsigned long" - } - default { fail "(timeout) getting sizeof int" } -} - -set target_bigendian_p 1 -send_gdb "show endian\n" -gdb_expect { - -re ".*little endian.*$gdb_prompt $" { set target_bigendian_p 0 } - -re ".*big endian.*$gdb_prompt $" { } - -re ".*$gdb_prompt $" { - fail "getting target endian" +gdb_test_multiple "print sizeof (long)" "getting sizeof long" { + -re ".\[0-9\]* = 4.*$gdb_prompt $" { + set target_sizeof_long 4 + # pass silently + } + -re ".\[0-9\]* = 8.*$gdb_prompt $" { + set target_sizeof_long 8 + # pass silently + } +} + +gdb_test_multiple "print sizeof (int)" "getting sizeof int" { + -re ".\[0-9\]* = 2.*$gdb_prompt $" { + set target_sizeof_int 2 + # pass silently + } + -re ".\[0-9\]* = 4.*$gdb_prompt $" { + set target_sizeof_int 4 + # pass silently + } + -re ".\[0-9\]* = 8.*$gdb_prompt $" { + set target_sizeof_int 8 + # pass silently + } +} + +gdb_test_multiple "show endian" "getting target endian" { + -re ".*little endian.*$gdb_prompt $" { + set target_bigendian_p 0 + # pass silently + } + -re ".*big endian.*$gdb_prompt $" { + set target_bigendian_p 1 + # pass silently } - default { fail "(timeout) getting target endian" } } # Perform tests Index: gcore-buffer-overflow.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp,v retrieving revision 1.8 diff -u -p -r1.8 gcore-buffer-overflow.exp --- gcore-buffer-overflow.exp 5 May 2010 18:06:58 -0000 1.8 +++ gcore-buffer-overflow.exp 21 May 2010 20:12:01 -0000 @@ -40,8 +40,7 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} # Does this gdb support gcore? -send_gdb "help gcore\n" -gdb_expect { +gdb_test_multiple "help gcore" "help gcore" { -re "Undefined command: .gcore.*$gdb_prompt $" { # gcore command not supported -- nothing to test here. unsupported "gdb does not support gcore on this target" @@ -50,12 +49,6 @@ gdb_expect { -re "Save a core file .*$gdb_prompt $" { pass "help gcore" } - -re ".*$gdb_prompt $" { - fail "help gcore" - } - timeout { - fail "help gcore (timeout)" - } } gdb_test "set args ${pattern}" \ Index: gcore.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gcore.exp,v retrieving revision 1.17 diff -u -p -r1.17 gcore.exp --- gcore.exp 5 May 2010 18:06:58 -0000 1.17 +++ gcore.exp 21 May 2010 20:12:01 -0000 @@ -39,8 +39,7 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} # Does this gdb support gcore? -send_gdb "help gcore\n" -gdb_expect { +gdb_test_multiple "help gcore" "help gcore" { -re "Undefined command: .gcore.*$gdb_prompt $" { # gcore command not supported -- nothing to test here. unsupported "gdb does not support gcore on this target" @@ -49,12 +48,6 @@ gdb_expect { -re "Save a core file .*$gdb_prompt $" { pass "help gcore" } - -re ".*$gdb_prompt $" { - fail "help gcore" - } - timeout { - fail "help gcore (timeout)" - } } if { ! [ runto_main ] } then { @@ -125,8 +118,8 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -send_gdb "core ${objdir}/${subdir}/gcore.test\n" -gdb_expect { +gdb_test_multiple "core ${objdir}/${subdir}/gcore.test" \ + "re-load generated corefile" { -re ".* is not a core dump:.*$gdb_prompt $" { fail "re-load generated corefile (bad file format)" # No use proceeding from here. @@ -143,12 +136,6 @@ gdb_expect { -re "Core was generated by .*$gdb_prompt $" { pass "re-load generated corefile" } - -re ".*$gdb_prompt $" { - fail "re-load generated corefile" - } - timeout { - fail "re-load generated corefile (timeout)" - } } send_gdb "where\n" Index: gdb1090.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gdb1090.exp,v retrieving revision 1.8 diff -u -p -r1.8 gdb1090.exp --- gdb1090.exp 5 May 2010 18:06:58 -0000 1.8 +++ gdb1090.exp 21 May 2010 20:12:01 -0000 @@ -46,8 +46,7 @@ if ![runto marker] then { } gdb_test "up" ".*foo.*" "up from marker" -send_gdb "print s24\n" -gdb_expect { +gdb_test_multiple "print s24" "print s24" { -re "\\\$\[0-9\]* = \\{field_0 = 1170, field_1 = 64701\\}\r\n$gdb_prompt $" { pass "print s24" } @@ -56,10 +55,4 @@ gdb_expect { # gdb cannot find the second register and prints garbage. kfail "gdb/1090" "print s24" } - -re ".*$gdb_prompt $" { - fail "print s24" - } - timeout { - fail "print s24 (timeout)" - } } Index: gdbvars.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gdbvars.exp,v retrieving revision 1.9 diff -u -p -r1.9 gdbvars.exp --- gdbvars.exp 5 May 2010 18:06:58 -0000 1.9 +++ gdbvars.exp 21 May 2010 20:12:01 -0000 @@ -124,7 +124,7 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -send_gdb "set print sevenbit-strings\n" ; gdb_expect -re ".*$gdb_prompt $" +gdb_test_no_output "set print sevenbit-strings" test_value_history test_convenience_variables Index: help.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/help.exp,v retrieving revision 1.40 diff -u -p -r1.40 help.exp --- help.exp 5 May 2010 18:06:58 -0000 1.40 +++ help.exp 21 May 2010 20:12:01 -0000 @@ -199,25 +199,21 @@ gdb_test "help finish" "Execute until se # test help forward-search gdb_test "help forward-search" "Search for regular expression \\(see regex\\(3\\)\\) from last line listed.*" "help forward-search" # test help gcore -send_gdb "help gcore\n" -gdb_expect { +gdb_test_multiple "help gcore" "help gcore" { -re "Undefined command: \"gcore\"\. Try \"help\".*$gdb_prompt $" { pass "help gcore" } -re "Save a core file with the current state of the debugged process\.\[\r\n\]+Argument is optional filename\. Default filename is 'core\.'.*$gdb_prompt $" { pass "help gcore" } - default { fail "help gcore" } } -send_gdb "help generate-core-file\n" -gdb_expect { +gdb_test_multiple "help generate-core-file" "help generate-core-file" { -re "Undefined command: \"generate-core-file\"\. Try \"help\".*$gdb_prompt $" { pass "help gcore" } -re "Save a core file with the current state of the debugged process\.\[\r\n\]+Argument is optional filename\. Default filename is 'core\.'.*$gdb_prompt $" { pass "help gcore" } - default { fail "help gcore" } } # test help help "h" abbreviation gdb_test "help h" "Print list of commands\." "help help \"h\" abbreviation" Index: info-proc.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/info-proc.exp,v retrieving revision 1.13 diff -u -p -r1.13 info-proc.exp --- info-proc.exp 5 May 2010 18:06:58 -0000 1.13 +++ info-proc.exp 21 May 2010 20:12:01 -0000 @@ -56,8 +56,7 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} # Does this gdb support info proc? -send_gdb "help info proc\n" -gdb_expect { +gdb_test_multiple "help info proc" "help info proc" { -re "Undefined info command: .proc.. Try .help info.*$gdb_prompt $" { # info proc command not supported -- nothing to test here. unsupported "gdb does not support info proc on this target" @@ -66,12 +65,6 @@ gdb_expect { -re "Show /proc process information about .*$gdb_prompt $" { pass "help info proc" } - -re ".*$gdb_prompt $" { - fail "help info proc" - } - timeout { - fail "help info proc (timeout)" - } } gdb_test "info proc" "No current process.*" "info proc without a process" Index: jump.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/jump.exp,v retrieving revision 1.12 diff -u -p -r1.12 jump.exp --- jump.exp 5 May 2010 18:06:58 -0000 1.12 +++ jump.exp 21 May 2010 20:12:01 -0000 @@ -47,96 +47,59 @@ if ![runto_main] then { # Set a breakpoint on the statement that we're about to jump to. # The statement doesn't contain a function call. # -send_gdb "break 22\n" set bp_on_non_call 0 -gdb_expect { - -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 22.*$gdb_prompt $"\ - {set bp_on_non_call $expect_out(1,string) - pass "break before jump to non-call"} - -re "$gdb_prompt $"\ - {fail "break before jump to non-call"} - timeout {fail "(timeout) break before jump to non-call"} +gdb_test_multiple "break 22" "break before jump to non-call" { + -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 22.*$gdb_prompt $" { + set bp_on_non_call $expect_out(1,string) + pass "break before jump to non-call" + } } # Can we jump to the statement? Do we stop there? # -send_gdb "jump 22\n" -gdb_expect { - -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\ - {pass "jump to non-call"} - -re "$gdb_prompt $"\ - {fail "jump to non-call"} - timeout {fail "(timeout) jump to non-call"} -} +gdb_test "jump 22" "Breakpoint \[0-9\]*, .*${srcfile}:22.*" \ + "jump to non-call" # Set a breakpoint on the statement that we're about to jump to. # The statement does contain a function call. # -send_gdb "break 21\n" set bp_on_call 0 -gdb_expect { - -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 21.*$gdb_prompt $"\ - {set bp_on_call $expect_out(1,string) - pass "break before jump to call"} - -re "$gdb_prompt $"\ - {fail "break before jump to call"} - timeout {fail "(timeout) break before jump to call"} +gdb_test_multiple "break 21" "break before jump to call" { + -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 21.*$gdb_prompt $" { + set bp_on_call $expect_out(1,string) + pass "break before jump to call" + } } # Can we jump to the statement? Do we stop there? # -send_gdb "jump 21\n" -gdb_expect { - -re "Breakpoint \[0-9\]*, .*${srcfile}:21.*$gdb_prompt $"\ - {pass "jump to call"} - -re "$gdb_prompt $"\ - {fail "jump to call"} - timeout {fail "(timeout) jump to call"} -} +gdb_test "jump 21" \ + "Breakpoint \[0-9\]*, .*${srcfile}:21.*" \ + "jump to call" # If we disable the breakpoint at the function call, and then # if we jump to that statement, do we not stop there, but at # the following breakpoint? # -send_gdb "disable $bp_on_call\n" -gdb_expect { - -re "$gdb_prompt $"\ - {pass "disable breakpoint on call"} - timeout {fail "(timeout) disable breakpoint on call"} -} +gdb_test_no_output "disable $bp_on_call" "disable breakpoint on call" -send_gdb "jump 21\n" -gdb_expect { - -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\ - {pass "jump to call with disabled breakpoint"} - -re "$gdb_prompt $"\ - {fail "jump to call with disabled breakpoint"} - timeout {fail "(timeout) jump to call with disabled breakpoint"} -} +gdb_test "jump 21" "Breakpoint \[0-9\]*, .*${srcfile}:22.*" \ + "jump to call with disabled breakpoint" # Verify that GDB responds gracefully to the "jump" command without # an argument. # -send_gdb "jump\n" -gdb_expect { - -re "Argument required .starting address..*$gdb_prompt $"\ - {pass "jump without argument disallowed"} - -re "$gdb_prompt $"\ - {fail "jump without argument disallowed"} - timeout {fail "(timeout) jump without argument disallowed"} -} +gdb_test "jump" "Argument required .starting address.*" \ + "jump without argument disallowed" + # Verify that GDB responds gracefully to the "jump" command with # trailing junk. # -send_gdb "jump 21 100\n" -gdb_expect { - -re "Junk at end of line specification: 100.*$gdb_prompt $"\ - {pass "jump with trailing argument junk"} - -re "$gdb_prompt $"\ - {fail "jump with trailing argument junk"} - timeout {fail "(timeout) jump with trailing argument junk"} -} +gdb_test "jump 21 100" \ + "Junk at end of line specification: 100.*" \ + "jump with trailing argument junk" + # Verify that GDB responds gracefully to a request to jump out of # the current function. (Note that this will very likely cause the @@ -145,39 +108,18 @@ gdb_expect { # # Try it both ways: confirming and not confirming the jump. # -send_gdb "jump 12\n" -gdb_expect { - -re "Line 12 is not in `main'. Jump anyway.*y or n. $"\ - {send_gdb "n\n" - gdb_expect { - -re "Not confirmed.*$gdb_prompt $"\ - {pass "aborted jump out of current function"} - -re "$gdb_prompt $"\ - {fail "aborted jump out of current function"} - timeout {fail "(timeout) aborted jump out of current function"} - } - } - -re "$gdb_prompt $"\ - {fail "aborted jump out of current function"} - timeout {fail "(timeout) aborted jump out of current function"} -} -send_gdb "jump 12\n" -gdb_expect { - -re "Line 12 is not in `main'. Jump anyway.*y or n. $"\ - {send_gdb "y\n" - gdb_expect { - -re "Continuing at.*$gdb_prompt $"\ - {pass "jump out of current function"} - -re "$gdb_prompt $"\ - {fail "jump out of current function"} - timeout {fail "(timeout) jump out of current function"} - } - } - -re "$gdb_prompt $"\ - {fail "jump out of current function"} - timeout {fail "(timeout) jump out of current function"} -} +gdb_test "jump 12" \ + "Not confirmed.*" \ + "aborted jump out of current function" \ + "Line 12 is not in `main'. Jump anyway.*y or n. $" \ + "n" + +gdb_test "jump 12" \ + "Continuing at.*" \ + "jump out of current function" \ + "Line 12 is not in `main'. Jump anyway.*y or n. $" \ + "y" gdb_exit return 0 Index: long_long.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/long_long.exp,v retrieving revision 1.30 diff -u -p -r1.30 long_long.exp --- long_long.exp 1 Jan 2010 07:32:01 -0000 1.30 +++ long_long.exp 21 May 2010 20:12:01 -0000 @@ -61,15 +61,9 @@ if { ![runto known_types] } then { return } -set target_bigendian_p 1 -send_gdb "show endian\n" -gdb_expect { +gdb_test_multiple "show endian" "getting target endian" { -re "little endian.*$gdb_prompt $" { set target_bigendian_p 0 } - -re "big endian.*$gdb_prompt $" { } - -re "$gdb_prompt $" { - fail "getting target endian" - } - default { fail "(timeout) getting target endian" } + -re "big endian.*$gdb_prompt $" { set target_bigendian_p 1 } } # Detect the size of the target's basic types.