From patchwork Mon Jan 26 17:19:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 4821 Received: (qmail 24664 invoked by alias); 26 Jan 2015 17:19:39 -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 24479 invoked by uid 89); 26 Jan 2015 17:19:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, SPF_HELO_PASS, T_RP_MATCHES_RCVD 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; Mon, 26 Jan 2015 17:19:24 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0QHJLmG031268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 26 Jan 2015 12:19:22 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0QHJJ1j011197 for ; Mon, 26 Jan 2015 12:19:21 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 1/3] Fix up some target is-async vs can-async confusions Date: Mon, 26 Jan 2015 17:19:17 +0000 Message-Id: <1422292759-22307-2-git-send-email-palves@redhat.com> In-Reply-To: <1422292759-22307-1-git-send-email-palves@redhat.com> References: <1422292759-22307-1-git-send-email-palves@redhat.com> In all these cases we're interested in whether the target is currently async, with its event sources installed in the event loop, not whether it can async if needed. Also, I'm not seeing the point of the target_async call from within linux_nat_wait. That's normally done on resume instead, which this target already does. Tested on x86_64 Fedora 20, native and gdbserver. gdb/ 2015-01-26 Pedro Alves * linux-nat.c (linux_child_follow_fork, linux_nat_wait_1): Use target_is_async_p instead of target_can_async. (linux_nat_wait): Use target_is_async_p instead of target_can_async. Don't enable async here. * remote.c (interrupt_query, remote_wait, putpkt_binary): Use target_is_async_p instead of target_can_async. --- gdb/linux-nat.c | 16 ++++++---------- gdb/remote.c | 6 +++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index b49cd57..b4893d44 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -520,7 +520,7 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child, /* If we're in async mode, need to tell the event loop there's something here to process. */ - if (target_can_async_p ()) + if (target_is_async_p ()) async_file_mark (); } } @@ -3222,7 +3222,7 @@ linux_nat_wait_1 (struct target_ops *ops, target_pid_to_str (lp->ptid)); } - if (!target_can_async_p ()) + if (!target_is_async_p ()) { /* Causes SIGINT to be passed on to the attached process. */ set_sigint_trap (); @@ -3293,7 +3293,7 @@ linux_nat_wait_1 (struct target_ops *ops, ourstatus->kind = TARGET_WAITKIND_NO_RESUMED; - if (!target_can_async_p ()) + if (!target_is_async_p ()) clear_sigint_trap (); restore_child_signals_mask (&prev_mask); @@ -3321,7 +3321,7 @@ linux_nat_wait_1 (struct target_ops *ops, sigsuspend (&suspend_mask); } - if (!target_can_async_p ()) + if (!target_is_async_p ()) clear_sigint_trap (); gdb_assert (lp); @@ -3479,7 +3479,7 @@ linux_nat_wait (struct target_ops *ops, } /* Flush the async file first. */ - if (target_can_async_p ()) + if (target_is_async_p ()) async_file_flush (); /* Resume LWPs that are currently stopped without any pending status @@ -3497,16 +3497,12 @@ linux_nat_wait (struct target_ops *ops, /* If we requested any event, and something came out, assume there may be more. If we requested a specific lwp or process, also assume there may be more. */ - if (target_can_async_p () + if (target_is_async_p () && ((ourstatus->kind != TARGET_WAITKIND_IGNORE && ourstatus->kind != TARGET_WAITKIND_NO_RESUMED) || !ptid_equal (ptid, minus_one_ptid))) async_file_mark (); - /* Get ready for the next event. */ - if (target_can_async_p ()) - target_async (inferior_event_handler, 0); - return event_ptid; } diff --git a/gdb/remote.c b/gdb/remote.c index c4d09ba..9be15cb 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -5079,7 +5079,7 @@ interrupt_query (void) { target_terminal_ours (); - if (target_can_async_p ()) + if (target_is_async_p ()) { signal (SIGINT, handle_sigint); quit (); @@ -6036,7 +6036,7 @@ remote_wait (struct target_ops *ops, else event_ptid = remote_wait_as (ptid, status, options); - if (target_can_async_p ()) + if (target_is_async_p ()) { /* If there are are events left in the queue tell the event loop to return here. */ @@ -7226,7 +7226,7 @@ putpkt_binary (const char *buf, int cnt) case it's not possible to issue a command while the target is running. This is not a problem in non-stop mode, because in that case, the stub is always ready to process serial input. */ - if (!non_stop && target_can_async_p () && rs->waiting_for_stop_reply) + if (!non_stop && target_is_async_p () && rs->waiting_for_stop_reply) { error (_("Cannot execute this command while the target is running.\n" "Use the \"interrupt\" command to stop the target\n"