From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EGpVK2hF+2SUHxMAWB0awg (envelope-from ) for ; Fri, 08 Sep 2023 12:01:44 -0400 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=B+cpD6sF; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id ACD631E0C3; Fri, 8 Sep 2023 12:01:44 -0400 (EDT) Received: from server2.sourceware.org (ip-8-43-85-97.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 915D51E092 for ; Fri, 8 Sep 2023 12:01:42 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 231EC385841A for ; Fri, 8 Sep 2023 16:01:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 231EC385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694188902; bh=D2LM7hVOlbNxWXMPT3dbeqw5Zb0KfYNTaNgb7koR8cs=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=B+cpD6sFAALmhGsqTVp1JacH9QBc+iui/dQ7vEzQ7Ypnt01/RxsyoDV442DJUyTQt fy8DisOeWCnFhSkLY0WK7KLsz7t/Mgm3iaY1bR9+WhwTCOOm5VhPRT/wuULg7ZXVAm Pics1nm/MOtN3Nv3OzJJg+RSavSrhedR3kssh1F4= Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2064.outbound.protection.outlook.com [40.107.20.64]) by sourceware.org (Postfix) with ESMTPS id 517423858D1E for ; Fri, 8 Sep 2023 16:01:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 517423858D1E Received: from DU6P191CA0012.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:540::12) by AS8PR08MB9980.eurprd08.prod.outlook.com (2603:10a6:20b:634::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Fri, 8 Sep 2023 16:01:11 +0000 Received: from DBAEUR03FT015.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:540:cafe::3f) by DU6P191CA0012.outlook.office365.com (2603:10a6:10:540::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30 via Frontend Transport; Fri, 8 Sep 2023 16:01:11 +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 DBAEUR03FT015.mail.protection.outlook.com (100.127.142.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.11 via Frontend Transport; Fri, 8 Sep 2023 16:01:11 +0000 Received: ("Tessian outbound 5c548696a0e7:v175"); Fri, 08 Sep 2023 16:01:11 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: cb4379891239a76f X-CR-MTA-TID: 64aa7808 Received: from d849438afea6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EFC7C756-F99B-434E-A917-D31B66CF5565.1; Fri, 08 Sep 2023 16:01:04 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d849438afea6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Sep 2023 16:01:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R4HRNrjQO19uuRoQcgdqAbLj38BTqLHOAgVuRZvPDxKh4GO98QvNRnrDTxzLPFx7gn3eUKcW5n6MfbavkS41MB3cmUD1Uc/8gqXqmbfz97Xnr88SC+yIeR1H0acWmoB8L+tQqVlG1afFYhOhHskbjXr82b55K3kzUP84jWKHXtNgj3BS/kqw8n//1ZDN2ya/iF2LoOo7yRtDz1eu5usD6qvNszhSCNSOkyh8gIQJmYPgwgEuk9XPq75r3Mkg1H4oyRVd74c0+Ja3Ev9SWTHfyz8zlmjrs92O66Zv3FBXFGlvAksTtpUJQfEWrH8y1MBBmB3iu++pjrzZCh5xNaVR8w== 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=D2LM7hVOlbNxWXMPT3dbeqw5Zb0KfYNTaNgb7koR8cs=; b=nmQ4Z0fHN3/KEeyJsJXxK+MKHjz+wqy/zrZSw3VA9Ag1CT2midCtJBTgNCMYBFJ489caQqSHRj3ysbRZ3qhvBWFl304uXJ8KixKfTJrQExrHRmgvaPfrWtRHLydR0muI54Io9+sT205m4RsBIv31KFsGxnLu/A7W6d+lk8Oolr9sgYhv1xX4xzb94fbsepUpHa/gq5MWSOpZTWn6cbAgFzzqf0mv/Pe3tCIACFZJ/imMB3Ui2vXaXVQ6pXWVu6/er2DkmgkQk0Vva+rsco4kvZSNqT9hMLV31MFnIQ+IZ6n9CI8bqlmppaS3eQksKGgsXyxdpFdFBG04+Eme8aetzA== 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 DB4PR08MB9261.eurprd08.prod.outlook.com (2603:10a6:10:3fa::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Fri, 8 Sep 2023 16:01:01 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7743:60fe:4859:2df2]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7743:60fe:4859:2df2%6]) with mapi id 15.20.6768.029; Fri, 8 Sep 2023 16:01:01 +0000 Message-ID: Date: Fri, 8 Sep 2023 17:00:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH v5 06/16] [gdbserver/aarch64] refactor: Adjust expedited registers dynamically Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org References: <20230907152018.1031257-1-luis.machado@arm.com> <20230907152018.1031257-7-luis.machado@arm.com> <770bbc82-3823-42e8-aabf-cec185c8c6ca@polymtl.ca> In-Reply-To: <770bbc82-3823-42e8-aabf-cec185c8c6ca@polymtl.ca> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN3PR01CA0141.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:bf::21) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|DB4PR08MB9261:EE_|DBAEUR03FT015:EE_|AS8PR08MB9980:EE_ X-MS-Office365-Filtering-Correlation-Id: 0385ba34-41b6-4d8b-c377-08dbb084d257 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: f8jmdeEbJlj/WM19GL0fBugIiKPOD2hYYP1Lh/Sw3+I5eL65TpLr9VKhYswkdoUtAKQxZoCBqIbFWIwTAiaIkAZfIanzG/CINKKBA/92JeW9ycwFw2jRbUHpe1ulAoXtDvXuVQJmnhuqozRRTtNxtDpcFEY+4HxOWrsLLFN5TmVm74+XR/vd1XTzVC/DUrHLiRGpFb5QfdUvq3BY9NZAeZ8TE+xHeJT8TAvbGmY7+LcK7z1EhWhlXZ15dQR8sCBvaZmHfUleXLtVcF3rkZUJS4+pMu5UlwFF8c9/5N75o7whMgUHWYh7URcBDLEKzhmIVCah8Jbqm+ziYILIDFE7esWYiBQ4URGmfrRo6F2ioF3WSamKPAjKIB0FAGDZXNR5z4bILt2XVK+mPgWqRCHEB1mpzF/hk6L9AvJzvY664WJG10WQn3Us2lUOa0zVrSHi2RYuVu2351oCO/cu2ruo1+P45J8gsdXJq/y8FYf+SBBALTq5DlrbF3mrf4q4Ba7GQbN4sCt81csNgwcolaeafYA4wmqEDJgZSL2QyKgPzJBlwxZK6le6etxefht8x5OLQIRF1Ts46H3vQoVx2ah3FtM0xaPu9OpU0hsMmaUOtmuesX2iB9IrCjt0rqLZ4KtK/4WN6zwWOmY7GXP/41l2Pw== 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:(13230031)(39850400004)(346002)(376002)(396003)(366004)(136003)(186009)(1800799009)(451199024)(2906002)(86362001)(31696002)(53546011)(2616005)(26005)(36756003)(6486002)(6666004)(478600001)(6506007)(6512007)(38100700002)(83380400001)(4326008)(41300700001)(8936002)(8676002)(44832011)(66476007)(66946007)(66556008)(316002)(5660300002)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB9261 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: DBAEUR03FT015.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 60ecc611-f290-4b6c-a417-08dbb084cbc8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GsCEu0r2DSluoa2Fq0+YQjcWuw2aqqXlRtHClZMwTzmS8l7/ka3Qnl1HAysTB+5ZZzVaMZM54panEfXjHpsKNJd0V6gudR2pQz4IhTnluSkfoLczIyVET1KWe5q+8GcjipdXcJpdH6IDFh8Qo7ug3pwvKW0REWxzQTJB5KmIxjrUDBcmhlFoD+fdv4/gougIBmla/BfVU4lQ1SCwvQFcTcMqm+UGXc2Mr7Sub+tp4JSElOj8byCcyY3cE8xUvDOgZ+S3vVobKV+EB1gJd6szHIfmfpAizT3eXI6d0JxkmrPGel6Wpju90LHjtSqGisN7aTbmqdW8PTFzgqw3lr6clENngUuZoluVtkK8RAhXg/X/1W1kqYsfHafGxszE+Cy1c7y9wU3Kn3usj62MP0RZ+kfe3PI9hKWp8St0boUWMbkxkwS0h4rvo5K0AuVJ8xUbUrFZ5KKQqS34//7gNhvJz+zz8ChjMGMQSEcoFh8Y4gBtvMXDpqHbk/RXQTONjBmaayan2TbqSSIOU9Ea0U7icoV+8/3mfA/dvct/NSbP3tc2ucDLFF96zcz07fqsnTTyJwq94qDEP54V9wfLkZBnMX0TpG3wfPkJ2/n0p7lpHJgR5uKiB+Y5bavDKXGnvYLgvU0kMy4KmmDy9az05UiQfuDE1w1Ic0l/F6wzMClnSKvV1/LLsPWtgglwGYdrwt+pZRNQzolJ7sd1NlzT/FlHzdIzzzygW6PVjKvIteXTdYVSlYAmxdmziphbI1HADIJLR+kUGk6GW2DYmzTdDc2lFQ== 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)(136003)(376002)(396003)(346002)(1800799009)(186009)(82310400011)(451199024)(40470700004)(36840700001)(46966006)(81166007)(82740400003)(356005)(40460700003)(36756003)(40480700001)(86362001)(31696002)(6512007)(31686004)(8676002)(4326008)(8936002)(6666004)(53546011)(6486002)(6506007)(107886003)(26005)(2616005)(44832011)(478600001)(2906002)(5660300002)(316002)(47076005)(36860700001)(70586007)(41300700001)(336012)(83380400001)(70206006)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2023 16:01:11.4039 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0385ba34-41b6-4d8b-c377-08dbb084d257 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: DBAEUR03FT015.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9980 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 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" 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 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? 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