From patchwork Wed Dec 16 22:17:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Vandenberg X-Patchwork-Id: 10041 Received: (qmail 66386 invoked by alias); 16 Dec 2015 22:17:34 -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 66370 invoked by uid 89); 16 Dec 2015 22:17:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=differs X-HELO: mail-qk0-f175.google.com Received: from mail-qk0-f175.google.com (HELO mail-qk0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 16 Dec 2015 22:17:33 +0000 Received: by mail-qk0-f175.google.com with SMTP id p187so88531153qkd.1 for ; Wed, 16 Dec 2015 14:17:32 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.13.217.131 with SMTP id b125mr29047747ywe.222.1450304250765; Wed, 16 Dec 2015 14:17:30 -0800 (PST) Received: by 10.37.118.88 with HTTP; Wed, 16 Dec 2015 14:17:30 -0800 (PST) Date: Wed, 16 Dec 2015 15:17:30 -0700 Message-ID: Subject: [RFC][PATCH][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. 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. Is this a reasonable change? -brian gdb/Changelog: 2015-12-16 Brian Vandenberg PR gdb/8527 * gdb/procfs.c (proc_wait_for_stop): Added set_sigint_trap() & 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; + set_sigint_trap(); + win = (write (pi->ctl_fd, (char *) &cmd, sizeof (cmd)) == sizeof (cmd)); + + clear_sigint_trap(); + /* We been runnin' and we stopped -- need to update status. */ pi->status_valid = 0; }