From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id A5Y0BQBT7WKwWiEAWB0awg (envelope-from ) for ; Fri, 05 Aug 2022 13:27:28 -0400 Received: by simark.ca (Postfix, from userid 112) id 081111EA05; Fri, 5 Aug 2022 13:27:28 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=KpVpR8xH; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 304E31EA03 for ; Fri, 5 Aug 2022 13:27:24 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B17763857C50 for ; Fri, 5 Aug 2022 17:27:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B17763857C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659720443; bh=t7WgMmOcncPMWhRUtXSegAg+Ymh3uuwwQmhO7SB3jGM=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=KpVpR8xH8GGDOmZZkZUaQjxos+fO3Ie+GAckGtssYamWwH/Ugar8kNRXwq/rDx78R PCKvKPBe8G1Z7NopMFz7UbvNiKwjCuRGipL4b7xPr1hLg1iCgcjY4xvppfkNVIwV4v vt7GFgNbbSxC67nAIf4fJHlulV1q6jOt3NGbN/Do= Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50063.outbound.protection.outlook.com [40.107.5.63]) by sourceware.org (Postfix) with ESMTPS id 0A4863858294 for ; Fri, 5 Aug 2022 17:27:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0A4863858294 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=dsrZKdVkzLGoTXtGF/p0Wcp5qUcn2jGz0A6GUY9WTRna3daAN6m9juxqGFV7ExXyd6nZVaraGVMczTVoZ0T4qD1GELPKbKMWG/PwDkpdM2T64TyObeOint5UGDjbiG+nLj4oyAeswW16eNzl/FN4cTWgRN+BiweirVGJ4/ZYFTtiAnkS3+8b37JaUkTu46SudVP1eWlxhQNwRuuQV4YhdCJObGaCmSx7gC+Mb1RTxCkK9v27h9dpp/yhpPuVG05u5IjZ8QSBnKi8rDBsNsQWsrAHqNziABWT8ULZA+rdemg1A0QhCQEpZbRMbJax0ifIEV+e3F55Ml34pJ5Y8viiRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=t7WgMmOcncPMWhRUtXSegAg+Ymh3uuwwQmhO7SB3jGM=; b=BNjVf/5FNtkIIc2/jkdA9b1Ir9z0+hNj15Oz4XxSCLD1yaUKc6zdZyZayz5lJlB0HbEdFwamZZ1Nx1E712EraJhQ61bwWWEWKheSISkZ57C/QAQp3kZLfd3I09uFyavzMnUCeU9fKqdM2pT9GES2LXZgVJcyGsFJfcMEwDoWaGMe8t/SdYrxzNwdqbVRc+A4kgrAer8CNcen01A2Kg8kS6O6WUqgGshBMGXb983P828Vq6yE6+hgWvUUv98nNv0dBg+Vt1U3hUnhBSrjuUxFVyJ5ktoDUuXWGgXj427f8DdPAQGUztDFm1fR4ggw0ktu5SN8fNbaF8cJoqMzs3IUNA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from AM7PR02CA0006.eurprd02.prod.outlook.com (2603:10a6:20b:100::16) by PR2PR08MB4745.eurprd08.prod.outlook.com (2603:10a6:101:1a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Fri, 5 Aug 2022 17:26:59 +0000 Received: from VE1EUR03FT007.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:100:cafe::3e) by AM7PR02CA0006.outlook.office365.com (2603:10a6:20b:100::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16 via Frontend Transport; Fri, 5 Aug 2022 17:26:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT007.mail.protection.outlook.com (10.152.18.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16 via Frontend Transport; Fri, 5 Aug 2022 17:26:58 +0000 Received: ("Tessian outbound 6a3290ff1310:v123"); Fri, 05 Aug 2022 17:26:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 2e4b0391a78b3a4e X-CR-MTA-TID: 64aa7808 Received: from 1862ffd0b94f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D58D3332-AEAF-4763-9A37-96414E030C1C.1; Fri, 05 Aug 2022 17:26:51 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1862ffd0b94f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 05 Aug 2022 17:26:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nz2N9ikYi/ERCCNmklJhgJFSNuDONzvdZFrFlN/RUPLNOB6CJKFPii/Xj1E8wFddOrKJie7nsTDzvOZplzQv4n6GSCqYeHw47e9ARCe0zTu/aEfcsAuOEd+vyoKQXnESc+WWsDbIJ8Q+r2KiUnhQjP9vojcIpV0FWsx37t5ODtCX6LbKyXR479wqdnPw0BH/SQKC9L3i6IzzWjMZmFNjGctDEaaKPUi12Hwd8PkMRlG1cHZkKI7BIuqHNLwURo3LeJCuMyl+dwplJMP8tjjyF3SZRPEwh1aI7wm7MC1iLaWZGoW4Xgareth0Y4yoctqF+vc8HZxhx6VYnuy8HynxmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=t7WgMmOcncPMWhRUtXSegAg+Ymh3uuwwQmhO7SB3jGM=; b=FxoxtrtuQP3Hv1scf8nDSG+/G+c6NL+aRQ/FoVe6qUZXW9lYzlZBr/x3/jQs+JB1DpANQLhQwYqIsl25yMb2OVw8JxWBuGx0wa0A++ejxhB3Z668DyOReKp99WHwmUEwXqa5HG015VyXY+Z9tneSlPTLJrf5RCqOOkH86ldVXqqIF0PiiEgSHfK+B5jSH6diNwlrXyI0fOQGOWt2Pkn8roNNRybSH3mG4MD7Gm+Cx6hh6wmq4mNaspauNCHW/IOGXEZ8vOOrWvbaOEkbGvOmW96xt9dKLiZtAKC4PkOefznaPZJheLY70S+IdV7VOqW6c2Ecdt+fJ9psfFH0BuAEvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by AM6PR08MB5255.eurprd08.prod.outlook.com (2603:10a6:20b:ef::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.14; Fri, 5 Aug 2022 17:26:48 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::cc64:9170:b12d:de8]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::cc64:9170:b12d:de8%4]) with mapi id 15.20.5504.014; Fri, 5 Aug 2022 17:26:48 +0000 Message-ID: Date: Fri, 5 Aug 2022 18:26:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2 1/2] gdb/aarch64: Fix thread's gdbarch when SVE vector length changes Content-Language: en-US To: Thiago Jung Bauermann , gdb-patches@sourceware.org References: <20220805004648.111358-1-thiago.bauermann@linaro.org> <20220805004648.111358-2-thiago.bauermann@linaro.org> In-Reply-To: <20220805004648.111358-2-thiago.bauermann@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P265CA0220.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:33a::18) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 46dd36b9-17ed-4a10-92e9-08da7707b3c9 X-MS-TrafficTypeDiagnostic: AM6PR08MB5255:EE_|VE1EUR03FT007:EE_|PR2PR08MB4745:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: vbQCTG3fOIxce8pxzet9rFyM0qwa6DugBrpYoCC4aos9V54BKjH6KUL7M+7kas0Sy8QASzNfM7N2epUdce8QsctB7FjlGdnmYZyVGLdT790hUuseEVBrSbwmbs10qTlXQ2P3LADHJ0Gt2sGQOuapSRv4uB88VUkczbxzhn7sNmRJ5sFS1RJO2QRROrBtxB13wpXqRA47xahWSzq5QfQ7ICr8nTnLkI+eojyUrJmGS8d1PC/UlWgsBHgaAfODI8eV6akdAkEZjuafdeRkkHpXGj3FnpJoa5vygmMhG4e6nLI+1Gc3DIqfpG4cH0ffatbC8+N1HolofRoKoPJGnOc3iVFNZ1mvF+wQT03MPz1M2grgR572DhBOHZWp7IYIFxamRbb4tJUsUgI8TT4fsla910ecfCl9gpK6GokbfLKC4nM2Csc2O4ERUkIwDel06RIw3pF/pwkoKJPB1XQ36fZQ7DGObT0XSzIz8mpdYLiX1Xj04NkE9Qc0c0j0EgxD+C+CJXZ/g806UF/ASooD/LvfN2eYx/MUkZYHwpm5frpvh8O9HpjMNkDD9EzsogBpS8Dyu3gS46eOZwh2GM8aGqS2QwDUSwDi3XyfNYFmTUY6cSdFl7+/lkhd0qjUTeGij7d37VLT+45bcEjDU7RBaorjDOw5y/0M0a10IYrnnpe4kL81vCPaVYqHkenZH0V8V95QyuA2Z1AvAbB/fkG7XM8pGPoC4kwpI11TMa1iTF2J/Ou8qDap4nIGXxYnKWvZRBe3d0d2GeI+XUH9wMS/oQnkOmI2gd7bTzcTbjy3i38SkfeCSOlCVxmD1vSHPLeUJexWX3aUc7haFK/afUU07lblDA== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB3919.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(136003)(376002)(39860400002)(396003)(366004)(346002)(26005)(31696002)(6512007)(41300700001)(86362001)(6506007)(316002)(6486002)(53546011)(478600001)(38100700002)(186003)(2616005)(83380400001)(66556008)(2906002)(66946007)(66476007)(36756003)(8936002)(44832011)(8676002)(31686004)(5660300002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5255 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT007.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 5c957cdb-ce14-40b7-488f-08da7707ad63 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gDxfOk6mQSrZo4x+0msL8eD26bxtPHU/7kxMflXEKuylZ/rV8BPouS96QuDQlxpMy1u4ghzX1gP2PhcGz0yygtFy7NOfgN7N75WRn1i1k1N8yQ1YayMBlVF/wCXKkXB8Q+02YjiRdlvaD6N2ruo6Nh5GL1uivY7Mc9uIg/LUH0lejMIsMIYn/Duqk+b9yXZovxAYGMywKx6yp9EhF/qYWbNc3affoQy/5M4US/bW17j4ykmpoVdZUEOwBTopcBmQqha8PIIPWhGzr06TjyOoa+RoOVSY4/0ZUExCm/xaf6FKu/kMtc6UKoDbxxxShuEaS4r1wMOE+6dXujaT4W5KfIjB3HVmp44DIpJDItUWyAWBP2+lBZHoHUW6/xXcPq2BQ2Fe2MvzV2WeCGdhDLQ8mdjFL4tHf7ZQ/pvW4PAhZ0onUSchbgbtCFVkx5ohaI4OBKt5onUdnipUvHuk5Q6s00n9EHs4tdlwnZxGlx12M/HtrH6pxg3V9jtFl27yWq6i/MPU5H9TIRnmaLuyVGi7xWU07bv858IvOI3jYd0O56zm1IF5focvXR60nrOjQ1NZYP4pP7uVK8DQQUoA5eFC8bTw3U4EBqpnb0OpRp3/Wl6gDaeYeCLAXo0stlutGI4/D6cihLsxNYpwQBmDi21M1/lwLfyw2el7/pFw5gYCX1UzydLZ3Km0LMIXn5ycmPZotDhW1UQza86HlK0YpmhAOCsK9/Il0rBqROut6yNre0h2UyuKQgWdGg0TRBq7ONRNmA0onMy6KQY1ZhM60pYO36WBjtt6EI14lzm54CICMTZFZKJ3xjeTXvwoLlmEMvuEexb7x6W/+ljkGmdcztJALg== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(376002)(346002)(136003)(396003)(46966006)(36840700001)(40470700004)(81166007)(41300700001)(6486002)(478600001)(31696002)(82740400003)(86362001)(356005)(336012)(53546011)(6506007)(186003)(26005)(6512007)(31686004)(2616005)(36756003)(83380400001)(47076005)(82310400005)(44832011)(70586007)(40460700003)(316002)(8676002)(70206006)(40480700001)(5660300002)(36860700001)(8936002)(2906002)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2022 17:26:58.9748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46dd36b9-17ed-4a10-92e9-08da7707b3c9 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT007.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4745 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: , From: Luis Machado via Gdb-patches Reply-To: Luis Machado Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, On 8/5/22 01:46, Thiago Jung Bauermann via Gdb-patches wrote: > When the inferior program changes the SVE length, GDB can stop tracking > some registers as it obtains the new gdbarch that corresponds to the > updated length: > > Breakpoint 1, do_sve_ioctl_test () at sve-ioctls.c:44 > 44 res = prctl(PR_SVE_SET_VL, i, 0, 0, 0, 0); > (gdb) print i > $2 = 32 > (gdb) info registers > ⋮ > [ snip registers x0 to x30 ] > ⋮ > sp 0xffffffffeff0 0xffffffffeff0 > pc 0xaaaaaaaaa8ac 0xaaaaaaaaa8ac > cpsr 0x60000000 [ EL=0 BTYPE=0 C Z ] > fpsr 0x0 0 > fpcr 0x0 0 > vg 0x8 8 > tpidr 0xfffff7fcb320 0xfffff7fcb320 > (gdb) next > 45 if (res < 0) { > (gdb) info registers > ⋮ > [ snip registers x0 to x30 ] > ⋮ > sp 0xffffffffeff0 0xffffffffeff0 > pc 0xaaaaaaaaa8cc 0xaaaaaaaaa8cc > cpsr 0x200000 [ EL=0 BTYPE=0 SS ] > fpsr 0x0 0 > fpcr 0x0 0 > vg 0x4 4 > (gdb) > > Notice that register tpidr disappeared when vg (which holds the vector > length) changed from 8 to 4. The tpidr register is provided by the > org.gnu.gdb.aarch64.tls feature. > > This happens because the code that searches for a new gdbarch to match the > new vector length in aarch64_linux_nat_target::thread_architecture doesn't > take into account the features present in the target description associated > with the previous gdbarch. This patch makes it do that. > > Since the id member of struct gdbarch_info is now unused, it's removed. > --- > gdb/aarch64-linux-nat.c | 11 ++++++++--- > gdb/aarch64-tdep.c | 41 ++++++++++++++++++++++++----------------- > gdb/aarch64-tdep.h | 2 ++ > gdb/gdbarch.h | 13 ++----------- > 4 files changed, 36 insertions(+), 31 deletions(-) > > diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c > index a457fcd48ad8..eda79ec6d35c 100644 > --- a/gdb/aarch64-linux-nat.c > +++ b/gdb/aarch64-linux-nat.c > @@ -900,11 +900,16 @@ aarch64_linux_nat_target::thread_architecture (ptid_t ptid) > > /* We reach here if the vector length for the thread is different from its > value at process start. Lookup gdbarch via info (potentially creating a > - new one), stashing the vector length inside id. Use -1 for when SVE > - unavailable, to distinguish from an unset value of 0. */ > + new one) by using a target description that corresponds to the new vq value > + and the current architecture features. */ > + > + const struct target_desc *tdesc = gdbarch_target_desc (inf->gdbarch); > + aarch64_features features = aarch64_features_from_target_desc (tdesc); > + features.vq = vq; > + > struct gdbarch_info info; > info.bfd_arch_info = bfd_lookup_arch (bfd_arch_aarch64, bfd_mach_aarch64); > - info.id = (int *) (vq == 0 ? -1 : vq); > + info.target_desc = aarch64_read_description (features); > return gdbarch_find_by_info (info); > } > > diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c > index 8670197a8889..c9ce4f95447c 100644 > --- a/gdb/aarch64-tdep.c > +++ b/gdb/aarch64-tdep.c > @@ -3372,6 +3372,27 @@ aarch64_get_tdesc_vq (const struct target_desc *tdesc) > return sve_vq_from_vl (vl); > } > > +/* Get the AArch64 features present in the given target description. */ > + > +aarch64_features > +aarch64_features_from_target_desc (const struct target_desc *tdesc) > +{ > + aarch64_features features; > + > + if (tdesc == nullptr) > + return features; > + > + features.vq = aarch64_get_tdesc_vq (tdesc); > + features.pauth > + = (tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.pauth") != nullptr); > + features.mte > + = (tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.mte") != nullptr); > + features.tls > + = (tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.tls") != nullptr); > + > + return features; > +} > + > /* Implement the "cannot_store_register" gdbarch method. */ > > static int > @@ -3422,17 +3443,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > int i, num_regs = 0, num_pseudo_regs = 0; > int first_pauth_regnum = -1, ra_sign_state_offset = -1; > int first_mte_regnum = -1, tls_regnum = -1; > - > - /* Use the vector length passed via the target info. Here -1 is used for no > - SVE, and 0 is unset. If unset then use the vector length from the existing > - tdesc. */ > - uint64_t vq = 0; > - if (info.id == (int *) -1) > - vq = 0; > - else if (info.id != 0) > - vq = (uint64_t) info.id; > - else > - vq = aarch64_get_tdesc_vq (info.target_desc); > + uint64_t vq = aarch64_get_tdesc_vq (info.target_desc); > > if (vq > AARCH64_MAX_SVE_VQ) > internal_error (__FILE__, __LINE__, _("VQ out of bounds: %s (max %d)"), > @@ -3452,12 +3463,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > /* Ensure we always have a target descriptor, and that it is for the given VQ > value. */ > const struct target_desc *tdesc = info.target_desc; > - if (!tdesc_has_registers (tdesc) || vq != aarch64_get_tdesc_vq (tdesc)) > - { > - aarch64_features features; > - features.vq = vq; > - tdesc = aarch64_read_description (features); > - } > + if (!tdesc_has_registers (tdesc)) > + tdesc = aarch64_read_description ({}); > gdb_assert (tdesc); > > feature_core = tdesc_find_feature (tdesc,"org.gnu.gdb.aarch64.core"); > diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h > index 5bdd733dce32..d8513023c376 100644 > --- a/gdb/aarch64-tdep.h > +++ b/gdb/aarch64-tdep.h > @@ -121,6 +121,8 @@ struct aarch64_gdbarch_tdep : gdbarch_tdep_base > }; > > const target_desc *aarch64_read_description (const aarch64_features &features); > +aarch64_features > +aarch64_features_from_target_desc (const struct target_desc *tdesc); > > extern int aarch64_process_record (struct gdbarch *gdbarch, > struct regcache *regcache, CORE_ADDR addr); > diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h > index 324958469a7e..1287f0214885 100644 > --- a/gdb/gdbarch.h > +++ b/gdb/gdbarch.h > @@ -250,17 +250,8 @@ struct gdbarch_info > > bfd *abfd = nullptr; > > - union > - { > - /* Architecture-specific target description data. Numerous targets > - need only this, so give them an easy way to hold it. */ > - struct tdesc_arch_data *tdesc_data; > - > - /* SPU file system ID. This is a single integer, so using the > - generic form would only complicate code. Other targets may > - reuse this member if suitable. */ > - int *id; > - }; > + /* Architecture-specific target description data. */ > + struct tdesc_arch_data *tdesc_data; > > enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; > This version looks good to me. Thanks for addressing the comments. I think the gdbarch.h change is reasonably obvious that folks wouldn't mind it going in along with this fix.