aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r--gdb/testsuite/gdb.base/foll-exec.exp42
-rw-r--r--gdb/testsuite/gdb.base/foll-fork.exp57
-rw-r--r--gdb/testsuite/gdb.base/foll-vfork.exp62
3 files changed, 118 insertions, 43 deletions
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp
index 21c69af..1a4d2a7 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp
@@ -11,16 +11,9 @@
# 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, see <http://www.gnu.org/licenses/>. */
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
-if $tracelevel then {
- strace $tracelevel
- }
-
-if { ![isnative] } then {
+if { [is_remote target] || ![isnative] } then {
continue
}
@@ -48,7 +41,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# Until "catch exec" is implemented on other targets...
#
-if ![istarget "hppa*-hp-hpux*"] then {
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
continue
}
@@ -93,6 +86,33 @@ proc do_exec_tests {} {
return
}
+ # Verify that the system supports "catch exec".
+ gdb_test "catch exec" "Catchpoint \[0-9\]* \\(exec\\)" "insert first exec catchpoint"
+ set has_exec_catchpoints 0
+ gdb_test_multiple "continue" "continue to first exec catchpoint" {
+ -re ".*Your system does not support exec catchpoints.*$gdb_prompt $" {
+ unsupported "continue to first exec catchpoint"
+ }
+ -re ".*Catchpoint.*$gdb_prompt $" {
+ set has_exec_catchpoints 1
+ pass "continue to first exec catchpoint"
+ }
+ }
+
+ if {$has_exec_catchpoints == 0} {
+ unsupported "exec catchpoints"
+ return
+ }
+
+ zap_session
+
+ # Start the program running, and stop at main.
+ #
+ if ![runto_main] then {
+ perror "Couldn't run ${testfile}"
+ return
+ }
+
# Verify that we can see various global and local variables
# in this program, and that they have expected values. Some
# of these variables are also declared in the program we'll
@@ -213,7 +233,7 @@ proc do_exec_tests {} {
setup_xfail hppa2.0w-hp-hpux* CLLbs16760
send_gdb "continue\n"
gdb_expect {
- -re ".*Executing new program:.*${testfile2}.*Catchpoint .*(exec\'d .*${testfile2}).*in .START..*$gdb_prompt $"\
+ -re ".*Executing new program:.*${testfile2}.*Catchpoint .*(exec\'d .*${testfile2}).*in .*$gdb_prompt $"\
{pass "hit catch exec"}
-re "$gdb_prompt $" {fail "hit catch exec"}
timeout {fail "(timeout) hit catch exec"}
diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp
index 7ce72e1..b3aae8c 100644
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -11,22 +11,16 @@
# 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, see <http://www.gnu.org/licenses/>. */
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
-if $tracelevel then {
- strace $tracelevel
- }
-
-if { ![isnative] } then {
+if { [is_remote target] || ![isnative] } then {
continue
}
set prms_id 0
set bug_id 0
+global srcfile
set testfile "foll-fork"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
@@ -41,10 +35,32 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# Until "set follow-fork-mode" and "catch fork" are implemented on
# other targets...
#
-if ![istarget "hppa*-hp-hpux*"] then {
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
continue
}
+proc check_fork_catchpoints {} {
+ global gdb_prompt
+
+ # Verify that the system supports "catch fork".
+ gdb_test "catch fork" "Catchpoint \[0-9\]* \\(fork\\)" "insert first fork catchpoint"
+ set has_fork_catchpoints 0
+ gdb_test_multiple "continue" "continue to first fork catchpoint" {
+ -re ".*Your system does not support fork catchpoints.*$gdb_prompt $" {
+ unsupported "continue to first fork catchpoint"
+ }
+ -re ".*Catchpoint.*$gdb_prompt $" {
+ set has_fork_catchpoints 1
+ pass "continue to first fork catchpoint"
+ }
+ }
+
+ if {$has_fork_catchpoints == 0} {
+ unsupported "fork catchpoints"
+ return -code return
+ }
+}
+
proc default_fork_parent_follow {} {
global gdb_prompt
@@ -115,7 +131,7 @@ proc explicit_fork_child_follow {} {
}
send_gdb "next 2\n"
gdb_expect {
- -re "Detaching from program:.*Attaching after fork to.*$gdb_prompt $"\
+ -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"}
@@ -129,6 +145,7 @@ proc explicit_fork_child_follow {} {
proc catch_fork_child_follow {} {
global gdb_prompt
+ global srcfile
send_gdb "catch fork\n"
gdb_expect {
@@ -153,7 +170,7 @@ proc catch_fork_child_follow {} {
send_gdb "continue\n"
gdb_expect {
- -re "Catchpoint.*(forked process.*),.*in _fork_sys.*$gdb_prompt $"\
+ -re "Catchpoint.*(forked process.*),.*in .*fork.*$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"}
@@ -175,7 +192,7 @@ proc catch_fork_child_follow {} {
-re "$gdb_prompt $" {pass "set follow child"}
timeout {fail "(timeout) set follow child"}
}
- send_gdb "tbreak 24\n"
+ send_gdb "tbreak ${srcfile}:24\n"
gdb_expect {
-re "Breakpoint.*, line 24.*$gdb_prompt $"\
{pass "set follow child, tbreak"}
@@ -184,7 +201,7 @@ proc catch_fork_child_follow {} {
}
send_gdb "continue\n"
gdb_expect {
- -re ".*Detaching from program:.*Attaching after fork to.* at .*24.*$gdb_prompt $"\
+ -re "Attaching after fork to.* at .*24.*$gdb_prompt $"\
{pass "set follow child, hit tbreak"}
-re "$gdb_prompt $" {fail "set follow child, hit tbreak"}
timeout {fail "(timeout) set follow child, hit tbreak"}
@@ -211,6 +228,7 @@ proc catch_fork_child_follow {} {
proc tcatch_fork_parent_follow {} {
global gdb_prompt
+ global srcfile
send_gdb "catch fork\n"
gdb_expect {
@@ -225,7 +243,7 @@ proc tcatch_fork_parent_follow {} {
send_gdb "continue\n"
gdb_expect {
- -re ".*in _fork_sys.*$gdb_prompt $"\
+ -re ".*in .*fork.*$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"}
@@ -235,7 +253,7 @@ proc tcatch_fork_parent_follow {} {
-re "$gdb_prompt $" {pass "set follow parent"}
timeout {fail "(timeout) set follow parent"}
}
- send_gdb "tbreak 24\n"
+ send_gdb "tbreak ${srcfile}:24\n"
gdb_expect {
-re "Breakpoint.*, line 24.*$gdb_prompt $"\
{pass "set follow parent, tbreak"}
@@ -313,6 +331,10 @@ By default, the debugger will follow the parent process..*$gdb_prompt $"\
timeout {fail "set follow 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.
#
@@ -357,6 +379,9 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+# The "Detaching..." and "Attaching..." messages may be hidden by
+# default.
+gdb_test "set verbose" ""
# This is a test of gdb's ability to follow the parent, child or both
# parent and child of a Unix fork() system call.
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp
index 9f94c86..4500999 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
@@ -11,16 +11,9 @@
# 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, see <http://www.gnu.org/licenses/>. */
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
-if $tracelevel then {
- strace $tracelevel
- }
-
-if { ![isnative] } then {
+if { [is_remote target] || ![isnative] } then {
continue
}
@@ -35,6 +28,7 @@ set bug_id 0
## return 0
##}
+global srcfile
set testfile "foll-vfork"
set testfile2 "vforked-prog"
set srcfile ${testfile}.c
@@ -56,7 +50,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {d
# Until "set follow-fork-mode" and "catch vfork" are implemented on
# other targets...
#
-if ![istarget "hppa*-hp-hpux*"] then {
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
continue
}
@@ -73,6 +67,29 @@ if [istarget "hppa*-hp-hpux10.20"] then {
set oldtimeout $timeout
set timeout [expr "$timeout + 10"]
+proc check_vfork_catchpoints {} {
+ global gdb_prompt
+ global has_vfork_catchpoints
+
+ # Verify that the system supports "catch vfork".
+ gdb_test "catch vfork" "Catchpoint \[0-9\]* \\(vfork\\)" "insert first vfork catchpoint"
+ set has_vfork_catchpoints 0
+ gdb_test_multiple "continue" "continue to first vfork catchpoint" {
+ -re ".*Your system does not support vfork catchpoints.*$gdb_prompt $" {
+ unsupported "continue to first vfork catchpoint"
+ }
+ -re ".*Catchpoint.*$gdb_prompt $" {
+ set has_vfork_catchpoints 1
+ pass "continue to first vfork catchpoint"
+ }
+ }
+
+ if {$has_vfork_catchpoints == 0} {
+ unsupported "vfork catchpoints"
+ return -code return
+ }
+}
+
proc vfork_parent_follow_through_step {} {
global gdb_prompt
@@ -97,20 +114,21 @@ proc vfork_parent_follow_through_step {} {
proc vfork_parent_follow_to_bp {} {
global gdb_prompt
+ global srcfile
send_gdb "set follow parent\n"
gdb_expect {
-re "$gdb_prompt $" {pass "set follow parent, vfork to bp"}
timeout {fail "set follow parent, vfork to bp"}
}
- send_gdb "break 18\n"
+ send_gdb "break ${srcfile}:18\n"
gdb_expect {
-re "$gdb_prompt $" {pass "break, vfork to bp"}
timeout {fail "break, vfork to bp"}
}
send_gdb "continue\n"
gdb_expect {
- -re ".*Detaching after fork from process.*Breakpoint.*18.*$gdb_prompt "\
+ -re ".*Detaching after fork from child process.*Breakpoint.*18.*$gdb_prompt "\
{pass "vfork parent follow, to bp"}
-re "$gdb_prompt $" {fail "vfork parent follow, to bp"}
timeout {fail "(timeout) vfork parent follow, to bp" }
@@ -133,7 +151,7 @@ proc vfork_and_exec_child_follow_to_main_bp {} {
}
send_gdb "continue\n"
gdb_expect {
- -re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
+ -re "Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
{pass "vfork and exec child follow, to main bp"}
-re "$gdb_prompt $" {fail "vfork and exec child follow, to main bp"}
timeout {fail "(timeout) vfork and exec child follow, to main bp" }
@@ -191,7 +209,7 @@ proc vfork_and_exec_child_follow_through_step {} {
}
send_gdb "next\n"
gdb_expect {
- -re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
+ -re "Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
{pass "vfork and exec child follow, through step"}
-re "$gdb_prompt $" {fail "vfork and exec child follow, through step"}
timeout {fail "(timeout) vfork and exec child follow, through step" }
@@ -248,7 +266,7 @@ proc tcatch_vfork_then_parent_follow {} {
gdb_expect {
-re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt "\
{pass "vfork parent follow, tcatch vfork"}
- -re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt "\
+ -re "vfork \\(\\) at.*$gdb_prompt "\
{pass "vfork parent follow, tcatch vfork"}
-re "$gdb_prompt $" {fail "vfork parent follow, tcatch vfork"}
timeout {fail "(timeout) vfork parent follow, tcatch vfork"}
@@ -269,6 +287,7 @@ proc tcatch_vfork_then_parent_follow {} {
proc tcatch_vfork_then_child_follow {} {
global gdb_prompt
+ global srcfile
global srcfile2
send_gdb "set follow child\n"
@@ -287,6 +306,8 @@ proc tcatch_vfork_then_child_follow {} {
# HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs
# stop you in "_vfork".
gdb_expect {
+ -re "vfork \\(\\) at .*$gdb_prompt $"\
+ {pass "vfork child follow, tcatch vfork"}
-re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt "\
{pass "vfork child follow, tcatch vfork"}
-re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt "\
@@ -296,8 +317,10 @@ proc tcatch_vfork_then_child_follow {} {
}
send_gdb "finish\n"
gdb_expect {
- -re "Run till exit from.*vfork.*${srcfile2}:9.*$gdb_prompt "\
+ -re "Run till exit from.*vfork.*${srcfile}:12.*$gdb_prompt "\
{pass "vfork child follow, finish after tcatch vfork"}
+ -re "Run till exit from.*vfork.*${srcfile2}:9.*$gdb_prompt "\
+ {pass "vfork child follow, finish after tcatch vfork (followed exec)"}
-re "$gdb_prompt $" {fail "vfork child follow, finish after tcatch vfork"}
timeout {fail "(timeout) vfork child follow, finish after tcatch vfork" }
}
@@ -311,6 +334,10 @@ proc tcatch_vfork_then_child_follow {} {
proc do_vfork_and_exec_tests {} {
global gdb_prompt
+ # Check that vfork catchpoints are supported, as an indicator for whether
+ # vfork-following is supported.
+ if [runto_main] then { check_vfork_catchpoints }
+
# Try following the parent process by stepping through a call to
# vfork. Do this without catchpoints.
if [runto_main] then { vfork_parent_follow_through_step }
@@ -362,6 +389,9 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+# The "Detaching..." and "Attaching..." messages may be hidden by
+# default.
+gdb_test "set verbose" ""
# This is a test of gdb's ability to follow the parent or child
# of a Unix vfork() system call. (The child will subsequently