]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Adjust gdb.base/exitsignal.exp for MinGW, trigger fault
authorPedro Alves <pedro@palves.net>
Sat, 23 May 2026 02:08:31 +0000 (03:08 +0100)
committerPedro Alves <pedro@palves.net>
Fri, 12 Jun 2026 13:57:11 +0000 (14:57 +0100)
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

gdb/testsuite/gdb.base/segv.c

index a3db6d292db6dda845dc005502ecff2bbea3e474..fd43d95e9b2af708196dc36c7fac6db9d96ddefa 100644 (file)
 
 /* 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;
 }