Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [gdb/python] Fix test_python on msys2-ucrt64
@ 2026-11-16 15:14 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2026-11-16 15:14 UTC (permalink / raw)
  To: gdb-patches

On msys2-ucrt64, running the selftests terminates after test_python.

The problem is that the test does "raise (SIGINT)", which terminates GDB.

Fix this on MinGW by calling handle_sigint directly.

Tested on x86_64-linux and msys2-ucrt64 by rebuilding and running the
selftests.
---
 gdb/python/python.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 5ad478cf2e3..a2e0606bcc5 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -2826,9 +2826,19 @@ test_python ()
 
   saw_exception = false;
   {
+    auto raise_sigint = [] ()
+      {
+#ifdef __MINGW32__
+	/* On MinGW, raise (SIGINT) terminates GDB, so call the sigint handler
+	   directly.  */
+	handle_sigint (SIGINT);
+#else
+	raise (SIGINT);
+#endif
+      };
+
     scoped_restore save_hook
-      = make_scoped_restore (&hook_set_active_ext_lang,
-			     []() { raise (SIGINT); });
+      = make_scoped_restore (&hook_set_active_ext_lang, raise_sigint);
     try
       {
 	CMD (output);

base-commit: 5678a7bfceb3a6ea18bcde1ae68f7e96c43c998b
-- 
2.51.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-16 15:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 15:14 [PATCH] [gdb/python] Fix test_python on msys2-ucrt64 Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox