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.133.124]) by sourceware.org (Postfix) with ESMTPS id A144C3858C27 for ; Thu, 25 Nov 2021 10:05:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A144C3858C27 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-598-0hyeSp0tNaeZJfkUDWtR0w-1; Thu, 25 Nov 2021 05:05:02 -0500 X-MC-Unique: 0hyeSp0tNaeZJfkUDWtR0w-1 Received: by mail-wm1-f71.google.com with SMTP id g80-20020a1c2053000000b003331a764709so4687617wmg.2 for ; Thu, 25 Nov 2021 02:05:01 -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=El7ILSPdN5imrE7trhthR8L7cI+sG0WNPVuJY7wzKPQ=; b=Y/PVR9CAfbYru/R9X3RlH00Ye/xSebFX2tZbti9FFmz0mtWXwImoe/Y9W7pbpi4HoU 6Xb1lPFUq+S+R274rKPkLmnVHMnseG1F7hL3+ixF1u9Qs2nKf1t1he7/F7MOV1QHGL8L CBHel9geqmeI+yJQFk1FdGhvN9Ar514413ZxMDxTkkix0SYMPdavv7M1kpBgaSvBKcSH py4Cnl+JuNh+j0Z/eRmj6EgaLNh88+mFL2MIvUSXSjp1XqAuHezjX3g8ElKlKMb+qa3N IVmejE2UT643kKforPV0hx4ZJzrCeKjkbutXsd62sSjvLzP/DuyEYFFR+wavuWwu8o/J mqKA== X-Gm-Message-State: AOAM532E15sZWNGGq2NH8+Add3qHc44QcuG0P+M11UezNeSxdIdO59m2 uF4WRKQobm7elaW1+Sn509IYoVKbbiNo71CuSC6ucEJDJ8xiqPKQOO1il/dcqNBIkRsJ7/Pohda C/kRarTTUoy5nXCDhkL6cKQ== X-Received: by 2002:a1c:8002:: with SMTP id b2mr5693210wmd.2.1637834700671; Thu, 25 Nov 2021 02:05:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzln/Obmf/F9lZ10Y2gTlAojbEveN6syE/nl/w3EG3IqXAj+nE11U2Utm99vWY0nwlR5noJKA== X-Received: by 2002:a1c:8002:: with SMTP id b2mr5693186wmd.2.1637834700479; Thu, 25 Nov 2021 02:05:00 -0800 (PST) Received: from localhost (host86-166-129-255.range86-166.btcentralplus.com. [86.166.129.255]) by smtp.gmail.com with ESMTPSA id b197sm2452669wmb.24.2021.11.25.02.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 02:04:59 -0800 (PST) Date: Thu, 25 Nov 2021 10:04:58 +0000 From: Andrew Burgess To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Re: [PATCHv2 5/6] gdb: add assert in remote_target::wait relating to async being off Message-ID: <20211125100458.GP2662946@redhat.com> References: <87c0ccf934cb31c7c636dcf0198bf128f38f821f.1637756330.git.aburgess@redhat.com> <59090c91-2342-d338-ba2f-17d441e5c452@simark.ca> MIME-Version: 1.0 In-Reply-To: <59090c91-2342-d338-ba2f-17d441e5c452@simark.ca> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 10:03:36 up 5 days, 23:02, 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=-11.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: Thu, 25 Nov 2021 10:05:04 -0000 * Simon Marchi [2021-11-24 16:23:30 -0500]: > On 2021-11-24 7:22 a.m., 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 25a4d3cab6e..da8ed81ba78 100644 > > --- a/gdb/remote.c > > +++ b/gdb/remote.c > > @@ -8309,9 +8309,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; > > > > -- > > 2.25.4 > > > > LGTM. > > I think the series can be merged at least up to here, I think these are > good cleanups. Thanks, I made the change you suggested about one target_can_async_p function calling the other, and pushed patches 1 to 5. The final patch still pending. Thanks, Andrew