From: Pedro Alves Date: Sat, 23 May 2026 02:08:31 +0000 (+0100) Subject: Adjust gdb.base/exitsignal.exp for MinGW, trigger fault X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2bbd3cb2289792e8093eec3594b96795df0fc1d4;p=thirdparty%2Fbinutils-gdb.git Adjust gdb.base/exitsignal.exp for MinGW, trigger fault gdb.base/segv.c uses raise(SIGSEGV) to generate a SIGSEGV. On native Windows that does not generate an EXCEPTION_ACCESS_VIOLATION; raise is a pure userspace construct: it dispatches to the registered SIGSEGV handler if there is one, otherwise calls abort. GDB therefore never sees an exception to intercept. E.g.: ... continue Continuing. [Thread 1908.0x3308 (id 2) exited with code 3] [Inferior 1 (process 1908) exited with code 03] (gdb) FAIL: gdb.base/exitsignal.exp: trigger SIGSEGV (the program exited) continue The program is not being run. ... Replace the raise with a real null dereference so the kernel actually raises an access violation. Note: I confirmed no other tests use segv.c. segv.c and normal.c are both "owned" by gdb.base/exitsignal.exp. Change-Id: Ib54d9e6998cf9bfc18dcb5e76d31a9deb0458da4 --- diff --git a/gdb/testsuite/gdb.base/segv.c b/gdb/testsuite/gdb.base/segv.c index a3db6d292db..fd43d95e9b2 100644 --- a/gdb/testsuite/gdb.base/segv.c +++ b/gdb/testsuite/gdb.base/segv.c @@ -17,13 +17,11 @@ /* This test can be used just to generate a SIGSEGV. */ -#include - int main (int argc, char *argv[]) { /* Generating a SIGSEGV. */ - raise (SIGSEGV); + *(volatile int *) 0; return 0; }