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"
# 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
# along with this program. If not, see <http://www.gnu.org/licenses/>.
require {!target_info exists gdb,nosignals}
+require allow_fork_tests
standard_testfile
# enabled because it will be redirected to the log.
require !gdb_debug_enabled
require {is_any_target "i?86-*-*" "x86_64-*-*"}
+require allow_fork_tests
standard_testfile
# 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]} {
# 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
# 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
# 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
# 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.
# 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
# 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}]} {
# 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
# 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
# Test that we can follow forks properly when the executable is
# position-independent.
+require allow_fork_tests
+
standard_testfile
set opts [list debug pie]
# 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.
# 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
# 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]} {
standard_testfile .c
+require allow_fork_tests
+
if { [build_executable ${testfile}.exp ${testfile} $srcfile {debug}] } {
untested "failed to compile"
return -1
# 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}]} {
load_lib rocm.exp
require allow_hipcc_tests
+require allow_fork_tests
standard_testfile -execer.cpp -execee.cpp
load_lib rocm.exp
require allow_hipcc_tests
+require allow_fork_tests
standard_testfile -execer.cpp -execee.cpp
load_lib rocm.exp
require allow_hipcc_tests
+require allow_fork_tests
standard_testfile .c
# 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.
# 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
#
# 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]
# 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
# 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"]
# 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.
# 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.
# 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] } {
# 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
# 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}]} {
# 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}]} {
# 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
# 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}] } {
# 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
return 0
}
+# Return whether we allow running fork-related testcases. Targets
+# that don't even have any concept of fork will just fail to compile
+# the testcases and skip the tests that way if this returns true for
+# them. Unix targets that do have a fork system call, but don't
+# support intercepting forks will want to return false here, otherwise
+# the testcases that exercise fork may hit a number of long cascading
+# time out sequences.
+
+proc allow_fork_tests {} {
+ if {[istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"]} {
+ return 0
+ }
+
+ return 1
+}
+
# Return a 1 if we should run tests that require hardware breakpoints
proc allow_hw_breakpoint_tests {} {