From patchwork Wed May 11 21:51:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Chen X-Patchwork-Id: 12209 Received: (qmail 70071 invoked by alias); 11 May 2016 21:54:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 70048 invoked by uid 89); 11 May 2016 21:54:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=auxiliary, H*Ad:D*mozilla.com X-HELO: mail-yw0-f175.google.com Received: from mail-yw0-f175.google.com (HELO mail-yw0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 11 May 2016 21:54:05 +0000 Received: by mail-yw0-f175.google.com with SMTP id g133so56282084ywb.2 for ; Wed, 11 May 2016 14:54:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rm8fPN+RNimgOzckDuh13zegCVrDkrETu1TEnH+J2HI=; b=YHopsa67zD14Qut8D/yIk9y4Emi8UapZF1Jy9Hrb/6rUeRxQgGODV2q7jbIkgwMdB9 sInmKoWR1+yeMeY7mg8xcYbcOJBQw0JITkCa2Rst95BHy5SAN4IXjiQ4AA7ELfSsYupx MRqs4WQyqc+ExX5fhjltv2ItemyfE73bzu8SHh6X6/2Vj9C9k4BEFF/r+hJkunW/Yd7t Ee7/+ub80zD3lohhC0YoV6OaYMRj21mhZ8Mnjvm5giZJ2/ww9lGEvSqnWUnIY65c0lI5 OMYKb4hBSKtoIBzfv8SYQEm+2wKYt61oZqNx+ueT4f30me4agvUWCt/tEAze0PZMOYpp dZjQ== X-Gm-Message-State: AOPr4FWmCwY5NeYf57kZ5DQQFvG9htyo71MXYJPi5zUEmqWgLza/e6LhMoEqMTrkl0Be5R2l X-Received: by 10.37.111.11 with SMTP id k11mr2840734ybc.59.1463003643359; Wed, 11 May 2016 14:54:03 -0700 (PDT) Received: from localhost.localdomain ([208.102.166.82]) by smtp.googlemail.com with ESMTPSA id l188sm5427310ywc.0.2016.05.11.14.54.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 May 2016 14:54:02 -0700 (PDT) From: Jim Chen To: gdb-patches@sourceware.org Cc: Jim Chen Subject: [PATCH] [GDBServer] Send SIGINT using process group ID Date: Wed, 11 May 2016 17:51:47 -0400 Message-Id: <1463003507-13094-2-git-send-email-nchen@mozilla.com> In-Reply-To: <1463003507-13094-1-git-send-email-nchen@mozilla.com> References: <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 * 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) {