From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id D88D13857C51 for ; Wed, 24 Nov 2021 21:21:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D88D13857C51 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.95] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (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 57CEE1E940; Wed, 24 Nov 2021 16:21:27 -0500 (EST) Subject: Re: [PATCHv2 3/6] gdb: add asserts in target.c for target_async_permitted To: Andrew Burgess , gdb-patches@sourceware.org References: <3a174872995221e716715f74fc925d8140950398.1637756330.git.aburgess@redhat.com> From: Simon Marchi Message-ID: <73e29102-49f9-eeda-7d20-54306e0051bd@simark.ca> Date: Wed, 24 Nov 2021 16:21:27 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <3a174872995221e716715f74fc925d8140950398.1637756330.git.aburgess@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, 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: Wed, 24 Nov 2021 21:21:29 -0000 On 2021-11-24 7:22 a.m., Andrew Burgess via Gdb-patches wrote: > The target_async_permitted flag allows a user to override whether a > target can act in async mode or not. In previous commits I have moved > the checking of this flag out of the various ::can_async_p methods and > into the common target.c code. > > In this commit I will add some additional assertions into > target_is_async_p and target_async. The rules these assertions are > checking are: > > 1. A target that returns false for target_can_async_p should never > become "async enabled", and so ::is_async_p should always return > false. This is being checked in target_is_async_p. > > 2. GDB should never try to enable async mode for a target that > returns false for target_can_async_p, this is checked in > target_async. > > There are a few places where we call the ::is_async_p method directly, > in these cases we will obviously not pass through the assert in > target_is_async_p, however, there are also plenty of places where we > do call target_is_async_p so if GDB starts to misbehave we should > catch it quickly enough. Despite what I said in my v1 review, it would actually be nice to have a target_is_async_p wrapper like the new target_can_async_p wrapper, just to have the gdb_assert checked consistently. But I think it can be done later, to avoid having a v3 of this series just for a minor detail like that. The patch LGTM as-is. Simon