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 C6590385841B for ; Tue, 23 Nov 2021 21:31:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C6590385841B 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 66A551EDF0; Tue, 23 Nov 2021 16:31:55 -0500 (EST) Subject: Re: [PATCH 1/4] gdb: add asserts in target.c for target_async_permitted To: Andrew Burgess , gdb-patches@sourceware.org References: <0e15e93ed36baa678af2d11771fd6bf7f5227897.1637676250.git.aburgess@redhat.com> From: Simon Marchi Message-ID: <2bff97ad-6bc6-8c62-ebd2-ef6463c94080@simark.ca> Date: Tue, 23 Nov 2021 16:31:55 -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: <0e15e93ed36baa678af2d11771fd6bf7f5227897.1637676250.git.aburgess@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.8 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: Tue, 23 Nov 2021 21:31:57 -0000 On 2021-11-23 9:08 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. Ideally we would check this flag > in target_can_async_p and target_is_async_p, however, there are a few > places in GDB where we call the can_async_p and is_async_p methods > directly without calling through the target_* wrapper. Off-hand, I would ask: is it correct for these places to call the target methods directly? Should we fix them? Looking up these spots, I see that they are places where we call can_async_p on targets possibly before they are pushed, like in run_one_inferior, so we can't use the target_ wrapper there. I wouldn't hate it if the targets themselves didn't have to check target_async_permitted. For example, linux_nat_target::can_async_p would simply return true. And the spots mentioned above could be changed from: int async_p = mi_async && run_target->can_async_p (); to use a new wrapper overload: int async_p = mi_async && target_can_async_p (run_target); That new wrapper would check target_async_permitted. I don't think that is_async_p needs the same treatment: if we never make a target async because target_async_permitted is false, then is_async_p will always return false. Simon