From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 47C183858D28 for ; Thu, 25 Nov 2021 11:36:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 47C183858D28 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6D88121954; Thu, 25 Nov 2021 11:36:08 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5347A13BD2; Thu, 25 Nov 2021 11:36:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id vfaVEih1n2FqYwAAMHmgww (envelope-from ); Thu, 25 Nov 2021 11:36:08 +0000 Subject: Re: [PATCHv2 5/6] gdb: add assert in remote_target::wait relating to async being off To: Andrew Burgess , Simon Marchi Cc: gdb-patches@sourceware.org References: <87c0ccf934cb31c7c636dcf0198bf128f38f821f.1637756330.git.aburgess@redhat.com> <59090c91-2342-d338-ba2f-17d441e5c452@simark.ca> <20211125100458.GP2662946@redhat.com> From: Tom de Vries Message-ID: <98256892-d0a7-1332-cefe-2704e702179b@suse.de> Date: Thu, 25 Nov 2021 12:36:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211125100458.GP2662946@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, 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 11:36:11 -0000 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 . Thanks, - Tom > The final patch still pending. > > Thanks, > Andrew >