From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/8] foll-vfork.exp: Expose more testing on non-HP/UX targets
Date: Thu, 25 Oct 2012 17:42:00 -0000 [thread overview]
Message-ID: <20121025174212.13324.41225.stgit@brno.lan> (raw)
In-Reply-To: <20121025174002.13324.8164.stgit@brno.lan>
Well, exposes more to Linux, since we have at the top:
if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
continue
}
The vfork_and_exec_child_follow_through_step procedure is about
following the child over a "next". This is currently disabled on non
HP/UX targets, but it's a useful test to run. AFAICS from the test,
HP/UX can't debug the vfork child until it execs or exits. The Linux
kernel can, so the test is adjusted to expect the ideal behavior out
of non HP/UX targets (and we get that right on Linux).
gdb/testsuite/
2012-10-25 Pedro Alves <palves@redhat.com>
* gdb.base/foll-vfork.exp
(vfork_and_exec_child_follow_through_step): Don't skip on
non-HP/UX targets. Expect the next to only step one line on
non-HP/UX targets, rather than stopping only after the exec.
---
gdb/testsuite/gdb.base/foll-vfork.exp | 47 +++++++++++++++++++++++----------
1 file changed, 33 insertions(+), 14 deletions(-)
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp
index 67d077d..54f5971 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
@@ -183,15 +183,17 @@ proc vfork_and_exec_child_follow_through_step {} {
global gdb_prompt
global srcfile2
-# 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
-# things like hit a breakpoint between a vfork and exec. This means that
-# saying "set follow-fork child; next" at a vfork() call won't work, because
-# 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."
+ if { [istarget "hppa*-*-hpux*"] && ![istarget "hppa*-*-hpux11.*"] } {
+ # 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 things like hit a breakpoint between a
+ # vfork and exec. This means that saying "set follow-fork
+ # child; next" at a vfork() call won't work, because 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.
+ #
+ verbose "vfork child-following next test ignored for pre-HP/UX-10.30 targets."
return 0
}
@@ -200,11 +202,28 @@ proc vfork_and_exec_child_follow_through_step {} {
"set follow-fork child, vfork and exec through step"
set test "vfork and exec child follow, through step"
- set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}]
- gdb_test_multiple "next" $test {
- -re "Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " {
- pass "$test"
- }
+ if { [istarget "hppa*-*-hpux*"]} {
+ # 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.
+ #
+ set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}]
+ gdb_test_multiple "next" $test {
+ -re "Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " {
+ pass "$test"
+ }
+ }
+ } else {
+ # The ideal support is to be able to debug the child even
+ # before it execs. Thus, "next" lands on the next line after
+ # the vfork.
+ gdb_test_multiple "next" $test {
+ -re "Attaching after .* vfork to child.*if \\(pid == 0\\).*$gdb_prompt " {
+ pass "$test"
+ }
+ }
}
# The parent has been detached; allow time for any output it might
# generate to arrive, so that output doesn't get confused with
next prev parent reply other threads:[~2012-10-25 17:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-25 17:42 [PATCH 0/8] Fix PR gdb/14766; cleanup foll-vfork.exp and extend it Pedro Alves
2012-10-25 17:42 ` Pedro Alves [this message]
2012-10-25 17:42 ` [PATCH 4/8] foll-vfork.c/vforked-prog.c: Add copyright headers Pedro Alves
2012-10-25 17:42 ` [PATCH 1/8] foll-vfork.exp: Modernize Pedro Alves
2012-10-25 17:42 ` [PATCH 6/8] foll-vfork.exp: Clean restart gdb before each test procedure Pedro Alves
2012-11-02 18:18 ` Pedro Alves
2012-10-25 17:42 ` [PATCH 2/8] foll-vfork.exp: Don't hard code line numbers Pedro Alves
2012-10-25 17:42 ` [PATCH 7/8] foll-vfork.exp: Also test following vfork when the child exits Pedro Alves
2012-10-25 17:42 ` [PATCH 8/8] Fix PR gdb/14766 - vfork child exit with "set follow-fork-mode child" broken Pedro Alves
2012-10-25 17:49 ` Pedro Alves
2012-10-25 17:42 ` [PATCH 5/8] foll-vfork.exp: Use with_test_prefix Pedro Alves
2012-10-30 20:50 ` [PATCH 0/8] Fix PR gdb/14766; cleanup foll-vfork.exp and extend it Tom Tromey
2012-11-02 18:15 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121025174212.13324.41225.stgit@brno.lan \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox