public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jim Chen <nchen@mozilla.com>
To: gdb-patches@sourceware.org
Cc: Jim Chen <nchen@mozilla.com>
Subject: [PATCH] [GDBServer] Send SIGINT using process group ID
Date: Wed, 11 May 2016 21:54:00 -0000	[thread overview]
Message-ID: <1463003507-13094-2-git-send-email-nchen@mozilla.com> (raw)
In-Reply-To: <1463003507-13094-1-git-send-email-nchen@mozilla.com>

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

  reply	other threads:[~2016-05-11 21:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 21:54 [PATCH] Specify python2 or python3 as Python program name Jim Chen
2016-05-11 21:54 ` Jim Chen [this message]
2016-05-18 12:10   ` [PATCH] [GDBServer] Send SIGINT using process group ID Pedro Alves
2016-05-19 16:01     ` Jim Chen
2016-05-12  5:54 ` [PATCH] Specify python2 or python3 as Python program name Eli Zaretskii
2016-05-12 12:50 ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1463003507-13094-2-git-send-email-nchen@mozilla.com \
    --to=nchen@mozilla.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).