aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.fortran/pointer-to-pointer.f90
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2025-08-08 23:50:04 +0100
committerPedro Alves <pedro@palves.net>2025-08-22 19:45:49 +0100
commite771abf8ff88a5d98b8960a7ea49708b9ec42521 (patch)
tree0593c57081ca075f6835da24fb8a54b414f1d985 /gdb/testsuite/gdb.fortran/pointer-to-pointer.f90
parent3214cb0ce58245516d35cd93887f0d3bc14b5ebf (diff)
downloadgdb-e771abf8ff88a5d98b8960a7ea49708b9ec42521.zip
gdb-e771abf8ff88a5d98b8960a7ea49708b9ec42521.tar.gz
gdb-e771abf8ff88a5d98b8960a7ea49708b9ec42521.tar.bz2
testsuite: Introduce gdb_watchdog (avoid unistd.h/alarm)
There are a good number of testcases in the testsuite that use alarm() as a watchdog that aborts the test if something goes wrong. alarm()/SIG_ALRM do not exist on (native) Windows, so those tests fail to compile there. For example, testing with x86_64-w64-mingw32-gcc, we see: Running /c/rocgdb/src/gdb/testsuite/gdb.base/attach.exp ... gdb compile failed, C:/rocgdb/src/gdb/testsuite/gdb.base/attach.c: In function 'main': C:/rocgdb/src/gdb/testsuite/gdb.base/attach.c:17:3: error: implicit declaration of function 'alarm' [-Wimplicit-function-declaration] 17 | alarm (60); | ^~~~~ While testing with a clang configured to default to x86_64-pc-windows-msvc, which uses the C/C++ runtime headers from Visual Studio and has no unistd.h, we get: Running /c/rocgdb/src/gdb/testsuite/gdb.base/attach.exp ... gdb compile failed, C:/rocgdb/src/gdb/testsuite/gdb.base/attach.c:8:10: fatal error: 'unistd.h' file not found 8 | #include <unistd.h> | ^~~~~~~~~~ Handle this by adding a new testsuite/lib/gdb_watchdog.h header that defines a new gdb_watchdog function, which wraps alarm on Unix-like systems, and uses a timer on Windows. This patch adjusts gdb.base/attach.c as example of usage. Testing gdb.base/attach.exp with clang/x86_64-pc-windows-msvc required a related portability tweak to can_spawn_for_attach, to not rely on unistd.h on Windows. gdb.rocm/mi-attach.cpp is another example adjusted, one which always runs with clang configured as x86_64-pc-windows-msvc on Windows (via hipcc). Approved-by: Kevin Buettner <kevinb@redhat.com> Change-Id: I3b07bcb60de039d34888ef3494a5000de4471951
Diffstat (limited to 'gdb/testsuite/gdb.fortran/pointer-to-pointer.f90')
0 files changed, 0 insertions, 0 deletions