From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id A80043854817 for ; Thu, 4 Feb 2021 18:34:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A80043854817 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 114IY534025013 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 4 Feb 2021 13:34:09 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 114IY534025013 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id D830C1E945; Thu, 4 Feb 2021 13:34:04 -0500 (EST) Subject: Re: [PATCH 2/4] gdb: make remote target clear its async event handler in wait To: Pedro Alves , Simon Marchi , gdb-patches@sourceware.org References: <20201130165251.830482-1-simon.marchi@efficios.com> <20201130165251.830482-3-simon.marchi@efficios.com> From: Simon Marchi Message-ID: Date: Thu, 4 Feb 2021 13:34:04 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 4 Feb 2021 18:34:05 +0000 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 18:34:14 -0000 On 2021-02-04 1:00 p.m., Pedro Alves wrote: > On 30/11/20 16:52, Simon Marchi via Gdb-patches wrote: > >> However, the code in remote_async_inferior_event_handler checks for for > > s/for for/for/ > >> pending events in addition to whether the stop reply queue is empty, so >> I've made remote_target::wait check for that as well. I'm not >> completely sure this is ok, since I don't understand very well yet how >> the pending events mechanism works. But I figured it was safer to do >> this in order to avoid missing events, worst case it just leads to >> unnecessary calls to remote_target::wait. > > It won't hurt, but I think it shouldn't be necessary -- if putpkt_binary or > getpkt_or_notif_sane_1 see a notification (search for '%'), we end up in > handle_notification, which marks state->get_pending_events_token, which > then leads us to: > > -> remote_async_get_pending_events_handler > -> remote_notif_get_pending_events > -> remote_notif_stop_ack > -> remote_target::push_stop_reply > -> mark_async_event_handler (rs->remote_async_inferior_event_token); > > which then ends up in target_target::wait. > > I don't recall exactly why I had to put the check for the pending > event in remote_async_inferior_event_handler, though. Maybe it was > necessary because events auto-cleared back then. Ok, I'll push this patch it as-is then, but look into simplifying the code as another patch. > Anyhow, this LGTM. Patches #3 and #4 LGTM too. Thanks, will push. Simon