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 A04C6385842C for ; Thu, 25 Nov 2021 13:46:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A04C6385842C Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-567-HqGIOOugNBae_M_ausVAqQ-1; Thu, 25 Nov 2021 08:46:30 -0500 X-MC-Unique: HqGIOOugNBae_M_ausVAqQ-1 Received: by mail-wm1-f70.google.com with SMTP id c8-20020a7bc848000000b0033bf856f0easo5013750wml.1 for ; Thu, 25 Nov 2021 05:46:30 -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=Js9maMZNloONWDlF/s19FbSBreQTlEqkJ1n1XN+h2H0=; b=JWKdQNhYyw0gEh4P5VVy5D0+XYIfnFL/tWuZhsSI2F3NIr9MUlySMXPAqJ3U2OBXt4 DKZj57ss8O2+lubu02sMchcHFnzvQWnenq2kTbJob6TkxtqZL0GmbCaSH80sfWsqCUQf zVXMno3lKA8/tLHT7djhdPmpQ0ppLmjmBIhST0PFKV+oqFIXJAadBUIwnTEEbVI7w1Q7 OaZ/UF6pPfRsS/fXX3+OmsiNA3vezdoUv00kibUIYCrBevTqU8zx2PiUvprkn9DIgPFv SaZUVzpxqY6/TshCZZkiPU8sSXUICrdoh3LaWyjth6PRsJfR2vS0iLx/f/ClXKYaJiha rIyw== X-Gm-Message-State: AOAM531xRlyZSfpptoncUllmLERZvBT5FJQfzewPP2n1zrH+HVtGOxSh lEf0ZKgMHwizisT+y2J0OxTvKNnysA5zCJKXUNMXDzEJ4DgW8ONHVMiDutR5JloHYp0vWzEhCW5 1CfSLRfNWfGzcyUMxqX+CZw== X-Received: by 2002:adf:cd89:: with SMTP id q9mr6616323wrj.205.1637847989059; Thu, 25 Nov 2021 05:46:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyeYP22kzku0HHyXuiuG3N9xQ4u9GCIM4DqBWx5wtlcL1AJXGNXjUB2CfnHFxbQyv4AeGyoQ== X-Received: by 2002:adf:cd89:: with SMTP id q9mr6616284wrj.205.1637847988830; Thu, 25 Nov 2021 05:46:28 -0800 (PST) Received: from localhost (host86-166-129-255.range86-166.btcentralplus.com. [86.166.129.255]) by smtp.gmail.com with ESMTPSA id bg34sm6477035wmb.47.2021.11.25.05.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 05:46:28 -0800 (PST) Date: Thu, 25 Nov 2021 13:46:27 +0000 From: Andrew Burgess To: Tom de Vries Cc: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCHv2 5/6] gdb: add assert in remote_target::wait relating to async being off Message-ID: <20211125134627.GT2662946@redhat.com> References: <87c0ccf934cb31c7c636dcf0198bf128f38f821f.1637756330.git.aburgess@redhat.com> <59090c91-2342-d338-ba2f-17d441e5c452@simark.ca> <20211125100458.GP2662946@redhat.com> <98256892-d0a7-1332-cefe-2704e702179b@suse.de> MIME-Version: 1.0 In-Reply-To: <98256892-d0a7-1332-cefe-2704e702179b@suse.de> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 13:45:20 up 6 days, 2:43, 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.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_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, 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: Thu, 25 Nov 2021 13:46:35 -0000 * Tom de Vries [2021-11-25 12:36:07 +0100]: > On 11/25/21 11:04 AM, Andrew Burgess via Gdb-patches wrote: > > * 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. > > > > I'm running into the assert: > https://sourceware.org/bugzilla/show_bug.cgi?id=28627 . Sorry about that. I've reverted this patch, and closed the bug. The cause of the assert is fixed by patch #6 in this series, so I guess I'll remerge this patch after patch #6 lands. Thanks, Andrew