From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 512C53858D1E for ; Fri, 8 Sep 2023 15:35:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 512C53858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 388FZHl0015293 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 8 Sep 2023 11:35:22 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 388FZHl0015293 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1694187322; bh=+mWqFGd0u7JsdJoMRLTJASROuEcyMmUq7OBfk8dLc3s=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Ar7cxxuCbBubraocLSxnavp7ihnUKwSOhPfwj64+mq6cB0m27Mv1LM0Yy3d7cdI1v 44j9s8Nl+jTZOVte2cHlZwWBptdHEHOsocQ4KYpf9PUa8leuaJD++OeEISU3r0E6F1 rm6D4CFzkCPa9AbbciMMAoeTMfhIhGaWP9V24ZHg= 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 9A2341E092; Fri, 8 Sep 2023 11:35:16 -0400 (EDT) Message-ID: <770bbc82-3823-42e8-aabf-cec185c8c6ca@polymtl.ca> Date: Fri, 8 Sep 2023 11:35:16 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 06/16] [gdbserver/aarch64] refactor: Adjust expedited registers dynamically Content-Language: fr To: Luis Machado , gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org References: <20230907152018.1031257-1-luis.machado@arm.com> <20230907152018.1031257-7-luis.machado@arm.com> From: Simon Marchi In-Reply-To: <20230907152018.1031257-7-luis.machado@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 8 Sep 2023 15:35:17 +0000 X-Spam-Status: No, score=-3037.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 9/7/23 11:20, Luis Machado via Gdb-patches wrote: > Instead of using static arrays, build the list of expedited registers > dynamically using a std::vector. > > This refactor shouldn't cause any user-visible changes. > > Regression-tested for aarch64-linux Ubuntu 22.04/20.04. > --- > gdbserver/linux-aarch64-tdesc.cc | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/gdbserver/linux-aarch64-tdesc.cc b/gdbserver/linux-aarch64-tdesc.cc > index 633134955e5..3c60e1a4db0 100644 > --- a/gdbserver/linux-aarch64-tdesc.cc > +++ b/gdbserver/linux-aarch64-tdesc.cc > @@ -30,6 +30,8 @@ > /* All possible aarch64 target descriptors. */ > static std::unordered_map tdesc_aarch64_map; > > +static std::vector expedited_registers; > + > /* Create the aarch64 target description. */ > > const target_desc * > @@ -44,15 +46,20 @@ aarch64_linux_read_description (const aarch64_features &features) > if (tdesc == NULL) > { > tdesc = aarch64_create_target_description (features); > + expedited_registers.clear (); > + > + /* Configure the expedited registers. By default we include x29, sp and > + pc. */ > + expedited_registers.push_back ("x29"); > + expedited_registers.push_back ("sp"); > + expedited_registers.push_back ("pc"); > + > + if (features.vq > 0) > + expedited_registers.push_back ("vg"); > > - static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL }; > - static const char *expedite_regs_aarch64_sve[] = { "x29", "sp", "pc", > - "vg", NULL }; > + expedited_registers.push_back (nullptr); > > - if (features.vq == 0) > - init_target_desc (tdesc, expedite_regs_aarch64); > - else > - init_target_desc (tdesc, expedite_regs_aarch64_sve); > + init_target_desc (tdesc, (const char **) expedited_registers.data ()); It seems weird to have a single std::vector instance. What happens if multiple target descriptions are created? Won't the second mess up the data of the first one? Simon