This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] [PATCH] Kill processes, not process groups


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);
 }

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

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]