From patchwork Tue Jan 5 19:43:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Vandenberg X-Patchwork-Id: 10231 Received: (qmail 99255 invoked by alias); 5 Jan 2016 19:43:45 -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 99225 invoked by uid 89); 5 Jan 2016 19:43:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=suffice, Hx-languages-length:1786, controlling X-HELO: mail-yk0-f181.google.com Received: from mail-yk0-f181.google.com (HELO mail-yk0-f181.google.com) (209.85.160.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 05 Jan 2016 19:43:44 +0000 Received: by mail-yk0-f181.google.com with SMTP id k129so270532647yke.0 for ; Tue, 05 Jan 2016 11:43:43 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.129.154.82 with SMTP id r79mr72893373ywg.15.1452023022156; Tue, 05 Jan 2016 11:43:42 -0800 (PST) Received: by 10.37.118.130 with HTTP; Tue, 5 Jan 2016 11:43:42 -0800 (PST) Date: Tue, 5 Jan 2016 12:43:42 -0700 Message-ID: Subject: [PATCH V2][PR gdb/8527] Fix interrupt (^C) in Solaris From: Brian Vandenberg To: gdb-patches@sourceware.org This patch addresses an issue in Solaris, bug 8527. This is my second submission for this issue with changes recommended by Joel Brobecker: * changelog formatting * comments explaining reason for the change The problem: If gdb attaches to a process that either has no controlling terminal, or the controlling terminal differs from the one gdb is running under, hitting ^C doesn't interrupt the debugged process. The change makes it possible to interrupt/resume without any apparent problems, but I don't know the ramifications of these changes. I ran across this issue and a fix that was proposed 12 years ago. Joel indicates this change has been in the Adacore GDB branch for quite a long time. Lastly: * I don't have DejaGNU and I cannot get it built/installed in a short time frame. Suffice it to say this isn't a near-term option. I'm sorry, I would have ran the tests if I could. * I'm working on an airgapped machine. These changes were hand-copied. I won't be able to push these changes myself. -brian gdb/Changelog: 2016-01-05 Brian Vandenberg PR gdb/8527 * procfs.c (proc_wait_for_stop): calls to set_sigint_trap and clear_sigint_trap. diff --git a/gdb/procfs.c b/gdb/procfs.c index 7b7ff45..7cd870c 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -1487,7 +1487,12 @@ proc_wait_for_stop (procinfo *pi) { procfs_ctl_t cmd = PCWSTOP; + /* PR gdb/8527 + * Was not correctly interrupting the inferior process + * when ^C was pressed in the debug terminal. + */ + set_sigint_trap(); + win = (write (pi->ctl_fd, (char *) &cmd, sizeof (cmd)) == sizeof (cmd)); + + /* PR gdb/8527 */ + clear_sigint_trap(); + /* We been runnin' and we stopped -- need to update status. */ pi->status_valid = 0; }