From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WDRGBTychGXp/CYAWB0awg (envelope-from ) for ; Thu, 21 Dec 2023 15:12:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1703189564; bh=AzAOTnR+K0xMoJ+w3YySLnbqVYVY23Q/OkqBDP8/IyM=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pUypLbL4Wxht1E6TU8OyUKfZljZN5I9YQcmalMZbCgpYPgLhv2WzDxqk1cK4g47n7 PoKRBkSSg6YhVFBz42WWAp1T9WxMcziWIg8OenmEnWkPSq1qXu+M26CXP5MX4Rl8tP 0AbGD9JUkauKXmsR/Ndut1DCo+jbwq/Av5iTC270= Received: by simark.ca (Postfix, from userid 112) id 129C61E0C3; Thu, 21 Dec 2023 15:12:44 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=mWyF/o/o; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 018D01E0AC for ; Thu, 21 Dec 2023 15:12:42 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8EE3538708C9 for ; Thu, 21 Dec 2023 20:12:41 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 288AE3858C2A for ; Thu, 21 Dec 2023 20:12:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 288AE3858C2A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 288AE3858C2A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703189551; cv=none; b=KobQ+gIiFkGRZC3Rcntc2InYgn+qzEAt4ra8H2IcxHfRp4W0+VLXx/31lJwsbUUHVn9mrshviVpbP6Tjxxfz7CEcnAoZ/AkSSU30yN8VEcXD/SeFN3BeapkT9q+gggMT29guY03sSMzSo5whJaHAyf74hXpgy56AaxE3s6D2Gps= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703189551; c=relaxed/simple; bh=AzAOTnR+K0xMoJ+w3YySLnbqVYVY23Q/OkqBDP8/IyM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=FY8TkN9g0w+fv1j8bsElXBbQQgRS17o62Co5GnwZKRq3q7Dgk1RK5iLIomEBLD/qxDExocGVadxfjXR3j0G1JAATV63a6iqMS+hsxUAGY6bda95AW7mYj5FZ5kIIH/Pj7BxaTBElq8vsRb27ViqqayaW0ozFXm8Uq9x79rIQCXU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1703189549; bh=AzAOTnR+K0xMoJ+w3YySLnbqVYVY23Q/OkqBDP8/IyM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=mWyF/o/oqthi6KPSx3wTyoyawXyaD385uNhx3Vt9s0IMTMn0Ux1gzNjOSk372nKmN DQfWDJikvwjqCMO5H1f9g7EF8n35J5QaD+f0glivMKG75xaJ1m1lal3C36q3rmiRy3 FVGVi468+dJnXW5O2Q7cwz/ot7+e9stWMIsdGAOk= Received: from [172.16.0.192] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id C9D8F1E0AC; Thu, 21 Dec 2023 15:12:29 -0500 (EST) Message-ID: <7d3747db-3dc8-4002-8bda-e4c6ae3e3dc8@simark.ca> Date: Thu, 21 Dec 2023 15:12:29 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 01/26] gdbserver: convert init_register_cache into regcache::initialize Content-Language: fr To: Tankut Baris Aktemur , gdb-patches@sourceware.org References: <696f1910a4f60993f28541e1a6e41be9f65f6a20.1677582744.git.tankut.baris.aktemur@intel.com> From: Simon Marchi In-Reply-To: <696f1910a4f60993f28541e1a6e41be9f65f6a20.1677582744.git.tankut.baris.aktemur@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org On 2/28/23 06:27, Tankut Baris Aktemur via Gdb-patches wrote: > This is a refactoring that converts the `init_register_cache` function > to a method of the regcache struct. During this conversion, we also > change the return type to void. I think this is fine. However, with a bit more effort, I think this could actually become a constructor, which would be nicer than having to call an initialize function. The only more "tricky" spot would be the use of regcache in fast_tracepoint_ctx. I think you could replace the regcache_initted and regcache fields with an std::optional. When instantiating the regcache, you would emplace the optional, which would call the constructor at that point. fast_tracepoint_ctx is only ever allocated as a local variable in gdb_collect, so using a gdb::optional there should be fine. Another improvement to try (for a subsequent patch) would be to pass an array_view to the initialize method (or constructor), and assert that the register size described by the tdesc matches the size of the buffer array_view passed. Simon