[PATCH] [GDBServer] Send SIGINT using process group ID

Jim Chen nchen@mozilla.com
Wed May 11 21:54:00 GMT 2016


Hi,

linux_request_interrupt is supposed to send SIGINT to the process group,
but it passes the process ID to kill() instead of the process group ID,
which may not be the same as the process ID. The patch calls getpgid
first to get the process group ID.

Patch tested on arm-linux.

gdb/gdbserver:

2016-05-11  Jim Chen  <nchen@mozilla.com>

	* linux-low.c (linux_request_interrupt): Use process group ID for
	sending SIGINT
---
 gdb/gdbserver/linux-low.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 8e1e2fc..a282ca1 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -5745,17 +5745,17 @@ linux_look_up_symbols (void)
 
 static void
 linux_request_interrupt (void)
 {
   extern unsigned long signal_pid;
 
   /* 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 (-getpgid(signal_pid), SIGINT);
 }
 
 /* Copy LEN bytes from inferior's auxiliary vector starting at OFFSET
    to debugger memory starting at MYADDR.  */
 
 static int
 linux_read_auxv (CORE_ADDR offset, unsigned char *myaddr, unsigned int len)
 {
-- 
2.7.3



More information about the Gdb-patches mailing list