From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id D105C385843D for ; Sat, 18 Dec 2021 10:21:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D105C385843D Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-249-zxs04dYgPJywMBpWcfeiDw-1; Sat, 18 Dec 2021 05:21:26 -0500 X-MC-Unique: zxs04dYgPJywMBpWcfeiDw-1 Received: by mail-ed1-f71.google.com with SMTP id y17-20020a056402271100b003f7ef5ca612so3908631edd.17 for ; Sat, 18 Dec 2021 02:21:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dnT3w5ECfjc8W+FJJRvnuK8KGEsTxk7pW/Bicoq9guw=; b=A/iAI9hR/rgructj8qUPGEYT+hSgMf/xejondPSiDbZUDkwlK+Y3uc2KWUjRJKm4yU gCDMH6AtN1NSJQ2ntiEzapxZUEtb/s6J4oYeNWU1FtJYL62PeNO0j/dBVG4lmZawJ0F8 X2gKhAgbcFHDqveDdggTWvcsyDb5TaZqNx+IoRr+jvtVJuBS1fy5gru3VH5PyADRYLf8 Bvlj5Ig8kMcx3Pi2afeRKgAcyIlK7w2SBiAAp10VaKqNJN9wi/G/WxHky9wp46Y/vQHH qn3rwDKSTPAYiHKDZxepfnMQwkUltDSaIIlz1bCDzmU707I8+87qCpTfRkwLp0gwAKKG 7zSg== X-Gm-Message-State: AOAM531ZRbSIKtTh6nyVYRvMyRFuxNEkg8xrGaqr8dsy0Ierykysn5+C 6dfZSIVrwtbokPD34wMRH2mw+8GRC/XY3Ku8LZx+XiU1JdYP5lay6tF0THFUhnPglyFFr7vdsXM 92AaxpAoDKnb70p+O70wbtQ== X-Received: by 2002:a17:907:20f9:: with SMTP id rh25mr5642756ejb.209.1639822884820; Sat, 18 Dec 2021 02:21:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxz/ZxbdJrLzlH0ANpqPKnhn3qHhdSv8GOPhhhLr9QtDuM7SOkxNUXYOz0SWDRAmuaqdnvPzA== X-Received: by 2002:a17:907:20f9:: with SMTP id rh25mr5642749ejb.209.1639822884629; Sat, 18 Dec 2021 02:21:24 -0800 (PST) Received: from localhost (92.40.179.220.threembb.co.uk. [92.40.179.220]) by smtp.gmail.com with ESMTPSA id sd39sm292392ejc.14.2021.12.18.02.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Dec 2021 02:21:24 -0800 (PST) Date: Sat, 18 Dec 2021 10:21:23 +0000 From: Andrew Burgess To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCHv3 2/2] gdb: add assert in remote_target::wait relating to async being off Message-ID: <20211218102123.GB2634@redhat.com> References: <11fcb8c237803345a615a356b5ca240c7a137926.1638354426.git.aburgess@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 10:21:11 up 9 min, 1 X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Sat, 18 Dec 2021 10:21:29 -0000 * Pedro Alves [2021-12-16 21:16:00 +0000]: > On 2021-12-01 10:40, Andrew Burgess via Gdb-patches wrote: > > While working on another patch I ended up in a situation where I had > > async mode disabled (with 'maint set target-async off'), but the async > > event token got marked anyway. > > > > In this situation GDB was continually calling into > > remote_target::wait, however, the async token would never become > > unmarked as the unmarking is guarded by target_is_async_p. > > > > We could just unconditionally unmark the token, but that would feel > > like just ignoring a bug, so, instead, lets assert that if > > !target_is_async_p, then the async token should not be marked. > > > > This assertion would have caught my earlier mistake. > > > > There should be no user visible changes with this commit. > > --- > > gdb/remote.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/gdb/remote.c b/gdb/remote.c > > index b3890d71c59..9b814d54313 100644 > > --- a/gdb/remote.c > > +++ b/gdb/remote.c > > @@ -8295,9 +8295,13 @@ remote_target::wait (ptid_t ptid, struct target_waitstatus *status, > > remote_state *rs = get_remote_state (); > > > > /* Start by clearing the flag that asks for our wait method to be called, > > - we'll mark it again at the end if needed. */ > > + we'll mark it again at the end if needed. If the target is not in > > + async mode then the async token should not be marked. */ > > if (target_is_async_p ()) > > clear_async_event_handler (rs->remote_async_inferior_event_token); > > + else > > + gdb_assert (!async_event_handler_marked > > + (rs->remote_async_inferior_event_token)); > > > > ptid_t event_ptid; > > > > LGTM. Thanks, pushed. Andrew