From patchwork Mon Oct 19 13:21:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Machado X-Patchwork-Id: 9226 Received: (qmail 3178 invoked by alias); 19 Oct 2015 13:22:07 -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 3151 invoked by uid 89); 19 Oct 2015 13:22:06 -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, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Oct 2015 13:22:04 +0000 Received: from svr-orw-fem-05.mgc.mentorg.com ([147.34.97.43]) by relay1.mentorg.com with esmtp id 1ZoAO1-000045-D2 from Luis_Gustavo@mentor.com ; Mon, 19 Oct 2015 06:22:01 -0700 Received: from [172.30.0.74] (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.3.224.2; Mon, 19 Oct 2015 06:22:00 -0700 Reply-To: Luis Machado Subject: Re: [PATCH] Make GDB wait for events after handling target File-I/O References: <1440723498-19075-1-git-send-email-lgustavo@codesourcery.com> <55F17EC8.5010906@redhat.com> <5621505F.8080506@codesourcery.com> <5624B633.7030102@redhat.com> To: Pedro Alves , From: Luis Machado Message-ID: <5624EE71.4070403@codesourcery.com> Date: Mon, 19 Oct 2015 11:21:53 -0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5624B633.7030102@redhat.com> X-IsSubscribed: yes On 10/19/2015 07:21 AM, Pedro Alves wrote: > On 10/16/2015 08:30 PM, Luis Machado wrote: > >> How does the attached update look? > > Is there a reason to keep the "rs->waiting_for_stop_reply = 1;" lines? No, that was a mistake since we inverted the logic. What about the following? Now we'll only set rs->waiting_for_stop_reply to 1 when resuming in "all-stop" mode. 2015-10-19 Luis Machado * remote.c (remote_wait_as): Set rs->waiting_for_stop_reply to 0 when handling 'E', 'T', 'S', 'X' and 'W' packets. Do not set rs->waiting_for_stop_reply back to 1. --- gdb/remote.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index f40f791..fed397a 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6635,9 +6635,6 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) rs->stop_reason = TARGET_STOPPED_BY_NO_REASON; - /* We got something. */ - rs->waiting_for_stop_reply = 0; - /* Assume that the target has acknowledged Ctrl-C unless we receive an 'F' or 'O' packet. */ if (buf[0] != 'F' && buf[0] != 'O') @@ -6648,6 +6645,8 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) case 'E': /* Error of some sort. */ /* We're out of sync with the target now. Did it continue or not? Not is more likely, so report a stop. */ + rs->waiting_for_stop_reply = 0; + warning (_("Remote failure reply: %s"), buf); status->kind = TARGET_WAITKIND_STOPPED; status->value.sig = GDB_SIGNAL_0; @@ -6658,7 +6657,12 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) break; case 'T': case 'S': case 'X': case 'W': { - struct stop_reply *stop_reply + struct stop_reply *stop_reply; + + /* There is a stop reply to handle. */ + rs->waiting_for_stop_reply = 0; + + stop_reply = (struct stop_reply *) remote_notif_parse (¬if_client_stop, rs->buf); @@ -6667,10 +6671,6 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) } case 'O': /* Console output. */ remote_console_output (buf + 1); - - /* The target didn't really stop; keep waiting. */ - rs->waiting_for_stop_reply = 1; - break; case '\0': if (rs->last_sent_signal != GDB_SIGNAL_0) @@ -6686,17 +6686,11 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) strcpy ((char *) buf, rs->last_sent_step ? "s" : "c"); putpkt ((char *) buf); - - /* We just told the target to resume, so a stop reply is in - order. */ - rs->waiting_for_stop_reply = 1; break; } /* else fallthrough */ default: warning (_("Invalid remote reply: %s"), buf); - /* Keep waiting. */ - rs->waiting_for_stop_reply = 1; break; } -- 1.9.1