Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb/python] Fix test_python on msys2-ucrt64
Date: Mon, 16 Nov 2026 16:14:26 +0100	[thread overview]
Message-ID: <20261116151426.2137137-1-tdevries@suse.de> (raw)

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


                 reply	other threads:[~2026-11-16 15:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261116151426.2137137-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --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