[binutils-gdb] Adjust gdb.base/exitsignal.exp for MinGW, trigger fault
Pedro Alves via Gdb-cvs <[email protected]> Fri, 12 Jun 2026 13:58:54 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2bbd3cb2289792e8093eec3594b96795df0fc1d4 commit 2bbd3cb2289792e8093eec3594b96795df0fc1d4 Author: Pedro Alves <[email protected]> Date: Sat May 23 03:08:31 2026 +0100 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: --- gdb/testsuite/gdb.base/segv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 <signal.h> - int main (int argc, char *argv[]) { /* Generating a SIGSEGV. */ - raise (SIGSEGV); + *(volatile int *) 0; return 0; }