This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfa] re-indent foll-fork.exp foll-exec.exp foll-vfork.exp
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 23 Feb 2011 14:07:16 -0800
- Subject: [rfa] re-indent foll-fork.exp foll-exec.exp foll-vfork.exp
These files all contain a mixture of 2,3,4 and 5-space indents.
Re-indent them to a consistent 4 spaces.
2011-02-23 Michael Snyder <msnyder@vmware.com>
* gdb.base/foll-exec.exp: Re-indent.
* gdb.base/foll-fork.exp: Ditto.
* gdb.base/foll-vfork.exp: Ditto.
Index: foll-exec.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/foll-exec.exp,v
retrieving revision 1.15
diff -u -p -u -p -r1.15 foll-exec.exp
--- foll-exec.exp 11 Jan 2011 19:16:23 -0000 1.15
+++ foll-exec.exp 23 Feb 2011 22:04:01 -0000
@@ -28,13 +28,13 @@ set binfile2 ${objdir}/${subdir}/${testf
# build the first test case
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug}] != "" } {
- untested foll-exec.exp
- return -1
+ untested foll-exec.exp
+ return -1
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested foll-exec.exp
- return -1
+ untested foll-exec.exp
+ return -1
}
@@ -45,359 +45,382 @@ if {![istarget "hppa*-hp-hpux*"] && ![is
}
proc zap_session {} {
- global gdb_prompt
- global binfile
+ global gdb_prompt
+ global binfile
- send_gdb "kill\n"
- gdb_expect {
- -re ".*Kill the program being debugged.*y or n. $" {
- send_gdb "y\n"
- send_gdb "file $binfile\n"
- gdb_expect {
- -re ".*Load new symbol table from.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "Reading symbols from.*$gdb_prompt $" {}
- timeout { fail "loading symbols (timeout)"; return }
- }
- }
- -re ".*gdb_prompt $" {}
- timeout { fail "loading symbols (timeout)"; return }
- }
- }
- -re ".*$gdb_prompt $" {}
- timeout { fail "killing inferior (timeout)" ; return }
- }
+ send_gdb "kill\n"
+ gdb_expect {
+ -re ".*Kill the program being debugged.*y or n. $" {
+ send_gdb "y\n"
+ send_gdb "file $binfile\n"
+ gdb_expect {
+ -re ".*Load new symbol table from.*y or n. $" {
+ send_gdb "y\n"
+ gdb_expect {
+ -re "Reading symbols from.*$gdb_prompt $" {}
+ timeout { fail "loading symbols (timeout)"; return }
+ }
+ }
+ -re ".*gdb_prompt $" {}
+ timeout { fail "loading symbols (timeout)"; return }
+ }
+ }
+ -re ".*$gdb_prompt $" {}
+ timeout { fail "killing inferior (timeout)" ; return }
+ }
}
proc do_exec_tests {} {
- global gdb_prompt
- global binfile
- global srcfile
- global srcfile2
- global testfile
- global testfile2
-
- # Start the program running, and stop at main.
- #
- if ![runto_main] then {
- perror "Couldn't run ${testfile}"
- 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 this type\r\nof catchpoint.*$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
- # exec in a moment.
- #
- send_gdb "next 3\n"
- gdb_expect {
- -re "20.*execlp.*$gdb_prompt $"\
- {pass "step to exec call"}
- -re "$gdb_prompt $" {fail "step to exec call"}
- timeout {fail "(timeout) step to exec call"}
- }
- send_gdb "print global_i\n"
- gdb_expect {
- -re ".* = 100.*$gdb_prompt $"\
- {pass "print follow-exec/global_i"}
- -re "$gdb_prompt $" {fail "print follow-exec/global_i"}
- timeout {fail "(timeout) print follow-exec/global_i"}
- }
- send_gdb "print local_j\n"
- gdb_expect {
- -re ".* = 101.*$gdb_prompt $"\
- {pass "print follow-exec/local_j"}
- -re "$gdb_prompt $" {fail "print follow-exec/local_j"}
- timeout {fail "(timeout) print follow-exec/local_j"}
- }
- send_gdb "print local_k\n"
- gdb_expect {
- -re ".* = 102.*$gdb_prompt $"\
- {pass "print follow-exec/local_k"}
- -re "$gdb_prompt $" {fail "print follow-exec/local_k"}
- timeout {fail "(timeout) print follow-exec/local_k"}
- }
-
- # Try stepping through an execlp call, without catching it.
- # We should stop in execd-program, at its first statement.
- #
- send_gdb "next\n"
- gdb_expect {
- -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\
- {pass "step through execlp call"}
- -re "$gdb_prompt $" {fail "step through execlp call"}
- timeout {fail "(timeout) step through execlp call"}
- }
-
- # Verify that we can see the variables defined in the newly-exec'd
- # program, and CANNOT see those defined in the exec'ing program.
- #
- send_gdb "next\n"
- gdb_expect {
- -re "26.*printf.*$gdb_prompt $"\
- {pass "step after execlp call"}
- -re "$gdb_prompt $" {fail "step after execlp call"}
- timeout {fail "(timeout) step after execlp call"}
- }
- send_gdb "print global_i\n"
- gdb_expect {
- -re ".* = 0.*$gdb_prompt $"\
- {pass "print execd-program/global_i (after execlp)"}
- -re "$gdb_prompt $" {fail "print execd-program/global_i (after execlp)"}
- timeout {fail "(timeout) print execd-program/global_i (after execlp)"}
- }
- send_gdb "print local_j\n"
- gdb_expect {
- -re ".* = 2.*$gdb_prompt $"\
- {pass "print execd-program/local_j (after execlp)"}
- -re "$gdb_prompt $" {fail "print execd-program/local_j (after execlp)"}
- timeout {fail "(timeout) print execd-program/local_j (after execlp)"}
- }
- send_gdb "print local_k\n"
- gdb_expect {
- -re "No symbol \"local_k\" in current context.*$gdb_prompt $"\
- {pass "print follow-exec/local_k (after execlp)"}
- -re "$gdb_prompt $" {fail "print follow-exec/local_k (after execlp)"}
- timeout {fail "(timeout) print follow-exec/local_k (after execlp)"}
- }
-
- # Explicitly kill this program, or a subsequent rerun actually runs
- # the exec'd program, not the original program...
- zap_session
-
- # Start the program running, and stop at main.
- #
- if ![runto_main] then {
- perror "Couldn't run ${testfile} (2nd try)"
- return
- }
-
- # Verify that we can catch an exec event, and then continue
- # to follow through the exec. (Since there's a breakpoint on
- # "main", it'll also be transferred to the exec'd program,
- # and we expect to stop there.)
- #
- send_gdb "catch exec\n"
- gdb_expect {
- -re "Catchpoint .*(exec).*$gdb_prompt $"\
- {pass "set catch exec"}
- -re "$gdb_prompt $" {fail "set catch exec"}
- timeout {fail "(timeout) set catch exec"}
- }
-
- # Verify that the catchpoint is mentioned in an "info breakpoints",
- # and further that the catchpoint mentions no program name.
- #
- set msg "info shows catchpoint without exec pathname"
- gdb_test_multiple "info breakpoints" $msg {
- -re ".*catchpoint.*keep y.*exec\[\n\r\]+$gdb_prompt $" {
- pass $msg
- }
- }
-
- # DTS CLLbs16760
- # PA64 doesn't know about $START$ in dld.sl at this point. It should.
- # - Michael Coulter
- setup_xfail hppa2.0w-hp-hpux* CLLbs16760
- send_gdb "continue\n"
- gdb_expect {
- -re ".*xecuting 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"}
- }
-
- # DTS CLLbs16760
- # test gets out of sync if previous test fails.
- gdb_test "bt" ".*" "sync up after possible failure 1"
- gdb_test "bt" "#0.*" "sync up after possible failure 2"
-
- # Verify that the catchpoint is mentioned in an "info breakpoints",
- # and further that the catchpoint managed to capture the exec'd
- # program's name.
- #
- set msg "info shows catchpoint exec pathname"
- gdb_test_multiple "info breakpoints" $msg {
- -re ".*catchpoint.*keep y.*exec, program \".*${testfile2}\".*$gdb_prompt $" {
- pass $msg
- }
- }
-
- # Verify that we can continue from the catchpoint, and land in the
- # main of the newly-exec'd program.
- #
- send_gdb "continue\n"
- gdb_expect {
- -re ".*${srcfile2}:23.*$gdb_prompt $"\
- {pass "continue after hit catch exec"}
- -re "$gdb_prompt $" {fail "continue after hit catch exec"}
- timeout {fail "(timeout) continue after hit catch exec"}
- }
-
- # Explicitly kill this program, or a subsequent rerun actually runs
- # the exec'd program, not the original program...
- zap_session
-
- # Start the program running, and stop at main.
- #
- if ![runto_main] then {
- perror "Couldn't run ${testfile} (3rd try)"
- return
- }
-
- # Verify that we can follow through follow an execl()
- # call. (We must jump around earlier exec* calls.)
- #
- send_gdb "tbreak 27\n"
- gdb_expect {
- -re "Temporary breakpoint .*file .*${srcfile}, line 27.*$gdb_prompt $"\
- {pass "prepare to jump to execl call"}
- -re "$gdb_prompt $" {fail "prepare to jump to execl call"}
- timeout {fail "(timeout) prepare to jump to execl call"}
- }
- send_gdb "jump 27\n"
- gdb_expect {
- -re "main.* at .*${srcfile}:27.*$gdb_prompt $"\
- {pass "jump to execl call"}
- -re "$gdb_prompt $" {fail "jump to execl call"}
- timeout {fail "(timeout) jump to execl call"}
- }
- # Note that stepping through an exec call causes the step-count
- # to be reset to zero. I.e.: you may specify "next 2" at the
- # call, but you'll actually stop at the first breakpoint set in
- # the newly-exec'd program, not after the remaining step-count
- # reaches zero.
- #
- send_gdb "next 2\n"
- gdb_expect {
- -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\
- {pass "step through execl call"}
- -re "$gdb_prompt $" {fail "step through execl call"}
- timeout {fail "(timeout) step through execl call"}
- }
- send_gdb "next\n"
- gdb_expect {
- -re "26.*printf.*$gdb_prompt $"\
- {pass "step after execl call"}
- -re "$gdb_prompt $" {fail "step after execl call"}
- timeout {fail "(timeout) step after execl call"}
- }
-
- # Verify that we can print a local variable (which happens to be
- # assigned the value of main's argc).
- #
- send_gdb "print local_j\n"
- gdb_expect {
- -re ".* = 3.*$gdb_prompt $"\
- {pass "print execd-program/local_j (after execl)"}
- -re "$gdb_prompt $" {fail "print execd-program/local_j (after execl)"}
- timeout {fail "(timeout) print execd-program/local_j (after execl)"}
- }
-
- # Explicitly kill this program, or a subsequent rerun actually runs
- # the exec'd program, not the original program...
- zap_session
-
- # Start the program running, and stop at main.
- #
- if ![runto_main] then {
- perror "Couldn't run ${testfile} (4th try)"
- return
- }
-
- # Verify that we can follow through follow an execv()
- # call. (We must jump around earlier exec* calls.)
- #
- send_gdb "tbreak 41\n"
- gdb_expect {
- -re "Temporary breakpoint .*file .*${srcfile}, line 41.*$gdb_prompt $"\
- {pass "prepare to jump to execv call"}
- -re "$gdb_prompt $" {fail "prepare to jump to execv call"}
- timeout {fail "(timeout) prepare to jump to execv call"}
- }
- send_gdb "jump 41\n"
- gdb_expect {
- -re "main.* at .*${srcfile}:41.*$gdb_prompt $"\
- {pass "jump to execv call"}
- -re "$gdb_prompt $" {fail "jump to execv call"}
- timeout {fail "(timeout) jump to execv call"}
- }
- send_gdb "next\n"
- gdb_expect {
- -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\
- {pass "step through execv call"}
- -re "$gdb_prompt $" {fail "step through execv call"}
- timeout {fail "(timeout) step through execv call"}
- }
- send_gdb "next\n"
- gdb_expect {
- -re "26.*printf.*$gdb_prompt $"\
- {pass "step after execv call"}
- -re "$gdb_prompt $" {fail "step after execv call"}
- timeout {fail "(timeout) step after execv call"}
- }
-
- # Verify that we can print a local variable (which happens to be
- # assigned the value of main's argc).
- #
- send_gdb "print local_j\n"
- gdb_expect {
- -re ".* = 2.*$gdb_prompt $"\
- {pass "print execd-program/local_j (after execv)"}
- -re "$gdb_prompt $" {fail "print execd-program/local_j (after execv)"}
- timeout {fail "(timeout) print execd-program/local_j (after execv)"}
- }
-
- # Explicitly kill this program, or a subsequent rerun actually runs
- # the exec'd program, not the original program...
- zap_session
-
- # Start the program running, and stop at main.
- #
- if ![runto_main] then {
- perror "Couldn't run ${testfile} (5th try)"
- return
- }
-
- # Verify that we can just continue and thereby follow through an
- # exec call. (Since the breakpoint on "main" is reset, we should
- # just stop in main of the newly-exec'd program.)
- #
- send_gdb "continue\n"
- gdb_expect {
- -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\
- {pass "continue through exec"}
- -re "$gdb_prompt $" {fail "continue through exec"}
- timeout {fail "(timeout) continue through exec"}
- }
+ global gdb_prompt
+ global binfile
+ global srcfile
+ global srcfile2
+ global testfile
+ global testfile2
+
+ # Start the program running, and stop at main.
+ #
+ if ![runto_main] then {
+ perror "Couldn't run ${testfile}"
+ 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 this type\r\nof catchpoint.*$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
+ # exec in a moment.
+ #
+ send_gdb "next 3\n"
+ gdb_expect {
+ -re "20.*execlp.*$gdb_prompt $" {
+ pass "step to exec call"
+ }
+ -re "$gdb_prompt $" {fail "step to exec call"}
+ timeout {fail "(timeout) step to exec call"}
+ }
+ send_gdb "print global_i\n"
+ gdb_expect {
+ -re ".* = 100.*$gdb_prompt $" {
+ pass "print follow-exec/global_i"
+ }
+ -re "$gdb_prompt $" {fail "print follow-exec/global_i"}
+ timeout {fail "(timeout) print follow-exec/global_i"}
+ }
+ send_gdb "print local_j\n"
+ gdb_expect {
+ -re ".* = 101.*$gdb_prompt $" {
+ pass "print follow-exec/local_j"
+ }
+ -re "$gdb_prompt $" {fail "print follow-exec/local_j"}
+ timeout {fail "(timeout) print follow-exec/local_j"}
+ }
+ send_gdb "print local_k\n"
+ gdb_expect {
+ -re ".* = 102.*$gdb_prompt $" {
+ pass "print follow-exec/local_k"
+ }
+ -re "$gdb_prompt $" {fail "print follow-exec/local_k"}
+ timeout {fail "(timeout) print follow-exec/local_k"}
+ }
+
+ # Try stepping through an execlp call, without catching it.
+ # We should stop in execd-program, at its first statement.
+ #
+ send_gdb "next\n"
+ gdb_expect {
+ -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $" {
+ pass "step through execlp call"
+ }
+ -re "$gdb_prompt $" {fail "step through execlp call"}
+ timeout {fail "(timeout) step through execlp call"}
+ }
+
+ # Verify that we can see the variables defined in the newly-exec'd
+ # program, and CANNOT see those defined in the exec'ing program.
+ #
+ send_gdb "next\n"
+ gdb_expect {
+ -re "26.*printf.*$gdb_prompt $" {
+ pass "step after execlp call"
+ }
+ -re "$gdb_prompt $" {fail "step after execlp call"}
+ timeout {fail "(timeout) step after execlp call"}
+ }
+ send_gdb "print global_i\n"
+ gdb_expect {
+ -re ".* = 0.*$gdb_prompt $" {
+ pass "print execd-program/global_i (after execlp)"
+ }
+ -re "$gdb_prompt $" {fail "print execd-program/global_i (after execlp)"}
+ timeout {fail "(timeout) print execd-program/global_i (after execlp)"}
+ }
+ send_gdb "print local_j\n"
+ gdb_expect {
+ -re ".* = 2.*$gdb_prompt $" {
+ pass "print execd-program/local_j (after execlp)"
+ }
+ -re "$gdb_prompt $" {fail "print execd-program/local_j (after execlp)"}
+ timeout {fail "(timeout) print execd-program/local_j (after execlp)"}
+ }
+ send_gdb "print local_k\n"
+ gdb_expect {
+ -re "No symbol \"local_k\" in current context.*$gdb_prompt $" {
+ pass "print follow-exec/local_k (after execlp)"
+ }
+ -re "$gdb_prompt $" {fail "print follow-exec/local_k (after execlp)"}
+ timeout {fail "(timeout) print follow-exec/local_k (after execlp)"}
+ }
+
+ # Explicitly kill this program, or a subsequent rerun actually runs
+ # the exec'd program, not the original program...
+ zap_session
+
+ # Start the program running, and stop at main.
+ #
+ if ![runto_main] then {
+ perror "Couldn't run ${testfile} (2nd try)"
+ return
+ }
+
+ # Verify that we can catch an exec event, and then continue
+ # to follow through the exec. (Since there's a breakpoint on
+ # "main", it'll also be transferred to the exec'd program,
+ # and we expect to stop there.)
+ #
+ send_gdb "catch exec\n"
+ gdb_expect {
+ -re "Catchpoint .*(exec).*$gdb_prompt $" {
+ pass "set catch exec"
+ }
+ -re "$gdb_prompt $" {fail "set catch exec"}
+ timeout {fail "(timeout) set catch exec"}
+ }
+
+ # Verify that the catchpoint is mentioned in an "info breakpoints",
+ # and further that the catchpoint mentions no program name.
+ #
+ set msg "info shows catchpoint without exec pathname"
+ gdb_test_multiple "info breakpoints" $msg {
+ -re ".*catchpoint.*keep y.*exec\[\n\r\]+$gdb_prompt $" {
+ pass $msg
+ }
+ }
+
+ # DTS CLLbs16760
+ # PA64 doesn't know about $START$ in dld.sl at this point. It should.
+ # - Michael Coulter
+ setup_xfail hppa2.0w-hp-hpux* CLLbs16760
+ send_gdb "continue\n"
+ gdb_expect {
+ -re ".*xecuting 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"}
+ }
+
+ # DTS CLLbs16760
+ # test gets out of sync if previous test fails.
+ gdb_test "bt" ".*" "sync up after possible failure 1"
+ gdb_test "bt" "#0.*" "sync up after possible failure 2"
+
+ # Verify that the catchpoint is mentioned in an "info breakpoints",
+ # and further that the catchpoint managed to capture the exec'd
+ # program's name.
+ #
+ set msg "info shows catchpoint exec pathname"
+ gdb_test_multiple "info breakpoints" $msg {
+ -re ".*catchpoint.*keep y.*exec, program \".*${testfile2}\".*$gdb_prompt $" {
+ pass $msg
+ }
+ }
+
+ # Verify that we can continue from the catchpoint, and land in the
+ # main of the newly-exec'd program.
+ #
+ send_gdb "continue\n"
+ gdb_expect {
+ -re ".*${srcfile2}:23.*$gdb_prompt $" {
+ pass "continue after hit catch exec"
+ }
+ -re "$gdb_prompt $" {fail "continue after hit catch exec"}
+ timeout {fail "(timeout) continue after hit catch exec"}
+ }
+
+ # Explicitly kill this program, or a subsequent rerun actually runs
+ # the exec'd program, not the original program...
+ zap_session
+
+ # Start the program running, and stop at main.
+ #
+ if ![runto_main] then {
+ perror "Couldn't run ${testfile} (3rd try)"
+ return
+ }
+
+ # Verify that we can follow through follow an execl()
+ # call. (We must jump around earlier exec* calls.)
+ #
+ send_gdb "tbreak 27\n"
+ gdb_expect {
+ -re "Temporary breakpoint .*file .*${srcfile}, line 27.*$gdb_prompt $" {
+ pass "prepare to jump to execl call"
+ }
+ -re "$gdb_prompt $" {fail "prepare to jump to execl call"}
+ timeout {fail "(timeout) prepare to jump to execl call"}
+ }
+ send_gdb "jump 27\n"
+ gdb_expect {
+ -re "main.* at .*${srcfile}:27.*$gdb_prompt $" {
+ pass "jump to execl call"
+ }
+ -re "$gdb_prompt $" {fail "jump to execl call"}
+ timeout {fail "(timeout) jump to execl call"}
+ }
+ # Note that stepping through an exec call causes the step-count
+ # to be reset to zero. I.e.: you may specify "next 2" at the
+ # call, but you'll actually stop at the first breakpoint set in
+ # the newly-exec'd program, not after the remaining step-count
+ # reaches zero.
+ #
+ send_gdb "next 2\n"
+ gdb_expect {
+ -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $" {
+ pass "step through execl call"
+ }
+ -re "$gdb_prompt $" {fail "step through execl call"}
+ timeout {fail "(timeout) step through execl call"}
+ }
+ send_gdb "next\n"
+ gdb_expect {
+ -re "26.*printf.*$gdb_prompt $" {
+ pass "step after execl call"
+ }
+ -re "$gdb_prompt $" {fail "step after execl call"}
+ timeout {fail "(timeout) step after execl call"}
+ }
+
+ # Verify that we can print a local variable (which happens to be
+ # assigned the value of main's argc).
+ #
+ send_gdb "print local_j\n"
+ gdb_expect {
+ -re ".* = 3.*$gdb_prompt $" {
+ pass "print execd-program/local_j (after execl)"
+ }
+ -re "$gdb_prompt $" {fail "print execd-program/local_j (after execl)"}
+ timeout {fail "(timeout) print execd-program/local_j (after execl)"}
+ }
+
+ # Explicitly kill this program, or a subsequent rerun actually runs
+ # the exec'd program, not the original program...
+ zap_session
+
+ # Start the program running, and stop at main.
+ #
+ if ![runto_main] then {
+ perror "Couldn't run ${testfile} (4th try)"
+ return
+ }
+
+ # Verify that we can follow through follow an execv()
+ # call. (We must jump around earlier exec* calls.)
+ #
+ send_gdb "tbreak 41\n"
+ gdb_expect {
+ -re "Temporary breakpoint .*file .*${srcfile}, line 41.*$gdb_prompt $" {
+ pass "prepare to jump to execv call"
+ }
+ -re "$gdb_prompt $" {fail "prepare to jump to execv call"}
+ timeout {fail "(timeout) prepare to jump to execv call"}
+ }
+ send_gdb "jump 41\n"
+ gdb_expect {
+ -re "main.* at .*${srcfile}:41.*$gdb_prompt $" {
+ pass "jump to execv call"
+ }
+ -re "$gdb_prompt $" {fail "jump to execv call"}
+ timeout {fail "(timeout) jump to execv call"}
+ }
+ send_gdb "next\n"
+ gdb_expect {
+ -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $" {
+ pass "step through execv call"
+ }
+ -re "$gdb_prompt $" {fail "step through execv call"}
+ timeout {fail "(timeout) step through execv call"}
+ }
+ send_gdb "next\n"
+ gdb_expect {
+ -re "26.*printf.*$gdb_prompt $" {
+ pass "step after execv call"
+ }
+ -re "$gdb_prompt $" {fail "step after execv call"}
+ timeout {fail "(timeout) step after execv call"}
+ }
+
+ # Verify that we can print a local variable (which happens to be
+ # assigned the value of main's argc).
+ #
+ send_gdb "print local_j\n"
+ gdb_expect {
+ -re ".* = 2.*$gdb_prompt $" {
+ pass "print execd-program/local_j (after execv)"
+ }
+ -re "$gdb_prompt $" {fail "print execd-program/local_j (after execv)"}
+ timeout {fail "(timeout) print execd-program/local_j (after execv)"}
+ }
+
+ # Explicitly kill this program, or a subsequent rerun actually runs
+ # the exec'd program, not the original program...
+ zap_session
+
+ # Start the program running, and stop at main.
+ #
+ if ![runto_main] then {
+ perror "Couldn't run ${testfile} (5th try)"
+ return
+ }
+
+ # Verify that we can just continue and thereby follow through an
+ # exec call. (Since the breakpoint on "main" is reset, we should
+ # just stop in main of the newly-exec'd program.)
+ #
+ send_gdb "continue\n"
+ gdb_expect {
+ -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $" {
+ pass "continue through exec"
+ }
+ -re "$gdb_prompt $" {fail "continue through exec"}
+ timeout {fail "(timeout) continue through exec"}
+ }
}
# Start with a fresh gdb
Index: foll-fork.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/foll-fork.exp,v
retrieving revision 1.23
diff -u -p -u -p -r1.23 foll-fork.exp
--- foll-fork.exp 11 Jan 2011 19:16:23 -0000 1.23
+++ foll-fork.exp 23 Feb 2011 22:04:01 -0000
@@ -25,8 +25,8 @@ set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested foll-fork.exp
- return -1
+ untested foll-fork.exp
+ return -1
}
@@ -39,25 +39,25 @@ if {![istarget "hppa*-hp-hpux*"] && ![is
}
proc check_fork_catchpoints {} {
- global gdb_prompt
+ 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 this type\r\nof catchpoint.*$gdb_prompt $" {
- unsupported "continue to first fork catchpoint"
- }
- -re ".*Catchpoint.*$gdb_prompt $" {
- set has_fork_catchpoints 1
- pass "continue to first fork catchpoint"
+ # 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 this type\r\nof catchpoint.*$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
- }
+ if {$has_fork_catchpoints == 0} {
+ unsupported "fork catchpoints"
+ return -code return
+ }
}
proc default_fork_parent_follow {} {
Index: foll-vfork.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/foll-vfork.exp,v
retrieving revision 1.16
diff -u -p -u -p -r1.16 foll-vfork.exp
--- foll-vfork.exp 11 Jan 2011 19:16:23 -0000 1.16
+++ foll-vfork.exp 23 Feb 2011 22:04:01 -0000
@@ -36,13 +36,13 @@ set binfile ${objdir}/${subdir}/${testfi
set binfile2 ${objdir}/${subdir}/${testfile2}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested foll-vfork.exp
- return -1
+ untested foll-vfork.exp
+ return -1
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug}] != "" } {
- untested foll-vfork.exp
- return -1
+ untested foll-vfork.exp
+ return -1
}
@@ -67,127 +67,130 @@ set oldtimeout $timeout
set timeout [expr "$timeout + 10"]
proc check_vfork_catchpoints {} {
- global gdb_prompt
- global has_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 this type\r\nof catchpoint.*$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
- }
+ # 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 this type\r\nof catchpoint.*$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
+ global gdb_prompt
- send_gdb "set follow-fork parent\n"
- gdb_expect {
- -re "$gdb_prompt $" {pass "set follow-fork parent, vfork through step"}
- timeout {fail "set follow-fork parent, vfork through step"}
- }
- send_gdb "next\n"
- gdb_expect {
- -re "Detaching after fork from.*13.*$gdb_prompt "\
- {pass "vfork parent follow, through step"}
- -re "$gdb_prompt $" {fail "vfork parent follow, through step"}
- timeout {fail "(timeout) vfork parent follow, through step" }
- }
- # 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
+ send_gdb "set follow-fork parent\n"
+ gdb_expect {
+ -re "$gdb_prompt $" {pass "set follow-fork parent, vfork through step"}
+ timeout {fail "set follow-fork parent, vfork through step"}
+ }
+ send_gdb "next\n"
+ gdb_expect {
+ -re "Detaching after fork from.*13.*$gdb_prompt " {
+ pass "vfork parent follow, through step"
+ }
+ -re "$gdb_prompt $" {fail "vfork parent follow, through step"}
+ timeout {fail "(timeout) vfork parent follow, through step" }
+ }
+ # 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 vfork_parent_follow_to_bp {} {
- global gdb_prompt
- global srcfile
+ global gdb_prompt
+ global srcfile
- send_gdb "set follow-fork parent\n"
- gdb_expect {
- -re "$gdb_prompt $" {pass "set follow-fork parent, vfork to bp"}
- timeout {fail "set follow-fork parent, vfork to bp"}
- }
- 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 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" }
- }
- # 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 "set follow-fork parent\n"
+ gdb_expect {
+ -re "$gdb_prompt $" {pass "set follow-fork parent, vfork to bp"}
+ timeout {fail "set follow-fork parent, vfork to bp"}
+ }
+ 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 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" }
+ }
+ # 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 vfork_and_exec_child_follow_to_main_bp {} {
- global gdb_prompt
- global binfile
+ global gdb_prompt
+ global binfile
- send_gdb "set follow-fork child\n"
- gdb_expect {
- -re "$gdb_prompt $" {pass "set follow-fork child, vfork and exec to main bp"}
- timeout {fail "set follow-fork child, vfork and exec to main bp"}
- }
- send_gdb "continue\n"
- gdb_expect {
- -re "Attaching after.* vfork to.*xecuting 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" }
- }
- # The parent 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
-
- # Explicitly kill this child, or a subsequent rerun actually runs
- # the exec'd child, not the original program...
- send_gdb "kill\n"
- gdb_expect {
- -re ".*Kill the program being debugged.*y or n. $" {
- send_gdb "y\n"
- send_gdb "file $binfile\n"
- gdb_expect {
- -re ".*Load new symbol table from.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "Reading symbols from.*$gdb_prompt $" {}
- timeout { fail "loading symbols (timeout)"; return }
- }
- }
- -re ".*gdb_prompt $" {}
- timeout { fail "loading symbols (timeout)"; return }
- }
- }
- -re ".*$gdb_prompt $" {}
- timeout { fail "killing inferior (timeout)" ; return }
+ send_gdb "set follow-fork child\n"
+ gdb_expect {
+ -re "$gdb_prompt $" {pass "set follow-fork child, vfork and exec to main bp"}
+ timeout {fail "set follow-fork child, vfork and exec to main bp"}
+ }
+ send_gdb "continue\n"
+ gdb_expect {
+ -re "Attaching after.* vfork to.*xecuting 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" }
+ }
+ # The parent 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
+
+ # Explicitly kill this child, or a subsequent rerun actually runs
+ # the exec'd child, not the original program...
+ send_gdb "kill\n"
+ gdb_expect {
+ -re ".*Kill the program being debugged.*y or n. $" {
+ send_gdb "y\n"
+ send_gdb "file $binfile\n"
+ gdb_expect {
+ -re ".*Load new symbol table from.*y or n. $" {
+ send_gdb "y\n"
+ gdb_expect {
+ -re "Reading symbols from.*$gdb_prompt $" {}
+ timeout { fail "loading symbols (timeout)"; return }
+ }
+ }
+ -re ".*gdb_prompt $" {}
+ timeout { fail "loading symbols (timeout)"; return }
+ }
+ }
+ -re ".*$gdb_prompt $" {}
+ timeout { fail "killing inferior (timeout)" ; return }
}
}
proc vfork_and_exec_child_follow_through_step {} {
- global gdb_prompt
- global binfile
+ global gdb_prompt
+ global binfile
# This test cannot be performed prior to HP-UX 10.30, because ptrace-based
# debugging of a vforking program basically doesn't allow the child to do
@@ -196,195 +199,205 @@ proc vfork_and_exec_child_follow_through
# the implementation of "next" sets a "step resume" breakpoint at the
# return from the vfork(), which the child will hit on its way to exec'ing.
#
- if { ![istarget "hppa*-*-hpux11.*"] } {
- verbose "vfork child-following next test ignored for non-hppa or pre-HP/UX-10.30 targets."
- return 0
- }
-
- send_gdb "set follow-fork child\n"
- gdb_expect {
- -re "$gdb_prompt $" {pass "set follow-fork child, vfork and exec through step"}
- timeout {fail "set follow-fork child, vfork and exec through step"}
- }
- send_gdb "next\n"
- gdb_expect {
- -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" }
- }
- # 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
-
- # Explicitly kill this child, or a subsequent rerun actually runs
- # the exec'd child, not the original program...
- send_gdb "kill\n"
- gdb_expect {
- -re ".*Kill the program being debugged.*y or n. $" {
- send_gdb "y\n"
- send_gdb "file $binfile\n"
- gdb_expect {
- -re ".*Load new symbol table from.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "Reading symbols from.*$gdb_prompt $" {}
- timeout { fail "loading symbols (timeout)"; return }
- }
- }
- -re ".*gdb_prompt $" {}
- timeout { fail "loading symbols (timeout)"; return }
- }
- }
- -re ".*$gdb_prompt $" {}
- timeout { fail "killing inferior (timeout)" ; return }
+ if { ![istarget "hppa*-*-hpux11.*"] } {
+ verbose "vfork child-following next test ignored for non-hppa or pre-HP/UX-10.30 targets."
+ return 0
+ }
+
+ send_gdb "set follow-fork child\n"
+ gdb_expect {
+ -re "$gdb_prompt $" {pass "set follow-fork child, vfork and exec through step"}
+ timeout {fail "set follow-fork child, vfork and exec through step"}
+ }
+ send_gdb "next\n"
+ gdb_expect {
+ -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"}
+ }
+ # 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
+
+ # Explicitly kill this child, or a subsequent rerun actually runs
+ # the exec'd child, not the original program...
+ send_gdb "kill\n"
+ gdb_expect {
+ -re ".*Kill the program being debugged.*y or n. $" {
+ send_gdb "y\n"
+ send_gdb "file $binfile\n"
+ gdb_expect {
+ -re ".*Load new symbol table from.*y or n. $" {
+ send_gdb "y\n"
+ gdb_expect {
+ -re "Reading symbols from.*$gdb_prompt $" {}
+ timeout { fail "loading symbols (timeout)"; return }
+ }
+ }
+ -re ".*gdb_prompt $" {}
+ timeout { fail "loading symbols (timeout)"; return }
+ }
+ }
+ -re ".*$gdb_prompt $" {}
+ timeout { fail "killing inferior (timeout)" ; return }
}
}
proc tcatch_vfork_then_parent_follow {} {
- global gdb_prompt
- global srcfile
+ global gdb_prompt
+ global srcfile
- send_gdb "set follow-fork parent\n"
- gdb_expect {
- -re "$gdb_prompt $" {pass "set follow-fork parent, tcatch vfork"}
- timeout {fail "set follow-fork parent, tcatch vfork"}
- }
- send_gdb "tcatch vfork\n"
- gdb_expect {
- -re "Catchpoint .*(vfork).*$gdb_prompt $"\
- {pass "vfork parent follow, set tcatch vfork"}
- -re "$gdb_prompt $" {fail "vfork parent follow, set tcatch vfork"}
- timeout {fail "(timeout) vfork parent follow, set tcatch vfork"}
- }
- send_gdb "continue\n"
-# HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs
-# stop you in "_vfork".
- gdb_expect {
- -re "0x\[0-9a-fA-F\]*.*(vfork|__kernel_v?syscall).*$gdb_prompt "\
- {pass "vfork parent follow, tcatch vfork"}
- -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"}
- }
- send_gdb "finish\n"
- gdb_expect {
- -re "Run till exit from.*vfork.*0x\[0-9a-fA-F\]* in main .* at .*${srcfile}:12.*$gdb_prompt "\
- {pass "vfork parent follow, finish after tcatch vfork"}
- -re "Run till exit from.*__kernel_v?syscall.*0x\[0-9a-fA-F\]* in vfork .*$gdb_prompt " {
- send_gdb "finish\n"
- exp_continue
- }
- -re "$gdb_prompt $" {fail "vfork parent follow, finish after tcatch vfork"}
- timeout {fail "(timeout) vfork parent follow, finish after tcatch vfork" }
- }
- # 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 "set follow-fork parent\n"
+ gdb_expect {
+ -re "$gdb_prompt $" {pass "set follow-fork parent, tcatch vfork"}
+ timeout {fail "set follow-fork parent, tcatch vfork"}
+ }
+ send_gdb "tcatch vfork\n"
+ gdb_expect {
+ -re "Catchpoint .*(vfork).*$gdb_prompt $" {
+ pass "vfork parent follow, set tcatch vfork"
+ }
+ -re "$gdb_prompt $" {fail "vfork parent follow, set tcatch vfork"}
+ timeout {fail "(timeout) vfork parent follow, set tcatch vfork"}
+ }
+ send_gdb "continue\n"
+ # HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs
+ # stop you in "_vfork".
+ gdb_expect {
+ -re "0x\[0-9a-fA-F\]*.*(vfork|__kernel_v?syscall).*$gdb_prompt " {
+ pass "vfork parent follow, tcatch vfork"
+ }
+ -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"}
+ }
+ send_gdb "finish\n"
+ gdb_expect {
+ -re "Run till exit from.*vfork.*0x\[0-9a-fA-F\]* in main .* at .*${srcfile}:12.*$gdb_prompt " {
+ pass "vfork parent follow, finish after tcatch vfork"
+ }
+ -re "Run till exit from.*__kernel_v?syscall.*0x\[0-9a-fA-F\]* in vfork .*$gdb_prompt " {
+ send_gdb "finish\n"
+ exp_continue
+ }
+ -re "$gdb_prompt $" {fail "vfork parent follow, finish after tcatch vfork"}
+ timeout {fail "(timeout) vfork parent follow, finish after tcatch vfork"}
+ }
+ # 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 tcatch_vfork_then_child_follow {} {
- global gdb_prompt
- global srcfile
- global srcfile2
-
- send_gdb "set follow-fork child\n"
- gdb_expect {
- -re "$gdb_prompt $" {pass "set follow-fork child, tcatch vfork"}
- timeout {fail "set follow-fork child, tcatch vfork"}
- }
- send_gdb "tcatch vfork\n"
- gdb_expect {
- -re "Catchpoint .*(vfork).*$gdb_prompt $"\
- {pass "vfork child follow, set tcatch vfork"}
- -re "$gdb_prompt $" {fail "vfork child follow, set tcatch vfork"}
- timeout {fail "(timeout) vfork child follow, set tcatch vfork"}
- }
- send_gdb "continue\n"
-# 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|__kernel_v?syscall).*$gdb_prompt "\
- {pass "vfork child follow, tcatch vfork"}
- -re "$gdb_prompt $" {fail "vfork child follow, tcatch vfork"}
- timeout {fail "(timeout) vfork child follow, tcatch vfork"}
- }
- send_gdb "finish\n"
- gdb_expect {
- -re "Run till exit from.*vfork.*${srcfile}:12.*$gdb_prompt "\
- {pass "vfork child follow, finish after tcatch vfork"}
- -re "Run till exit from.*__kernel_v?syscall.*0x\[0-9a-fA-F\]* in vfork .*$gdb_prompt " {
- send_gdb "finish\n"
- exp_continue
- }
- -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" }
- }
- # 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
+ global gdb_prompt
+ global srcfile
+ global srcfile2
+
+ send_gdb "set follow-fork child\n"
+ gdb_expect {
+ -re "$gdb_prompt $" {pass "set follow-fork child, tcatch vfork"}
+ timeout {fail "set follow-fork child, tcatch vfork"}
+ }
+ send_gdb "tcatch vfork\n"
+ gdb_expect {
+ -re "Catchpoint .*(vfork).*$gdb_prompt $" {
+ pass "vfork child follow, set tcatch vfork"
+ }
+ -re "$gdb_prompt $" {fail "vfork child follow, set tcatch vfork"}
+ timeout {fail "(timeout) vfork child follow, set tcatch vfork"}
+ }
+ send_gdb "continue\n"
+ # 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|__kernel_v?syscall).*$gdb_prompt " {
+ pass "vfork child follow, tcatch vfork"
+ }
+ -re "$gdb_prompt $" {fail "vfork child follow, tcatch vfork"}
+ timeout {fail "(timeout) vfork child follow, tcatch vfork"}
+ }
+ send_gdb "finish\n"
+ gdb_expect {
+ -re "Run till exit from.*vfork.*${srcfile}:12.*$gdb_prompt " {
+ pass "vfork child follow, finish after tcatch vfork"
+ }
+ -re "Run till exit from.*__kernel_v?syscall.*0x\[0-9a-fA-F\]* in vfork .*$gdb_prompt " {
+ send_gdb "finish\n"
+ exp_continue
+ }
+ -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"}
+ }
+ # 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
}
proc do_vfork_and_exec_tests {} {
- global gdb_prompt
+ 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 }
-
- # Try following the parent process by setting a breakpoint on the
- # other side of a vfork, and running to that point. Do this
- # without catchpoints.
- if [runto_main] then { vfork_parent_follow_to_bp }
-
- # Try following the child process by just continuing through the
- # vfork, and letting the parent's breakpoint on "main" be auto-
- # magically reset in the child.
- #
- if [runto_main] then { vfork_and_exec_child_follow_to_main_bp }
-
- # Try following the child process by stepping through a call to
- # vfork. The child also executes an exec. Since the child cannot
- # be debugged until after it has exec'd, and since there's a bp on
- # "main" in the parent, and since the bp's for the parent are
- # recomputed in the exec'd child, the step through a vfork should
- # land us in the "main" for the exec'd child, too.
- #
- if [runto_main] then { vfork_and_exec_child_follow_through_step }
-
- # Try catching a vfork, and stepping out to the parent.
- #
- if [runto_main] then { tcatch_vfork_then_parent_follow }
-
- # Try catching a vfork, and stepping out to the child.
- #
- if [runto_main] then { tcatch_vfork_then_child_follow }
-
- # Test the ability to follow both child and parent of a vfork. Do
- # this without catchpoints.
- # ??rehrauer: NYI. Will add testpoints here when implemented.
- #
-
- # Test the ability to have the debugger ask the user at vfork-time
- # whether to follow the parent, child or both. Do this without
- # catchpoints.
- # ??rehrauer: NYI. Will add testpoints here when implemented.
- #
+ # 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 }
+
+ # Try following the parent process by setting a breakpoint on the
+ # other side of a vfork, and running to that point. Do this
+ # without catchpoints.
+ if [runto_main] then { vfork_parent_follow_to_bp }
+
+ # Try following the child process by just continuing through the
+ # vfork, and letting the parent's breakpoint on "main" be auto-
+ # magically reset in the child.
+ #
+ if [runto_main] then { vfork_and_exec_child_follow_to_main_bp }
+
+ # Try following the child process by stepping through a call to
+ # vfork. The child also executes an exec. Since the child cannot
+ # be debugged until after it has exec'd, and since there's a bp on
+ # "main" in the parent, and since the bp's for the parent are
+ # recomputed in the exec'd child, the step through a vfork should
+ # land us in the "main" for the exec'd child, too.
+ #
+ if [runto_main] then { vfork_and_exec_child_follow_through_step }
+
+ # Try catching a vfork, and stepping out to the parent.
+ #
+ if [runto_main] then { tcatch_vfork_then_parent_follow }
+
+ # Try catching a vfork, and stepping out to the child.
+ #
+ if [runto_main] then { tcatch_vfork_then_child_follow }
+
+ # Test the ability to follow both child and parent of a vfork. Do
+ # this without catchpoints.
+ # ??rehrauer: NYI. Will add testpoints here when implemented.
+ #
+
+ # Test the ability to have the debugger ask the user at vfork-time
+ # whether to follow the parent, child or both. Do this without
+ # catchpoints.
+ # ??rehrauer: NYI. Will add testpoints here when implemented.
+ #
}
# Start with a fresh gdb