From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WsehDCg+HGB6BwAAWB0awg (envelope-from ) for ; Thu, 04 Feb 2021 13:34:16 -0500 Received: by simark.ca (Postfix, from userid 112) id 1CBD61EFCB; Thu, 4 Feb 2021 13:34:16 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 9A27D1E945 for ; Thu, 4 Feb 2021 13:34:15 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F14D7383543B; Thu, 4 Feb 2021 18:34:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F14D7383543B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612463655; bh=YcoS+oAv9OjfPHVOCntGir1yZlkJvD237sgGh1+BrYo=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=UgWCCmK6NpTkeTAUuNYSALEDvDH3Y0usZqSffZVRHaft/VWYpCQZU9j4iwe5EC30/ kyVxoQX/jn6U/1O4W4wYSkJj9FoacLS1rWWWsO0nvf1w14jt/rOM4oKiQbHYhBUk8Q WlVzeNVujgTK5jY8SrhIfc5d1nY2UFh3fVof8OfQ= 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> 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-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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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