forked from Imagelibrary/binutils-gdb
gdb testsuite: Introduce allow_fork_tests and use it throughout
Cygwin debugging does not support follow fork. There is currently no
interface between the debugger and the Cygwin runtime to be able to
intercept forks and execs. Consequently, testcases that try to
exercise fork/exec all FAIL, and several hit long cascading timeouts.
Add a new allow_fork_tests procedure, meant be be used with require,
and sprinkle it throughout testcases that exercise fork.
Note that some tests currently are skipped on targets other than
Linux, with something like:
# Until "set follow-fork-mode" and "catch vfork" are implemented on
# other targets...
#
if {![istarget "*-linux*"]} {
continue
}
However, some BSD ports also support fork debugging nowadays, and the
testcases were never adjusted... That is why the new allow_fork_tests
procedure doesn't look for linux.
With this patch, on Cygwin, I get this:
$ make check TESTS="*/*fork*.exp"
...
=== gdb Summary ===
# of expected passes 6
# of untested testcases 1
# of unsupported tests 31
Change-Id: I0c5e8c574d1f61b28d370c22a0b0b6bc3efaf978
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
|
||||
standard_testfile
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
# Build two programs -- one for fork, and another for vfork.
|
||||
set testfile_fork "${testfile}-fork"
|
||||
set testfile_vfork "${testfile}-vfork"
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
# ld.so probes before reaching main, and ptrace flags were set then. But a
|
||||
# static executable would just keep running and never catch the fork.
|
||||
|
||||
# Until "catch fork" is implemented on other targets...
|
||||
#
|
||||
require {is_any_target "*-*-linux*" "*-*-openbsd*"}
|
||||
require allow_fork_tests
|
||||
|
||||
# Reusing foll-fork.c since it's a simple forking program.
|
||||
standard_testfile foll-fork.c
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
# enabled as it will be redirected to the log.
|
||||
require !gdb_debug_enabled
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
|
||||
|
||||
@@ -18,12 +18,7 @@
|
||||
# either execs or exits --- since those events take somewhat different
|
||||
# code paths in GDB, both variants are exercised.
|
||||
|
||||
# Until "set follow-fork-mode" and "catch vfork" are implemented on
|
||||
# other targets...
|
||||
#
|
||||
if {![istarget "*-linux*"]} {
|
||||
continue
|
||||
}
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile .c -exit.c vforked-prog.c
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
# in the source of the shlib, and "list" should display the source where
|
||||
# the program stopped.
|
||||
|
||||
require allow_fork_tests
|
||||
require allow_shlib_tests
|
||||
|
||||
standard_testfile .c -shlib.c
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
# inferior-events [on,off]', 'set follow-fork-mode [child,parent]' and
|
||||
# 'set detach-on-fork [on,off]' are the correct ones.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
# This test relies on "run", so it cannot run on target remote stubs.
|
||||
require !use_gdb_stub
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
# in non-stop). GDB used to miss updating the parent/child running
|
||||
# states after a fork.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
# The test proper.
|
||||
|
||||
@@ -13,10 +13,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Until "set follow-fork-mode" and "catch fork" are implemented on
|
||||
# other targets...
|
||||
#
|
||||
require {istarget "*-*-linux*"}
|
||||
require allow_fork_tests
|
||||
|
||||
require support_displaced_stepping
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
# Make sure that we can interrupt an inferior that forks and moves to
|
||||
# its own session.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
if {[build_executable "failed to build" $testfile $srcfile {debug}]} {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
# Test fork handling of an inferior that has JIT-ed objfiles.
|
||||
|
||||
require allow_fork_tests
|
||||
require allow_shlib_tests
|
||||
|
||||
load_lib jit-elf-helpers.exp
|
||||
|
||||
@@ -13,11 +13,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Until "set follow-fork-mode" and "catch fork" are implemented on
|
||||
# other targets...
|
||||
#
|
||||
require {istarget "*-*-linux*"}
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile .c
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
# Test that we can follow forks properly when the executable is
|
||||
# position-independent.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
set opts [list debug pie]
|
||||
|
||||
@@ -13,11 +13,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
standard_testfile
|
||||
|
||||
# Test a thread is doing step-over a syscall instruction which is exit,
|
||||
# and GDBserver should cleanup its state of step-over properly.
|
||||
|
||||
# The testcase relies on follow-fork-mode child.
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
set syscall_insn ""
|
||||
|
||||
# Define the syscall instruction for each target.
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
# schedule-multiple on" or "set detach-on-fork on". Test these two resolution
|
||||
# methods.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile .c vforked-prog.c
|
||||
|
||||
set binfile ${testfile}-exit
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
# This test uses "awatch".
|
||||
require allow_hw_watchpoint_access_tests
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
standard_testfile .c
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
if { [build_executable ${testfile}.exp ${testfile} $srcfile {debug}] } {
|
||||
untested "failed to compile"
|
||||
return -1
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
# watchpoints don't end up with stale locations, preventing resumption
|
||||
# of other inferiors.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
if {[build_executable "failed to build" $testfile $srcfile {debug}]} {
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
# another thread, in different combinations of "set follow-fork
|
||||
# parent/child", and other execution modes.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
# Line where to stop the main thread.
|
||||
|
||||
@@ -13,10 +13,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Only GNU/Linux is known to support `set follow-fork-mode child'.
|
||||
if { ! [istarget "*-*-linux*"] } {
|
||||
return 0
|
||||
}
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#
|
||||
# See https://sourceware.org/bugzilla/show_bug.cgi?id=18600
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
# In remote mode, we cannot continue debugging after all
|
||||
# inferiors have terminated, and this test requires that.
|
||||
if { [target_info exists gdb_protocol]
|
||||
|
||||
@@ -13,11 +13,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Only GNU/Linux is known to support `set follow-fork-mode child'.
|
||||
#
|
||||
if { ! [istarget "*-*-linux*"] } {
|
||||
return 0
|
||||
}
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
# This test verifies that several threads forking while another thread
|
||||
# is constantly stepping over a breakpoint is properly handled.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
set linenum [gdb_get_line_number "set break here"]
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
# 20.04.5 LTS with 32-bit kernel + 32-bit userland. It was NOT reproducible
|
||||
# using a circa 2023 Raspberry Pi OS w/ 64-bit kernel and 32-bit userland.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
# Line where to stop the main thread.
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
# Test doing a "next" on a thread during which forks or vforks happen in other
|
||||
# threads.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
# Line where to stop the main thread.
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
# parent thread from waitpid'ing it, preventing the main thread from joining
|
||||
# it, prevent it from writing the flag file, failing the test.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
if { [is_remote target] } {
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
# event, and erroneously create a new inferior for it. Once fixed, the child
|
||||
# process' thread is hidden by whoever holds the pending fork event.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile .c -touch-file.c
|
||||
|
||||
set touch_file_bin $binfile-touch-file
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
# Test following a vfork child that execs, when the vfork parent is a
|
||||
# threaded program, and it's a non-main thread that vforks.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]} {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
# Test following a vfork child that exits, when the vfork parent is a
|
||||
# threaded program, and it's a non-main thread that vforks.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]} {
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
# To catch the bug, this test verifies that we can hit a breakpoint after a
|
||||
# vfork call, while a second inferior runs in the background.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
require !use_gdb_stub
|
||||
|
||||
standard_testfile .c -sleep.c
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
# breakpoints are removed, so the main thread would miss the breakpoint and run
|
||||
# until exit.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
standard_testfile
|
||||
|
||||
if { [build_executable "failed to prepare" ${testfile} ${srcfile} {debug pthreads}] } {
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
# must be done before starting the test so as to not disrupt the execution
|
||||
# of the actual test.
|
||||
|
||||
require allow_fork_tests
|
||||
|
||||
set allow_hw_watchpoint_tests_p [allow_hw_watchpoint_tests]
|
||||
|
||||
set testfile watchpoint-fork
|
||||
|
||||
Reference in New Issue
Block a user