# Copyright (C) 1997 Free Software Foundation, Inc.
|
# Copyright (C) 1997 Free Software Foundation, Inc.
|
|
|
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 2 of the License, or
|
# (at your option) any later version.
|
# (at your option) any later version.
|
#
|
#
|
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
#
|
#
|
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
# Please email any bugs, comments, and/or additions to this file to:
|
# bug-gdb@prep.ai.mit.edu
|
# bug-gdb@prep.ai.mit.edu
|
|
|
if $tracelevel then {
|
if $tracelevel then {
|
strace $tracelevel
|
strace $tracelevel
|
}
|
}
|
|
|
if { ![isnative] } then {
|
if { ![isnative] } then {
|
continue
|
continue
|
}
|
}
|
|
|
set prms_id 0
|
set prms_id 0
|
set bug_id 0
|
set bug_id 0
|
|
|
if [istarget "hppa2.0w-hp-hpux*"] {
|
if [istarget "hppa2.0w-hp-hpux*"] {
|
warning "Don't run gdb.base/foll-vfork.exp until JAGaa43495 kernel problem is fixed."
|
warning "Don't run gdb.base/foll-vfork.exp until JAGaa43495 kernel problem is fixed."
|
return 0
|
return 0
|
}
|
}
|
|
|
set testfile "foll-vfork"
|
set testfile "foll-vfork"
|
set testfile2 "vforked-prog"
|
set testfile2 "vforked-prog"
|
set srcfile ${testfile}.c
|
set srcfile ${testfile}.c
|
set srcfile2 ${testfile2}.c
|
set srcfile2 ${testfile2}.c
|
set binfile ${objdir}/${subdir}/${testfile}
|
set binfile ${objdir}/${subdir}/${testfile}
|
set binfile2 ${objdir}/${subdir}/${testfile2}
|
set binfile2 ${objdir}/${subdir}/${testfile2}
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
}
|
}
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug}] != "" } {
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug}] != "" } {
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
}
|
}
|
|
|
|
|
# Until "set follow-fork-mode" and "catch vfork" are implemented on
|
# Until "set follow-fork-mode" and "catch vfork" are implemented on
|
# other targets...
|
# other targets...
|
#
|
#
|
if ![istarget "hppa*-hp-hpux*"] then {
|
if ![istarget "hppa*-hp-hpux*"] then {
|
continue
|
continue
|
}
|
}
|
|
|
# Test to see if we are on an HP-UX 10.20 and if so,
|
# Test to see if we are on an HP-UX 10.20 and if so,
|
# do not run these tests as catching vfork is disabled for
|
# do not run these tests as catching vfork is disabled for
|
# 10.20.
|
# 10.20.
|
|
|
if [istarget "hppa*-hp-hpux10.20"] then {
|
if [istarget "hppa*-hp-hpux10.20"] then {
|
return 0
|
return 0
|
}
|
}
|
|
|
# A few of these tests require a little more time than the standard
|
# A few of these tests require a little more time than the standard
|
# timeout allows.
|
# timeout allows.
|
set oldtimeout $timeout
|
set oldtimeout $timeout
|
set timeout [expr "$timeout + 10"]
|
set timeout [expr "$timeout + 10"]
|
|
|
proc vfork_parent_follow_through_step {} {
|
proc vfork_parent_follow_through_step {} {
|
global gdb_prompt
|
global gdb_prompt
|
|
|
send_gdb "set follow parent\n"
|
send_gdb "set follow parent\n"
|
gdb_expect {
|
gdb_expect {
|
-re "$gdb_prompt $" {pass "set follow parent, vfork through step"}
|
-re "$gdb_prompt $" {pass "set follow parent, vfork through step"}
|
timeout {fail "set follow parent, vfork through step"}
|
timeout {fail "set follow parent, vfork through step"}
|
}
|
}
|
send_gdb "next\n"
|
send_gdb "next\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Detaching after fork from.*13.*$gdb_prompt "\
|
-re "Detaching after fork from.*13.*$gdb_prompt "\
|
{pass "vfork parent follow, through step"}
|
{pass "vfork parent follow, through step"}
|
-re "$gdb_prompt $" {fail "vfork parent follow, through step"}
|
-re "$gdb_prompt $" {fail "vfork parent follow, through step"}
|
timeout {fail "(timeout) 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
|
# The child has been detached; allow time for any output it might
|
# generate to arrive, so that output doesn't get confused with
|
# generate to arrive, so that output doesn't get confused with
|
# any gdb_expected debugger output from a subsequent testpoint.
|
# any gdb_expected debugger output from a subsequent testpoint.
|
#
|
#
|
exec sleep 1
|
exec sleep 1
|
}
|
}
|
|
|
proc vfork_parent_follow_to_bp {} {
|
proc vfork_parent_follow_to_bp {} {
|
global gdb_prompt
|
global gdb_prompt
|
|
|
send_gdb "set follow parent\n"
|
send_gdb "set follow parent\n"
|
gdb_expect {
|
gdb_expect {
|
-re "$gdb_prompt $" {pass "set follow parent, vfork to bp"}
|
-re "$gdb_prompt $" {pass "set follow parent, vfork to bp"}
|
timeout {fail "set follow parent, vfork to bp"}
|
timeout {fail "set follow parent, vfork to bp"}
|
}
|
}
|
send_gdb "break 18\n"
|
send_gdb "break 18\n"
|
gdb_expect {
|
gdb_expect {
|
-re "$gdb_prompt $" {pass "break, vfork to bp"}
|
-re "$gdb_prompt $" {pass "break, vfork to bp"}
|
timeout {fail "break, vfork to bp"}
|
timeout {fail "break, vfork to bp"}
|
}
|
}
|
send_gdb "continue\n"
|
send_gdb "continue\n"
|
gdb_expect {
|
gdb_expect {
|
-re ".*Detaching after fork from process.*Breakpoint.*18.*$gdb_prompt "\
|
-re ".*Detaching after fork from process.*Breakpoint.*18.*$gdb_prompt "\
|
{pass "vfork parent follow, to bp"}
|
{pass "vfork parent follow, to bp"}
|
-re "$gdb_prompt $" {fail "vfork parent follow, to bp"}
|
-re "$gdb_prompt $" {fail "vfork parent follow, to bp"}
|
timeout {fail "(timeout) 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
|
# The child has been detached; allow time for any output it might
|
# generate to arrive, so that output doesn't get confused with
|
# generate to arrive, so that output doesn't get confused with
|
# any expected debugger output from a subsequent testpoint.
|
# any expected debugger output from a subsequent testpoint.
|
#
|
#
|
exec sleep 1
|
exec sleep 1
|
}
|
}
|
|
|
proc vfork_and_exec_child_follow_to_main_bp {} {
|
proc vfork_and_exec_child_follow_to_main_bp {} {
|
global gdb_prompt
|
global gdb_prompt
|
global binfile
|
global binfile
|
|
|
send_gdb "set follow child\n"
|
send_gdb "set follow child\n"
|
gdb_expect {
|
gdb_expect {
|
-re "$gdb_prompt $" {pass "set follow child, vfork and exec to main bp"}
|
-re "$gdb_prompt $" {pass "set follow child, vfork and exec to main bp"}
|
timeout {fail "set follow child, vfork and exec to main bp"}
|
timeout {fail "set follow child, vfork and exec to main bp"}
|
}
|
}
|
send_gdb "continue\n"
|
send_gdb "continue\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
|
-re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
|
{pass "vfork and exec child follow, to main bp"}
|
{pass "vfork and exec child follow, to main bp"}
|
-re "$gdb_prompt $" {fail "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" }
|
timeout {fail "(timeout) vfork and exec child follow, to main bp" }
|
}
|
}
|
# The parent has been detached; allow time for any output it might
|
# The parent has been detached; allow time for any output it might
|
# generate to arrive, so that output doesn't get confused with
|
# generate to arrive, so that output doesn't get confused with
|
# any gdb_expected debugger output from a subsequent testpoint.
|
# any gdb_expected debugger output from a subsequent testpoint.
|
#
|
#
|
exec sleep 1
|
exec sleep 1
|
|
|
# Explicitly kill this child, or a subsequent rerun actually runs
|
# Explicitly kill this child, or a subsequent rerun actually runs
|
# the exec'd child, not the original program...
|
# the exec'd child, not the original program...
|
send_gdb "kill\n"
|
send_gdb "kill\n"
|
gdb_expect {
|
gdb_expect {
|
-re ".*Kill the program being debugged.*y or n. $" {
|
-re ".*Kill the program being debugged.*y or n. $" {
|
send_gdb "y\n"
|
send_gdb "y\n"
|
send_gdb "file $binfile\n"
|
send_gdb "file $binfile\n"
|
gdb_expect {
|
gdb_expect {
|
-re ".*Load new symbol table from.*y or n. $" {
|
-re ".*Load new symbol table from.*y or n. $" {
|
send_gdb "y\n"
|
send_gdb "y\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Reading symbols from.*$gdb_prompt $" {}
|
-re "Reading symbols from.*$gdb_prompt $" {}
|
timeout { fail "loading symbols (timeout)"; return }
|
timeout { fail "loading symbols (timeout)"; return }
|
}
|
}
|
}
|
}
|
-re ".*gdb_prompt $" {}
|
-re ".*gdb_prompt $" {}
|
timeout { fail "loading symbols (timeout)"; return }
|
timeout { fail "loading symbols (timeout)"; return }
|
}
|
}
|
}
|
}
|
-re ".*$gdb_prompt $" {}
|
-re ".*$gdb_prompt $" {}
|
timeout { fail "killing inferior (timeout)" ; return }
|
timeout { fail "killing inferior (timeout)" ; return }
|
}
|
}
|
}
|
}
|
|
|
proc vfork_and_exec_child_follow_through_step {} {
|
proc vfork_and_exec_child_follow_through_step {} {
|
global gdb_prompt
|
global gdb_prompt
|
global binfile
|
global binfile
|
|
|
# This test cannot be performed prior to HP-UX 10.30, because ptrace-based
|
# 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
|
# 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
|
# things like hit a breakpoint between a vfork and exec. This means that
|
# saying "set follow child; next" at a vfork() call won't work, because
|
# saying "set follow child; next" at a vfork() call won't work, because
|
# the implementation of "next" sets a "step resume" breakpoint at the
|
# 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.
|
# return from the vfork(), which the child will hit on its way to exec'ing.
|
#
|
#
|
if { ![istarget "hppa*-*-hpux11.*"] } {
|
if { ![istarget "hppa*-*-hpux11.*"] } {
|
verbose "vfork child-following next test ignored for non-hppa or pre-HP/UX-10.30 targets."
|
verbose "vfork child-following next test ignored for non-hppa or pre-HP/UX-10.30 targets."
|
return 0
|
return 0
|
}
|
}
|
|
|
send_gdb "set follow child\n"
|
send_gdb "set follow child\n"
|
gdb_expect {
|
gdb_expect {
|
-re "$gdb_prompt $" {pass "set follow child, vfork and exec through step"}
|
-re "$gdb_prompt $" {pass "set follow child, vfork and exec through step"}
|
timeout {fail "set follow child, vfork and exec through step"}
|
timeout {fail "set follow child, vfork and exec through step"}
|
}
|
}
|
send_gdb "next\n"
|
send_gdb "next\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
|
-re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
|
{pass "vfork and exec child follow, through step"}
|
{pass "vfork and exec child follow, through step"}
|
-re "$gdb_prompt $" {fail "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" }
|
timeout {fail "(timeout) vfork and exec child follow, through step" }
|
}
|
}
|
# The parent has been detached; allow time for any output it might
|
# The parent has been detached; allow time for any output it might
|
# generate to arrive, so that output doesn't get confused with
|
# generate to arrive, so that output doesn't get confused with
|
# any expected debugger output from a subsequent testpoint.
|
# any expected debugger output from a subsequent testpoint.
|
#
|
#
|
exec sleep 1
|
exec sleep 1
|
|
|
# Explicitly kill this child, or a subsequent rerun actually runs
|
# Explicitly kill this child, or a subsequent rerun actually runs
|
# the exec'd child, not the original program...
|
# the exec'd child, not the original program...
|
send_gdb "kill\n"
|
send_gdb "kill\n"
|
gdb_expect {
|
gdb_expect {
|
-re ".*Kill the program being debugged.*y or n. $" {
|
-re ".*Kill the program being debugged.*y or n. $" {
|
send_gdb "y\n"
|
send_gdb "y\n"
|
send_gdb "file $binfile\n"
|
send_gdb "file $binfile\n"
|
gdb_expect {
|
gdb_expect {
|
-re ".*Load new symbol table from.*y or n. $" {
|
-re ".*Load new symbol table from.*y or n. $" {
|
send_gdb "y\n"
|
send_gdb "y\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Reading symbols from.*$gdb_prompt $" {}
|
-re "Reading symbols from.*$gdb_prompt $" {}
|
timeout { fail "loading symbols (timeout)"; return }
|
timeout { fail "loading symbols (timeout)"; return }
|
}
|
}
|
}
|
}
|
-re ".*gdb_prompt $" {}
|
-re ".*gdb_prompt $" {}
|
timeout { fail "loading symbols (timeout)"; return }
|
timeout { fail "loading symbols (timeout)"; return }
|
}
|
}
|
}
|
}
|
-re ".*$gdb_prompt $" {}
|
-re ".*$gdb_prompt $" {}
|
timeout { fail "killing inferior (timeout)" ; return }
|
timeout { fail "killing inferior (timeout)" ; return }
|
}
|
}
|
}
|
}
|
|
|
proc tcatch_vfork_then_parent_follow {} {
|
proc tcatch_vfork_then_parent_follow {} {
|
global gdb_prompt
|
global gdb_prompt
|
global srcfile
|
global srcfile
|
|
|
send_gdb "set follow parent\n"
|
send_gdb "set follow parent\n"
|
gdb_expect {
|
gdb_expect {
|
-re "$gdb_prompt $" {pass "set follow parent, tcatch vfork"}
|
-re "$gdb_prompt $" {pass "set follow parent, tcatch vfork"}
|
timeout {fail "set follow parent, tcatch vfork"}
|
timeout {fail "set follow parent, tcatch vfork"}
|
}
|
}
|
send_gdb "tcatch vfork\n"
|
send_gdb "tcatch vfork\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Catchpoint .*(vfork).*$gdb_prompt $"\
|
-re "Catchpoint .*(vfork).*$gdb_prompt $"\
|
{pass "vfork parent follow, set tcatch vfork"}
|
{pass "vfork parent follow, set tcatch vfork"}
|
-re "$gdb_prompt $" {fail "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"}
|
timeout {fail "(timeout) vfork parent follow, set tcatch vfork"}
|
}
|
}
|
send_gdb "continue\n"
|
send_gdb "continue\n"
|
# HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs
|
# HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs
|
# stop you in "_vfork".
|
# stop you in "_vfork".
|
gdb_expect {
|
gdb_expect {
|
-re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt "\
|
-re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt "\
|
{pass "vfork parent follow, tcatch vfork"}
|
{pass "vfork parent follow, tcatch vfork"}
|
-re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt "\
|
-re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt "\
|
{pass "vfork parent follow, tcatch vfork"}
|
{pass "vfork parent follow, tcatch vfork"}
|
-re "$gdb_prompt $" {fail "vfork parent follow, tcatch vfork"}
|
-re "$gdb_prompt $" {fail "vfork parent follow, tcatch vfork"}
|
timeout {fail "(timeout) vfork parent follow, tcatch vfork"}
|
timeout {fail "(timeout) vfork parent follow, tcatch vfork"}
|
}
|
}
|
send_gdb "finish\n"
|
send_gdb "finish\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Run till exit from.*vfork.*0x\[0-9a-fA-F\]* in main .* at .*${srcfile}:12.*$gdb_prompt "\
|
-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"}
|
{pass "vfork parent follow, finish after tcatch vfork"}
|
-re "$gdb_prompt $" {fail "vfork parent follow, finish after tcatch vfork"}
|
-re "$gdb_prompt $" {fail "vfork parent follow, finish after tcatch vfork"}
|
timeout {fail "(timeout) 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
|
# The child has been detached; allow time for any output it might
|
# generate to arrive, so that output doesn't get confused with
|
# generate to arrive, so that output doesn't get confused with
|
# any expected debugger output from a subsequent testpoint.
|
# any expected debugger output from a subsequent testpoint.
|
#
|
#
|
exec sleep 1
|
exec sleep 1
|
}
|
}
|
|
|
proc tcatch_vfork_then_child_follow {} {
|
proc tcatch_vfork_then_child_follow {} {
|
global gdb_prompt
|
global gdb_prompt
|
global srcfile2
|
global srcfile2
|
|
|
send_gdb "set follow child\n"
|
send_gdb "set follow child\n"
|
gdb_expect {
|
gdb_expect {
|
-re "$gdb_prompt $" {pass "set follow child, tcatch vfork"}
|
-re "$gdb_prompt $" {pass "set follow child, tcatch vfork"}
|
timeout {fail "set follow child, tcatch vfork"}
|
timeout {fail "set follow child, tcatch vfork"}
|
}
|
}
|
send_gdb "tcatch vfork\n"
|
send_gdb "tcatch vfork\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Catchpoint .*(vfork).*$gdb_prompt $"\
|
-re "Catchpoint .*(vfork).*$gdb_prompt $"\
|
{pass "vfork child follow, set tcatch vfork"}
|
{pass "vfork child follow, set tcatch vfork"}
|
-re "$gdb_prompt $" {fail "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"}
|
timeout {fail "(timeout) vfork child follow, set tcatch vfork"}
|
}
|
}
|
send_gdb "continue\n"
|
send_gdb "continue\n"
|
# HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs
|
# HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs
|
# stop you in "_vfork".
|
# stop you in "_vfork".
|
gdb_expect {
|
gdb_expect {
|
-re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt "\
|
-re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt "\
|
{pass "vfork child follow, tcatch vfork"}
|
{pass "vfork child follow, tcatch vfork"}
|
-re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt "\
|
-re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt "\
|
{pass "vfork child follow, tcatch vfork"}
|
{pass "vfork child follow, tcatch vfork"}
|
-re "$gdb_prompt $" {fail "vfork child follow, tcatch vfork"}
|
-re "$gdb_prompt $" {fail "vfork child follow, tcatch vfork"}
|
timeout {fail "(timeout) vfork child follow, tcatch vfork"}
|
timeout {fail "(timeout) vfork child follow, tcatch vfork"}
|
}
|
}
|
send_gdb "finish\n"
|
send_gdb "finish\n"
|
gdb_expect {
|
gdb_expect {
|
-re "Run till exit from.*vfork.*${srcfile2}:9.*$gdb_prompt "\
|
-re "Run till exit from.*vfork.*${srcfile2}:9.*$gdb_prompt "\
|
{pass "vfork child follow, finish after tcatch vfork"}
|
{pass "vfork child follow, finish after tcatch vfork"}
|
-re "$gdb_prompt $" {fail "vfork child follow, finish after tcatch vfork"}
|
-re "$gdb_prompt $" {fail "vfork child follow, finish after tcatch vfork"}
|
timeout {fail "(timeout) 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
|
# The parent has been detached; allow time for any output it might
|
# generate to arrive, so that output doesn't get confused with
|
# generate to arrive, so that output doesn't get confused with
|
# any expected debugger output from a subsequent testpoint.
|
# any expected debugger output from a subsequent testpoint.
|
#
|
#
|
exec sleep 1
|
exec sleep 1
|
}
|
}
|
|
|
proc do_vfork_and_exec_tests {} {
|
proc do_vfork_and_exec_tests {} {
|
global gdb_prompt
|
global gdb_prompt
|
|
|
# Try following the parent process by stepping through a call to
|
# Try following the parent process by stepping through a call to
|
# vfork. Do this without catchpoints.
|
# vfork. Do this without catchpoints.
|
if [runto_main] then { vfork_parent_follow_through_step }
|
if [runto_main] then { vfork_parent_follow_through_step }
|
|
|
# Try following the parent process by setting a breakpoint on the
|
# Try following the parent process by setting a breakpoint on the
|
# other side of a vfork, and running to that point. Do this
|
# other side of a vfork, and running to that point. Do this
|
# without catchpoints.
|
# without catchpoints.
|
if [runto_main] then { vfork_parent_follow_to_bp }
|
if [runto_main] then { vfork_parent_follow_to_bp }
|
|
|
# Try following the child process by just continuing through the
|
# Try following the child process by just continuing through the
|
# vfork, and letting the parent's breakpoint on "main" be auto-
|
# vfork, and letting the parent's breakpoint on "main" be auto-
|
# magically reset in the child.
|
# magically reset in the child.
|
#
|
#
|
if [runto_main] then { vfork_and_exec_child_follow_to_main_bp }
|
if [runto_main] then { vfork_and_exec_child_follow_to_main_bp }
|
|
|
# Try following the child process by stepping through a call to
|
# Try following the child process by stepping through a call to
|
# vfork. The child also executes an exec. Since the child cannot
|
# 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
|
# 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
|
# "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
|
# recomputed in the exec'd child, the step through a vfork should
|
# land us in the "main" for the exec'd child, too.
|
# land us in the "main" for the exec'd child, too.
|
#
|
#
|
if [runto_main] then { vfork_and_exec_child_follow_through_step }
|
if [runto_main] then { vfork_and_exec_child_follow_through_step }
|
|
|
# Try catching a vfork, and stepping out to the parent.
|
# Try catching a vfork, and stepping out to the parent.
|
#
|
#
|
if [runto_main] then { tcatch_vfork_then_parent_follow }
|
if [runto_main] then { tcatch_vfork_then_parent_follow }
|
|
|
# Try catching a vfork, and stepping out to the child.
|
# Try catching a vfork, and stepping out to the child.
|
#
|
#
|
if [runto_main] then { tcatch_vfork_then_child_follow }
|
if [runto_main] then { tcatch_vfork_then_child_follow }
|
|
|
# Test the ability to follow both child and parent of a vfork. Do
|
# Test the ability to follow both child and parent of a vfork. Do
|
# this without catchpoints.
|
# this without catchpoints.
|
# ??rehrauer: NYI. Will add testpoints here when implemented.
|
# ??rehrauer: NYI. Will add testpoints here when implemented.
|
#
|
#
|
|
|
# Test the ability to have the debugger ask the user at vfork-time
|
# Test the ability to have the debugger ask the user at vfork-time
|
# whether to follow the parent, child or both. Do this without
|
# whether to follow the parent, child or both. Do this without
|
# catchpoints.
|
# catchpoints.
|
# ??rehrauer: NYI. Will add testpoints here when implemented.
|
# ??rehrauer: NYI. Will add testpoints here when implemented.
|
#
|
#
|
}
|
}
|
|
|
# Start with a fresh gdb
|
# Start with a fresh gdb
|
|
|
gdb_exit
|
gdb_exit
|
gdb_start
|
gdb_start
|
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_load ${binfile}
|
gdb_load ${binfile}
|
|
|
|
|
# This is a test of gdb's ability to follow the parent or child
|
# This is a test of gdb's ability to follow the parent or child
|
# of a Unix vfork() system call. (The child will subsequently
|
# of a Unix vfork() system call. (The child will subsequently
|
# call a variant of a Unix exec() system call.)
|
# call a variant of a Unix exec() system call.)
|
#
|
#
|
do_vfork_and_exec_tests
|
do_vfork_and_exec_tests
|
|
|
set timeout $oldtimeout
|
set timeout $oldtimeout
|
return 0
|
return 0
|
|
|