[binutils-gdb] PR 34052 kill: Terminate inferior with non-zero exit code on Windows

Tom Tromey via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=14415fcedb9cf147bca46115c84a7d2e8cea574d

commit 14415fcedb9cf147bca46115c84a7d2e8cea574d
Author: Luca Bacci <[email protected]>
Date:   Fri Apr 10 13:49:44 2026 +0200

    PR 34052 kill: Terminate inferior with non-zero exit code on Windows
    
    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
    Reviewed-By: Andrew Burgess <[email protected]>
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 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 e25ae81f054..964d87c24ef 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 ddc5e5475ec..adb4c08b980 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))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.