From patchwork Wed Aug 6 15:58:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 2328 Received: (qmail 18710 invoked by alias); 6 Aug 2014 15:58: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 18540 invoked by uid 89); 6 Aug 2014 15:58:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 06 Aug 2014 15:58:13 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76FwBQt023416 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 11:58:11 -0400 Received: from blade.nx (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76FwAhb014453 for ; Wed, 6 Aug 2014 11:58:11 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 713462640E5 for ; Wed, 6 Aug 2014 16:58:10 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 3/6] Downgrade fatal to warning in linux_async Date: Wed, 6 Aug 2014 16:58:05 +0100 Message-Id: <1407340688-13721-4-git-send-email-gbenson@redhat.com> In-Reply-To: <1407340688-13721-1-git-send-email-gbenson@redhat.com> References: <1407340688-13721-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes This commit downgrades a fatal error to a warning in linux_async. linux_async is called from two different places in gdbserver: Via target_async from handle_accept_event. The argument is always zero, so The warning will never be printed here Via start_non_stop from handle_general_set. This prints its own error message to stderr on failure, which will be preceded by the warning if it is emitted. gdb/gdbserver/ 2014-08-06 Gary Benson * linux-low.c (linux_async): Replace fatal with warning. Tidy up and return. (linux_start_non_stop): Return -1 if linux_async failed. --- gdb/gdbserver/ChangeLog | 6 ++++++ gdb/gdbserver/linux-low.c | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletions(-) diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 4eaf2d2..819fcf2 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -5111,7 +5111,14 @@ linux_async (int enable) if (enable) { if (pipe (linux_event_pipe) == -1) - fatal ("creating event pipe failed."); + { + linux_event_pipe[0] = -1; + linux_event_pipe[1] = -1; + sigprocmask (SIG_UNBLOCK, &mask, NULL); + + warning ("creating event pipe failed."); + return previous; + } fcntl (linux_event_pipe[0], F_SETFL, O_NONBLOCK); fcntl (linux_event_pipe[1], F_SETFL, O_NONBLOCK); @@ -5144,6 +5151,10 @@ linux_start_non_stop (int nonstop) { /* Register or unregister from event-loop accordingly. */ linux_async (nonstop); + + if (target_is_async_p () != (nonstop != 0)) + return -1; + return 0; }