Message ID | 20230907152018.1031257-7-luis.machado@arm.com |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4CB303858422 for <patchwork@sourceware.org>; Thu, 7 Sep 2023 15:21:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CB303858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694100064; bh=vYb9jIFiAPQXRlI8yx8RRVdReDuL6MFfkn9cLTpUkxA=; h=To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=oxjDdPD4J99qj4dvTvHEI/0EpRqLeZtebkEqmR86mk6TQFhikuSXbbutmJVaYWm6r xccKJ+h0XV6d1VgdW09YE9BH2F50vsr8wkOTrT7iRQncVIIqcOHesIiPMQbMnTTyys OwulwLqR2itKT2eCPqG+yQmaGoYezPomeoZVw0fo= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2082.outbound.protection.outlook.com [40.107.104.82]) by sourceware.org (Postfix) with ESMTPS id ECDCF3858D1E for <gdb-patches@sourceware.org>; Thu, 7 Sep 2023 15:20:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECDCF3858D1E Received: from AM6PR10CA0002.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:89::15) by PAWPR08MB9995.eurprd08.prod.outlook.com (2603:10a6:102:35d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.36; Thu, 7 Sep 2023 15:20:31 +0000 Received: from AM7EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:89:cafe::48) by AM6PR10CA0002.outlook.office365.com (2603:10a6:209:89::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30 via Frontend Transport; Thu, 7 Sep 2023 15:20:31 +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 AM7EUR03FT032.mail.protection.outlook.com (100.127.140.65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.28 via Frontend Transport; Thu, 7 Sep 2023 15:20:31 +0000 Received: ("Tessian outbound 1eb4e931b055:v175"); Thu, 07 Sep 2023 15:20:30 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 99b23a972d7e177c X-CR-MTA-TID: 64aa7808 Received: from c772e3d2d46b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3FF5E41B-6B34-4162-80CD-251A4129500A.1; Thu, 07 Sep 2023 15:20:24 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c772e3d2d46b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 07 Sep 2023 15:20:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aktba3QqYs1ZZpWzED7RM0na6yDZf6Rt4wNmj/Fmwk66N34v36vR88RpYB2gqx39SISIrMWpz4SClvhbuEdlD5mMv5x+4EKJZMn095R/0E9w8XgEnXfjbKGEEwIrGyF/hAJpWR2S6f8vI78Tevz5rtHK+Qbwo+8bzAJZW3Jjv0p735sVf3SCnGRluP9yHGS1tPlucmRlqiL9Mqts7HzBBJeGeKoCP+B4cWjMzD5tH452GiK9Bj4YsIyZ4j9ut3a96hjCLqgd/mN5gK8SIJXxwzh0kt5T8Tc5SfN43MuI7YVRZu5NYnXzvY9U1YQlAnCu/d/XsvtPMysU/OtuEYMBWA== 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=vYb9jIFiAPQXRlI8yx8RRVdReDuL6MFfkn9cLTpUkxA=; b=aH4SdMlEJca0+kQo2DWOYE4tnoMwt5GSktVpvwXKwEVNzgMxj1CZ1NWMPbZ1N0dhHvR2Dg0iZw3Nc98bZ0gvtn61hBJIxXy6rLD7kt51Gjp/xv0jycSKhenbFLpeljHi4T0hMEARmB4Wlms4MbZhcFehCPf+KXCMscCUoueYyPkAzmPER2hIHFjP7yk3xeEuqfQDH1T/u8cYTd5Mlk8ZJqmhZSS1kR6DZMjP00GFWubCtcLD2DNExKPP+g7CC7fKLpwI1XSLpMEmFNmSxWN2FuyA5/pAK96XFp+Qb7L6JlxNYu4PfV9G/mKRlrCXsWMVtZp4L4oS9lfHVZFOheZ4Xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM6P191CA0062.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::39) by GV2PR08MB8654.eurprd08.prod.outlook.com (2603:10a6:150:b6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Thu, 7 Sep 2023 15:20:23 +0000 Received: from AM7EUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:7f:cafe::13) by AM6P191CA0062.outlook.office365.com (2603:10a6:209:7f::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30 via Frontend Transport; Thu, 7 Sep 2023 15:20:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT054.mail.protection.outlook.com (100.127.140.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6768.28 via Frontend Transport; Thu, 7 Sep 2023 15:20:22 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 7 Sep 2023 15:20:22 +0000 Received: from e129171.cambridge.arm.com (10.1.32.59) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Thu, 7 Sep 2023 15:20:22 +0000 To: <gdb-patches@sourceware.org> CC: <thiago.bauermann@linaro.org> Subject: [PATCH v5 06/16] [gdbserver/aarch64] refactor: Adjust expedited registers dynamically Date: Thu, 7 Sep 2023 16:20:08 +0100 Message-ID: <20230907152018.1031257-7-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230907152018.1031257-1-luis.machado@arm.com> References: <20230907152018.1031257-1-luis.machado@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT054:EE_|GV2PR08MB8654:EE_|AM7EUR03FT032:EE_|PAWPR08MB9995:EE_ X-MS-Office365-Filtering-Correlation-Id: 7473edda-10df-44fc-1945-08dbafb5f966 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: vW8xqaMqkXGx7ySIFYWm+mI+C8G2CXxvF/Hz0qFz/7bl6d+QcUENKVYpK+c/MIbOugY9/KeQSjhlwcIJRJRnM+244UPw5CkMIO7ZiAlUCohjo/x59peOQsEt6KYSm4hUo/lAcB9D9hhXcyMPDYjrAfvpDm1EZwc6bouPDqhamfw2GXtzL0o/iSvBBjKbgPHhNQQOpR/UDFLbJzuJv6xZVQGQl1FNehAK4ryDG9uK+9LPb5Pmh/Du2atGRJhCjy0c1rM/Fbh7DrxzEaApgT/wqCY1T6nq7AGshsm5wS7CFYlxY77x0YgCUPHlAhNKkvIP2re4/CpeGkGfTaXKPmNIrr5tugAwu1oKQ30fMqLefMHNvQdTmO4r6O1vM0/7YFaRSsRb62jiEWPBNtIcMJ7I63eaSvuDnMLqVinLBWZUnjRP0QhQz7UNH7Xm1oNzvqXfb7UYEF2l2R2D7HozugVOhr/6WZ9mcPTd8j4xvyl/N2uL5FzGQozz73IB8x0x7O4lMUAMzQ7DQHTBh2AkJmt569F3L2Q/obU1LJVKZyI9qgqh/65NA2o7eStNxvWdAK19+Nz0FVUDTtdxIAXE0p3fnBjuBg5J4kzc5mqGmSn6LbhEYeyfIVEmDW9lESTjE8PIE3EScYMQQgB45ANVNkk4TQCYowX7bYfEEN29XRTg6j/Retmd9h+e8h9HT+OfUlpF26PciwVuvbG0uk0MlBZ/v8NQKNQv3S3OouZ6961NhXd822QWtOtgLj2jj9pIuaHuMYzHyhLwlbgoNHsXHp/NPg== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(346002)(136003)(396003)(39860400002)(376002)(82310400011)(186009)(1800799009)(451199024)(46966006)(36840700001)(40470700004)(40480700001)(40460700003)(44832011)(336012)(426003)(8936002)(4326008)(8676002)(2616005)(1076003)(26005)(41300700001)(36860700001)(5660300002)(83380400001)(2906002)(6666004)(478600001)(316002)(6916009)(47076005)(7696005)(70206006)(36756003)(86362001)(70586007)(82740400003)(356005)(81166007)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8654 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8e375f8f-b1c6-4447-04d6-08dbafb5f477 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2t8MvMc+0xrT4b/eEHCo+4C/nOVj41SmBxoy52m5S+pGp+F2QJaBkAK+REc2PnncbJ+88A/eehzl4nCuwWxTdtBhlp37TgMwdosPoYOC8fLXGTH8JbDejhtBPHIc72dFWbgyDc0zGzacMqM9mv9kjFRQEgSyEaf+lMeUrx/q+e7++P3oxTn3lpIJBvoh3PPqGgInbYaE9bQpk1mMqR0xj6SsvW6+yRNxryWtc/xp9Xdbub8lbXGfLf8/Wq2lMoV0G/pNkfF4TNbAspSMqG5F4g9KVVf2q7iOEDu1j3DMv2dyfCeOcheWtymA9uUocffwAdusINF+vfXOgXrbrn6t2uFn9SX7R1JPx0L0iEcC7WZu0JTS2puOW2xi+KnMv2os7sonYHoTKAouSot1QDEajEUlxucbtXY/QdSFq0pRlXJAHNdDyHs/3F6DhU27Tx5A/r2PLRbw1wWQp1HB4pPJIQZpFX8/zCBISf6CuvqnfjDkFxz+b/AL4FUEMm5/1a+5CrylbqXccqzQ5ZjUmuNnbhh6kAiGCQ5P0u5F2IFYvnLbEM4xoIVC3j3zHzOBXYPkW9rgmA65cS9IaBgjTPNh8cF/UUoJPOclvV9YjEK7FCM8x9OJcB8YoM5lucaMDwPSHbVYBOuO0auNdmB3WvYVw0sCuI2BSONMTO1lX7K4cW7JbKZkvAnuB04l6zzcff74qWiI7ZWrm89apZs8IbMj8+R6ortxF+tedyo7IJPcwWUyMkSAoPx1Yef4wuXZ9j2j 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:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(186009)(82310400011)(451199024)(1800799009)(40470700004)(36840700001)(46966006)(81166007)(336012)(426003)(26005)(478600001)(36756003)(70206006)(70586007)(6916009)(316002)(41300700001)(36860700001)(7696005)(1076003)(2616005)(107886003)(83380400001)(82740400003)(6666004)(47076005)(8936002)(4326008)(8676002)(5660300002)(44832011)(2906002)(40460700003)(40480700001)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2023 15:20:31.0591 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7473edda-10df-44fc-1945-08dbafb5f966 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: AM7EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9995 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Luis Machado via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Luis Machado <luis.machado@arm.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
SME support for AArch64 gdb/gdbserver on Linux
|
|
Commit Message
Luis Machado
Sept. 7, 2023, 3:20 p.m. UTC
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(-)
Comments
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<aarch64_features, target_desc *> tdesc_aarch64_map; > > +static std::vector<const char *> 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
On 9/8/23 16:35, Simon Marchi wrote: > 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<aarch64_features, target_desc *> tdesc_aarch64_map; >> >> +static std::vector<const char *> 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? Yeah. Well spotted. I think I'll need to have a map-based entry for the expedited registers, because init_target_desc just copies the pointer instead of the contents. Let me think about that. Thanks, Luis
On 9/8/23 12:00, Luis Machado wrote: > On 9/8/23 16:35, Simon Marchi wrote: >> 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<aarch64_features, target_desc *> tdesc_aarch64_map; >>> >>> +static std::vector<const char *> 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? > > Yeah. Well spotted. I think I'll need to have a map-based entry for the expedited registers, because init_target_desc > just copies the pointer instead of the contents. This can probably be changed, to make the target desc hold a vector. Simon
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<aarch64_features, target_desc *> tdesc_aarch64_map; +static std::vector<const char *> 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 ()); tdesc_aarch64_map[features] = tdesc; }