diff mbox

[RFC] Kill processes, not process groups

Message ID 555455E2.3060905@dancol.org
State New
Headers show

Commit Message

Daniel Colascione May 14, 2015, 7:59 a.m. UTC
Killing process groups for interruption doesn't make any sense. Say we
have a two-process group [A B], where A is the leader.  If we attach to
A and use "interrupt", we accidentally kill B. If we attach to B,
"interrupt" does nothing. Why wouldn't we just signal A?

This problem is worse in the gdbserver case. Locally, we use
pass_signal, not interrupt, for C-c, and pass_signal does the right
thing. But in the remote case, we have nothing but interrupt, and that
doesn't seem to do users intend.

commit 8d096e713e46f00bc8bf55743288a24f6222021f
Author: Daniel Colascione <dancol@dancol.org>
Date:   Wed May 13 23:58:24 2015 -0700

    Kill the process we're dealing with, not the whole group

Comments

Andrew Pinski May 14, 2015, 8:17 a.m. UTC | #1
> On May 14, 2015, at 12:59 AM, Daniel Colascione <dancol@dancol.org> wrote:
> 
> Killing process groups for interruption doesn't make any sense. Say we
> have a two-process group [A B], where A is the leader.  If we attach to
> A and use "interrupt", we accidentally kill B. If we attach to B,
> "interrupt" does nothing. Why wouldn't we just signal A?
> 
> This problem is worse in the gdbserver case. Locally, we use
> pass_signal, not interrupt, for C-c, and pass_signal does the right
> thing. But in the remote case, we have nothing but interrupt, and that
> doesn't seem to do users intend.
> 
> commit 8d096e713e46f00bc8bf55743288a24f6222021f
> Author: Daniel Colascione <dancol@dancol.org>
> Date:   Wed May 13 23:58:24 2015 -0700
> 
>    Kill the process we're dealing with, not the whole group
> 
> diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
> index 4da11c6..8a725fa 100644
> --- a/gdb/gdbserver/linux-low.c
> +++ b/gdb/gdbserver/linux-low.c
> @@ -4904,7 +4904,7 @@ linux_request_interrupt (void)
> 
>   /* Send a SIGINT to the process group.  This acts just like the user
>      typed a ^C on the controlling terminal.  */
> -  kill (-signal_pid, SIGINT);
> +  kill (signal_pid, SIGINT);

Your patch did not update the comment though. So it raises the question which is the correct behavior. 

Thanks,
Andrew

> }
> 
> /* Copy LEN bytes from inferior's auxiliary vector starting at OFFSET
>
Daniel Colascione May 14, 2015, 8:18 a.m. UTC | #2
On 05/14/2015 01:17 AM, pinskia@gmail.com wrote:
> Your patch did not update the comment though. So it raises the question which is the correct behavior. 


It also doesn't fix any tests or fix inf-ptrace.c. I wanted to get a bit
of feedback first.
diff mbox

Patch

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 4da11c6..8a725fa 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -4904,7 +4904,7 @@  linux_request_interrupt (void)

   /* Send a SIGINT to the process group.  This acts just like the user
      typed a ^C on the controlling terminal.  */
-  kill (-signal_pid, SIGINT);
+  kill (signal_pid, SIGINT);
 }

 /* Copy LEN bytes from inferior's auxiliary vector starting at OFFSET