Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luca Bacci <luca.bacci@outlook.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v2] PR 34052 kill: Terminate inferior with non-zero exit code on Windows
Date: Fri, 10 Apr 2026 13:49:44 +0200	[thread overview]
Message-ID: <AS2PR02MB102271C2406EC3D5F91A7A16D83592@AS2PR02MB10227.eurprd02.prod.outlook.com> (raw)
In-Reply-To: <87ik9z42m1.fsf@redhat.com>

Don't terminate the inferior with exit code 0 (a 'success' exit
code). Rather, use the standard exit code 137 as with SIGKILL on
Linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34052
---
 gdb/windows-nat.c      | 2 +-
 gdbserver/win32-low.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index e25ae81f..964d87c2 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2352,7 +2352,7 @@ windows_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
 void
 windows_nat_target::kill ()
 {
-  CHECK (TerminateProcess (windows_process->handle, 0));
+  CHECK (TerminateProcess (windows_process->handle, 137));
 
   for (;;)
     {
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index ddc5e547..adb4c08b 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -663,7 +663,7 @@ win32_clear_process ()
 int
 win32_process_target::kill (process_info *process)
 {
-  TerminateProcess (windows_process.handle, 0);
+  TerminateProcess (windows_process.handle, 137);
   for (;;)
     {
       if (!child_continue (DBG_CONTINUE, -1))
-- 
2.53.0.windows.2


  reply	other threads:[~2026-04-10 11:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 10:52 Luca Bacci
2026-04-10  8:54 ` Andrew Burgess
2026-04-10 11:49   ` Luca Bacci [this message]
2026-04-14 15:54     ` [PATCH v2] " Tom Tromey

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=AS2PR02MB102271C2406EC3D5F91A7A16D83592@AS2PR02MB10227.eurprd02.prod.outlook.com \
    --to=luca.bacci@outlook.com \
    --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