mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-10 14:59:31 +08:00
2012-11-02 Pedro Alves <palves@redhat.com>
Modernize. * gdb.base/foll-vfork.exp: Use standard_testfile and build_executable. Pass descriptive string to untested. (vfork_parent_follow_through_step, vfork_parent_follow_to_bp) (vfork_and_exec_child_follow_to_main_bp) (vfork_and_exec_child_follow_through_step) (tcatch_vfork_then_parent_follow, tcatch_vfork_then_child_follow) (do_vfork_and_exec_tests): Use gdb_test/gdb_test_multiple instead of send_gdb/gdb_expect. (kill_child): New procedure. (vfork_and_exec_child_follow_to_main_bp) (vfork_and_exec_child_follow_through_step): Use it.
This commit is contained in:
@ -1,3 +1,20 @@
|
|||||||
|
2012-11-02 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
Modernize.
|
||||||
|
|
||||||
|
* gdb.base/foll-vfork.exp: Use standard_testfile and
|
||||||
|
build_executable. Pass descriptive string to untested.
|
||||||
|
(vfork_parent_follow_through_step, vfork_parent_follow_to_bp)
|
||||||
|
(vfork_and_exec_child_follow_to_main_bp)
|
||||||
|
(vfork_and_exec_child_follow_through_step)
|
||||||
|
(tcatch_vfork_then_parent_follow, tcatch_vfork_then_child_follow)
|
||||||
|
(do_vfork_and_exec_tests): Use gdb_test/gdb_test_multiple instead
|
||||||
|
of send_gdb/gdb_expect.
|
||||||
|
|
||||||
|
(kill_child): New procedure.
|
||||||
|
(vfork_and_exec_child_follow_to_main_bp)
|
||||||
|
(vfork_and_exec_child_follow_through_step): Use it.
|
||||||
|
|
||||||
2012-11-02 Yao Qi <yao@codesourcery.com>
|
2012-11-02 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
* std-operator.def: Remove OP_LABELED.
|
* std-operator.def: Remove OP_LABELED.
|
||||||
|
@ -40,22 +40,19 @@ if [istarget "hppa*-hp-hpux10.20"] then {
|
|||||||
## return 0
|
## return 0
|
||||||
##}
|
##}
|
||||||
|
|
||||||
global srcfile
|
standard_testfile
|
||||||
set testfile "foll-vfork"
|
|
||||||
set testfile2 "vforked-prog"
|
|
||||||
set srcfile ${testfile}.c
|
|
||||||
set srcfile2 ${testfile2}.c
|
|
||||||
set binfile ${objdir}/${subdir}/${testfile}
|
|
||||||
set binfile2 ${objdir}/${subdir}/${testfile2}
|
|
||||||
|
|
||||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
|
||||||
untested foll-vfork.exp
|
untested "failed to compile $testfile"
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug}] != "" } {
|
set testfile2 "vforked-prog"
|
||||||
untested foll-vfork.exp
|
set srcfile2 ${testfile2}.c
|
||||||
return -1
|
|
||||||
|
if {[build_executable $testfile.exp $testfile2 $srcfile2 {debug}] == -1} {
|
||||||
|
untested "failed to compile $testfile2"
|
||||||
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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
|
||||||
@ -89,17 +86,14 @@ proc check_vfork_catchpoints {} {
|
|||||||
proc vfork_parent_follow_through_step {} {
|
proc vfork_parent_follow_through_step {} {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
|
|
||||||
send_gdb "set follow-fork parent\n"
|
gdb_test_no_output "set follow-fork parent" \
|
||||||
gdb_expect {
|
"set follow-fork parent, vfork through step"
|
||||||
-re "$gdb_prompt $" {pass "set follow-fork parent, vfork through step"}
|
|
||||||
timeout {fail "set follow-fork parent, vfork through step"}
|
set test "vfork parent follow, through step"
|
||||||
}
|
gdb_test_multiple "next" $test {
|
||||||
send_gdb "next\n"
|
-re "Detaching after fork from.*13.*$gdb_prompt " {
|
||||||
gdb_expect {
|
pass "vfork parent follow, through step"
|
||||||
-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
|
# 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
|
||||||
@ -112,22 +106,16 @@ proc vfork_parent_follow_to_bp {} {
|
|||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
global srcfile
|
global srcfile
|
||||||
|
|
||||||
send_gdb "set follow-fork parent\n"
|
gdb_test_no_output "set follow-fork parent" \
|
||||||
gdb_expect {
|
"set follow-fork parent, vfork to bp"
|
||||||
-re "$gdb_prompt $" {pass "set follow-fork parent, vfork to bp"}
|
|
||||||
timeout {fail "set follow-fork parent, vfork to bp"}
|
gdb_test "break ${srcfile}:18" ".*" "break, vfork to bp"
|
||||||
}
|
|
||||||
send_gdb "break ${srcfile}:18\n"
|
set test "vfork parent follow, to bp"
|
||||||
gdb_expect {
|
gdb_test_multiple "continue" $test {
|
||||||
-re "$gdb_prompt $" {pass "break, vfork to bp"}
|
-re ".*Detaching after fork from child process.*Breakpoint.*18.*$gdb_prompt " {
|
||||||
timeout {fail "break, vfork to bp"}
|
pass $test
|
||||||
}
|
}
|
||||||
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
|
# 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
|
||||||
@ -136,21 +124,45 @@ proc vfork_parent_follow_to_bp {} {
|
|||||||
exec sleep 1
|
exec sleep 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Kill child and reload symbols.
|
||||||
|
proc kill_child {} {
|
||||||
|
global binfile
|
||||||
|
global gdb_prompt
|
||||||
|
|
||||||
|
set test "killing inferior"
|
||||||
|
gdb_test_multiple "kill" $test {
|
||||||
|
-re ".*Kill the program being debugged.*y or n. $" {
|
||||||
|
gdb_test_no_output "y" ""
|
||||||
|
set test2 "file $binfile"
|
||||||
|
gdb_test_multiple "file $binfile" $test2 {
|
||||||
|
-re ".*Load new symbol table from.*y or n. $" {
|
||||||
|
send_gdb "y\n"
|
||||||
|
gdb_test_multiple "" "loading symbols" {
|
||||||
|
-re "Reading symbols from.*$gdb_prompt $" {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-re ".*gdb_prompt $" {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-re ".*$gdb_prompt $" {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
send_gdb "set follow-fork child\n"
|
gdb_test_no_output \
|
||||||
gdb_expect {
|
"set follow-fork child" \
|
||||||
-re "$gdb_prompt $" {pass "set follow-fork child, vfork and exec to main bp"}
|
"set follow-fork child, vfork and exec to main bp"
|
||||||
timeout {fail "set follow-fork child, vfork and exec to main bp"}
|
|
||||||
}
|
set test "vfork and exec child follow, to main bp"
|
||||||
send_gdb "continue\n"
|
gdb_test_multiple "continue" $test {
|
||||||
gdb_expect {
|
-re "Attaching after.* vfork to.*xecuting new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt " {
|
||||||
-re "Attaching after.* vfork to.*xecuting new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
|
pass $test
|
||||||
{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
|
# 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
|
||||||
@ -160,31 +172,11 @@ proc vfork_and_exec_child_follow_to_main_bp {} {
|
|||||||
|
|
||||||
# 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"
|
kill_child
|
||||||
gdb_expect {
|
|
||||||
-re ".*Kill the program being debugged.*y or n. $" {
|
|
||||||
gdb_test_no_output "y" ""
|
|
||||||
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 {} {
|
proc vfork_and_exec_child_follow_through_step {} {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
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
|
||||||
@ -198,17 +190,15 @@ proc vfork_and_exec_child_follow_through_step {} {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
send_gdb "set follow-fork child\n"
|
gdb_test_no_output \
|
||||||
gdb_expect {
|
"set follow-fork child" \
|
||||||
-re "$gdb_prompt $" {pass "set follow-fork child, vfork and exec through step"}
|
"set follow-fork child, vfork and exec through step"
|
||||||
timeout {fail "set follow-fork child, vfork and exec through step"}
|
|
||||||
}
|
set test "vfork and exec child follow, through step"
|
||||||
send_gdb "next\n"
|
gdb_test_multiple "next" $test {
|
||||||
gdb_expect {
|
-re "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 "$test"
|
||||||
{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
|
# 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
|
||||||
@ -218,65 +208,42 @@ proc vfork_and_exec_child_follow_through_step {} {
|
|||||||
|
|
||||||
# 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"
|
kill_child
|
||||||
gdb_expect {
|
|
||||||
-re ".*Kill the program being debugged.*y or n. $" {
|
|
||||||
gdb_test_no_output "y" ""
|
|
||||||
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 {} {
|
proc tcatch_vfork_then_parent_follow {} {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
global srcfile
|
global srcfile
|
||||||
|
|
||||||
send_gdb "set follow-fork parent\n"
|
gdb_test_no_output \
|
||||||
gdb_expect {
|
"set follow-fork parent" \
|
||||||
-re "$gdb_prompt $" {pass "set follow-fork parent, tcatch vfork"}
|
"set follow-fork parent, tcatch vfork"
|
||||||
timeout {fail "set follow-fork parent, tcatch vfork"}
|
|
||||||
|
gdb_test "tcatch vfork" \
|
||||||
|
"Catchpoint .*(vfork).*" \
|
||||||
|
"vfork parent follow, set tcatch vfork"
|
||||||
|
|
||||||
|
# HP-UX 10.20 seems to stop you in "vfork", while more recent
|
||||||
|
# HP-UXs stop you in "_vfork".
|
||||||
|
set test "vfork parent follow, tcatch vfork"
|
||||||
|
gdb_test_multiple "continue" $test {
|
||||||
|
-re "0x\[0-9a-fA-F\]*.*(vfork|__kernel_v?syscall).*$gdb_prompt " {
|
||||||
|
pass $test
|
||||||
|
}
|
||||||
|
-re "vfork \\(\\) at.*$gdb_prompt " {
|
||||||
|
pass $test
|
||||||
|
}
|
||||||
}
|
}
|
||||||
send_gdb "tcatch vfork\n"
|
|
||||||
gdb_expect {
|
set test "vfork parent follow, finish after tcatch vfork"
|
||||||
-re "Catchpoint .*(vfork).*$gdb_prompt $"\
|
gdb_test_multiple "finish" $test {
|
||||||
{pass "vfork parent follow, set tcatch vfork"}
|
-re "Run till exit from.*vfork.*0x\[0-9a-fA-F\]* in main .* at .*${srcfile}:12.*$gdb_prompt " {
|
||||||
-re "$gdb_prompt $" {fail "vfork parent follow, set tcatch vfork"}
|
pass $test
|
||||||
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 " {
|
-re "Run till exit from.*__kernel_v?syscall.*0x\[0-9a-fA-F\]* in vfork .*$gdb_prompt " {
|
||||||
send_gdb "finish\n"
|
send_gdb "finish\n"
|
||||||
exp_continue
|
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
|
# 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
|
||||||
@ -290,41 +257,38 @@ proc tcatch_vfork_then_child_follow {} {
|
|||||||
global srcfile
|
global srcfile
|
||||||
global srcfile2
|
global srcfile2
|
||||||
|
|
||||||
send_gdb "set follow-fork child\n"
|
gdb_test_no_output \
|
||||||
gdb_expect {
|
"set follow-fork child" \
|
||||||
-re "$gdb_prompt $" {pass "set follow-fork child, tcatch vfork"}
|
"set follow-fork child, tcatch vfork"
|
||||||
timeout {fail "set follow-fork child, tcatch vfork"}
|
|
||||||
|
gdb_test "tcatch vfork" \
|
||||||
|
"Catchpoint .*(vfork).*" \
|
||||||
|
"vfork child follow, set tcatch vfork"
|
||||||
|
|
||||||
|
# HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs
|
||||||
|
# stop you in "_vfork".
|
||||||
|
set test "vfork child follow, tcatch vfork"
|
||||||
|
gdb_test_multiple "continue" $test {
|
||||||
|
-re "vfork \\(\\) at .*$gdb_prompt $" {
|
||||||
|
pass $test
|
||||||
|
}
|
||||||
|
-re "0x\[0-9a-fA-F\]*.*(vfork|__kernel_v?syscall).*$gdb_prompt " {
|
||||||
|
pass $test
|
||||||
|
}
|
||||||
}
|
}
|
||||||
send_gdb "tcatch vfork\n"
|
|
||||||
gdb_expect {
|
set test "vfork child follow, finish after tcatch vfork"
|
||||||
-re "Catchpoint .*(vfork).*$gdb_prompt $"\
|
gdb_test_multiple "finish" $test {
|
||||||
{pass "vfork child follow, set tcatch vfork"}
|
-re "Run till exit from.*vfork.*${srcfile}:12.*$gdb_prompt " {
|
||||||
-re "$gdb_prompt $" {fail "vfork child follow, set tcatch vfork"}
|
pass $test
|
||||||
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 " {
|
-re "Run till exit from.*__kernel_v?syscall.*0x\[0-9a-fA-F\]* in vfork .*$gdb_prompt " {
|
||||||
send_gdb "finish\n"
|
send_gdb "finish\n"
|
||||||
exp_continue
|
exp_continue
|
||||||
}
|
}
|
||||||
-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 (followed exec)"}
|
pass "$test (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
|
# 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
|
||||||
@ -385,11 +349,7 @@ proc do_vfork_and_exec_tests {} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Start with a fresh gdb
|
# Start with a fresh gdb
|
||||||
|
clean_restart $testfile
|
||||||
gdb_exit
|
|
||||||
gdb_start
|
|
||||||
gdb_reinitialize_dir $srcdir/$subdir
|
|
||||||
gdb_load ${binfile}
|
|
||||||
|
|
||||||
# The "Detaching..." and "Attaching..." messages may be hidden by
|
# The "Detaching..." and "Attaching..." messages may be hidden by
|
||||||
# default.
|
# default.
|
||||||
|
Reference in New Issue
Block a user