From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 01/11] Adjust gdb.base/exitsignal.exp for MinGW, trigger fault
Date: Mon, 25 May 2026 20:18:19 +0100 [thread overview]
Message-ID: <20260525191829.984105-2-pedro@palves.net> (raw)
In-Reply-To: <20260525191829.984105-1-pedro@palves.net>
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
commit-id: 86fcf2ce
---
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;
}
--
2.53.0
next prev parent reply other threads:[~2026-05-25 19:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 19:18 [PATCH v2 00/11] Fix a few Cygwin/MinGW problems Pedro Alves
2026-05-25 19:18 ` Pedro Alves [this message]
2026-05-25 19:18 ` [PATCH v2 02/11] Adjust gdb.base/exitsignal.exp for MinGW, second-chance SIGSEGV Pedro Alves
2026-05-26 11:18 ` Eli Zaretskii
2026-05-27 12:56 ` Pedro Alves
2026-05-25 19:18 ` [PATCH v2 03/11] Adjust gdb.base/exitsignal.exp for MinGW, separate program names Pedro Alves
2026-05-27 21:59 ` Thiago Jung Bauermann
2026-06-12 14:00 ` Pedro Alves
2026-05-25 19:18 ` [PATCH v2 04/11] gdb.base/exitsignal.exp: Exit with non-zero Pedro Alves
2026-05-25 19:18 ` [PATCH v2 05/11] gdb.base/exitsignal.exp: Test attaching too Pedro Alves
2026-05-25 19:18 ` [PATCH v2 06/11] gdb/testsuite: Add mechanism to compile Windows native programs on Cygwin Pedro Alves
2026-05-25 19:18 ` [PATCH v2 07/11] Windows gdb+gdbserver: Share exit status logic Pedro Alves
2026-05-25 19:18 ` [PATCH v2 08/11] Windows gdb+gdbserver: Decode Cygwin ExitProcess codes Pedro Alves
2026-05-26 11:31 ` Eli Zaretskii
2026-05-27 13:58 ` Pedro Alves
2026-05-27 14:12 ` Eli Zaretskii
2026-05-27 22:00 ` Thiago Jung Bauermann
2026-05-25 19:18 ` [PATCH v2 09/11] Adjust gdb.python/py-events.exp for Cygwin/MinGW, thread IDs Pedro Alves
2026-05-25 19:18 ` [PATCH v2 10/11] Adjust gdb.python/py-events.exp for Cygwin/MinGW, no fork Pedro Alves
2026-05-25 19:18 ` [PATCH v2 11/11] Adjust gdb.python/py-events.exp for Cygwin/MinGW, "info proc" => "inferior" Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260525191829.984105-2-pedro@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox