[v2] Fix kill of processes created by win32_create_inferior

Message ID 20200211164113.3009-1-ssbssa@yahoo.de
State New, archived
Headers

Commit Message

Terekhov, Mikhail via Gdb-patches Feb. 11, 2020, 4:41 p.m. UTC
  handle_v_kill uses signal_pid because win32 doesn't support multi-process.

Without this gdb just refuses to kill the process:
(gdb) kill
Kill the program being debugged? (y or n) y
Can't kill process

gdbserver/ChangeLog:

2020-02-11  Hannes Domani  <ssbssa@yahoo.de>

	* win32-low.c (win32_create_inferior): Set signal_pid.
---
 gdbserver/win32-low.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Simon Marchi Feb. 12, 2020, 4:59 a.m. UTC | #1
On 2020-02-11 11:41 a.m., Hannes Domani via gdb-patches wrote:
> handle_v_kill uses signal_pid because win32 doesn't support multi-process.
> 
> Without this gdb just refuses to kill the process:
> (gdb) kill
> Kill the program being debugged? (y or n) y
> Can't kill process

What would be interesting to see and paste in the commit message is the remote
protocol communication between GDB and GDBserver (just the vKill packet and its
response).  Do "set debug remote 1" to make GDB print that communication.

The patch is ok to be pushed with that added, thanks.

Simon
  
Terekhov, Mikhail via Gdb-patches Feb. 12, 2020, 4:14 p.m. UTC | #2
Am Mittwoch, 12. Februar 2020, 05:59:31 MEZ hat Simon Marchi <simark@simark.ca> Folgendes geschrieben:

> On 2020-02-11 11:41 a.m., Hannes Domani via gdb-patches wrote:
>
> > handle_v_kill uses signal_pid because win32 doesn't support multi-process.
> >
> > Without this gdb just refuses to kill the process:
> > (gdb) kill
> > Kill the program being debugged? (y or n) y
> > Can't kill process
>
>
> What would be interesting to see and paste in the commit message is the remote
> protocol communication between GDB and GDBserver (just the vKill packet and its
> response).  Do "set debug remote 1" to make GDB print that communication.
>
> The patch is ok to be pushed with that added, thanks.

Pushed with this additional info, thanks.
  

Patch

diff --git a/gdbserver/win32-low.c b/gdbserver/win32-low.c
index 9d0343788f..557c90d97c 100644
--- a/gdbserver/win32-low.c
+++ b/gdbserver/win32-low.c
@@ -709,6 +709,9 @@  win32_create_inferior (const char *program,
      (assuming success).  */
   cs.last_ptid = win32_wait (ptid_t (current_process_id), &cs.last_status, 0);
 
+  /* Necessary for handle_v_kill.  */
+  signal_pid = current_process_id;
+
   return current_process_id;
 }