Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PR 34052 kill: Terminate inferior with non-zero exit code on Windows
@ 2026-04-07 10:52 Luca Bacci
  2026-04-10  8:54 ` Andrew Burgess
  0 siblings, 1 reply; 4+ messages in thread
From: Luca Bacci @ 2026-04-07 10:52 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1: Type: text/plain, Size: 82 bytes --]

See https://sourceware.org/bugzilla/show_bug.cgi?id=34052

Best Regards,
Luca

[-- Attachment #1.2: Type: text/html, Size: 894 bytes --]

[-- Attachment #2: 0001-PR-34052-kill-Terminate-inferior-with-non-zero-exit-.patch --]
[-- Type: text/plain, Size: 1385 bytes --]

From 81457be16cd49c5c7daa5781b287656a8188d483 Mon Sep 17 00:00:00 2001
From: Luca Bacci <luca.bacci@outlook.com>
Date: Tue, 7 Apr 2026 12:15:52 +0200
Subject: [PATCH] PR 34052 kill: Terminate inferior with non-zero exit code on
 Windows

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

Signed-off-by: Luca Bacci <luca.bacci@outlook.com>
---
 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.49.0.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PR 34052 kill: Terminate inferior with non-zero exit code on Windows
  2026-04-07 10:52 PR 34052 kill: Terminate inferior with non-zero exit code on Windows Luca Bacci
@ 2026-04-10  8:54 ` Andrew Burgess
  2026-04-10 11:49   ` [PATCH v2] " Luca Bacci
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Burgess @ 2026-04-10  8:54 UTC (permalink / raw)
  To: Luca Bacci, gdb-patches

Luca Bacci <luca.bacci@outlook.com> writes:

> See https://sourceware.org/bugzilla/show_bug.cgi?id=34052
>
> Best Regards,
> Luca
> From 81457be16cd49c5c7daa5781b287656a8188d483 Mon Sep 17 00:00:00 2001
> From: Luca Bacci <luca.bacci@outlook.com>
> Date: Tue, 7 Apr 2026 12:15:52 +0200
> Subject: [PATCH] PR 34052 kill: Terminate inferior with non-zero exit code on
>  Windows
>
> Don't terminate the inferior with exit code 0 (a 'successful' exit
> status). Rather, use the standard exit code 137 as for SIGKILL on
> Linux.
>
> Signed-off-by: Luca Bacci <luca.bacci@outlook.com>

Please remove the "Signed-off-by" tag, these have no meaning in GDB, but
might do in the future if we ever adopt DCO, so adding them right now is
confusing.

Also, please add a tag:

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34052

to link to the bug.

I don't do much (any) Windows stuff, but the code change makes sense to
me.  I'll hold off adding an approved-tag in case someone with more
Windows knowledge wants to chip in, but I think this is fine.

Reviewed-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

> ---
>  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.49.0.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] PR 34052 kill: Terminate inferior with non-zero exit code on Windows
  2026-04-10  8:54 ` Andrew Burgess
@ 2026-04-10 11:49   ` Luca Bacci
  2026-04-14 15:54     ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Luca Bacci @ 2026-04-10 11:49 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] PR 34052 kill: Terminate inferior with non-zero exit code on Windows
  2026-04-10 11:49   ` [PATCH v2] " Luca Bacci
@ 2026-04-14 15:54     ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2026-04-14 15:54 UTC (permalink / raw)
  To: Luca Bacci; +Cc: gdb-patches

>>>>> "Luca" == Luca Bacci <luca.bacci@outlook.com> writes:

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

Thanks.  This looks ok to me.  I'm checking it in on your behalf.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-14 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-07 10:52 PR 34052 kill: Terminate inferior with non-zero exit code on Windows Luca Bacci
2026-04-10  8:54 ` Andrew Burgess
2026-04-10 11:49   ` [PATCH v2] " Luca Bacci
2026-04-14 15:54     ` Tom Tromey

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