From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2045.outbound.protection.outlook.com [40.107.7.45]) by sourceware.org (Postfix) with ESMTPS id 56E5E3858C98 for ; Thu, 4 Apr 2024 16:18:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 56E5E3858C98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 56E5E3858C98 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.7.45 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1712247534; cv=pass; b=WvUPptFwWrAEbgmJGnAa2VzWGUIo1zgG5YFYD7Rqq5HvnWzIgQbk6Qqofvbs0TNpJ5a4lECjT6MrTxpvS1eWIAnwXQYDwtbYJxrV1zGjgpXDq9MWS1LchAw3WxQmVfY8DaB/3Y0Ne9UqUY3MMhCecruOEBlBRzCvcTJDzZWJOYs= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1712247534; c=relaxed/simple; bh=7BaIDIEOzi3csGx85TYkgVvxT7jQQl+ChLwQl+ldS1Y=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:To:From: MIME-Version; b=daKm3F80KN42X8euEKy/TKIyoszegccN36iPBwkcG+pwitUHhUQmezdxS272xBENbSxrBmbdKioeCA2WRzUqwvp6r4+fSAt2UWUfhqfeFj0CkTJEcWecMZbdlDjE3h0f2aWBs+zRhLCGt5lLQ22RajZAPKbUIbM+9yHhmKjX6qw= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=NwtbjYNR2E/p2kFfqHGlcV7k/WNjYzjyOfgAKU5y5Zh4a2HJqJ4KjES8hXNTKaZ293u9I/RaIBMOh0W5TE0zlazA2KtYaSlj1kBCR5oYAIiqZWVXgM0TxfTXb5sIMttZlA5dOYlOjKPv0JmQSTj76puggByQddMWQlCzrCHJNWLRRRZLcGQCA2NU5IjrVswdQc1FZ8yTH2jh7LZSxchonlL7mMDJsBQu0ds5rSrUegwSm1EeCZtN6h6ZYeZUlghZa58QyPKCCo25+MLpfFvAKkFdSbJh6UvQ+OfhTd8vk74PY/x60Q97sZutaOVreb+IpdeG5a6uzVTNVToFRhPsig== 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=Ri2INS/tlETf7qxoUesnLtDWAT9NOBLEabKKCuqNW4k=; b=TXJGhgjUmJBPHjti/t/HQysKWCfSMlQ7jvG4q/CiOu36VyB5YX4/DknNT9snixQ+AhC4cjM31Thtv3ogQZ3Nl6sxUVb8DvWXgcsfRtcc36fKITwlMX2M30pFqtQHIUcfs2gOgiVyfFckQbqN6hZ6V/6VIEXu+/Az4XLhkdwrSaTkyHn+bdy4cJ9A1GIJYFLY/+Ncl5uAg/yzQ4sa2PUkW4SrDukCnwRDVkCtkkFEQGcc1ZGobkaP+KrJvybIMFgqBe85IAVdmzD4JmpV8W6zI5/QaCq0M6TMifNXqqECIUhUgxS8Z6A6PwVumCfm3U3nhktadKETJUQp453wUYxbnQ== 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]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ri2INS/tlETf7qxoUesnLtDWAT9NOBLEabKKCuqNW4k=; b=QQAqb5kWNPdctvGhGpYsgS+ijrgH7rVbE4oiaPz0CxZhRpEfywdF28i6v6pdPzheYYYtULV1e0FFn4qPXVBp3p2uDK3vzTlC0xg2xUNgcYniqLG+QVqn69z8zP8Mw7HCOjvuXv2xStm33yOxp/OBYX4ur5Ow/EY+c1Jl0NEtQoM= Received: from DU2PR04CA0070.eurprd04.prod.outlook.com (2603:10a6:10:232::15) by AM9PR08MB6660.eurprd08.prod.outlook.com (2603:10a6:20b:305::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.42; Thu, 4 Apr 2024 16:18:38 +0000 Received: from DB1PEPF000509FD.eurprd03.prod.outlook.com (2603:10a6:10:232:cafe::f5) by DU2PR04CA0070.outlook.office365.com (2603:10a6:10:232::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.40 via Frontend Transport; Thu, 4 Apr 2024 16:18:38 +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 DB1PEPF000509FD.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Thu, 4 Apr 2024 16:18:38 +0000 Received: ("Tessian outbound f0b355493f75:v300"); Thu, 04 Apr 2024 16:18:38 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 2bcc1e501413e173 X-CR-MTA-TID: 64aa7808 Received: from 85e10995af5c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 552473BD-BFBC-4475-96E7-43A79E39034A.1; Thu, 04 Apr 2024 16:18:31 +0000 Received: from EUR02-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 85e10995af5c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 04 Apr 2024 16:18:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RTS2oS2hnsaJACPAdzhAmQstcO0tKAfWvA9ilT4UL8vg5ih522xf8isoSwL1DgP+H3eSVmlClULvxLuuY44F/+Z1PPTaCiOPm2V1tC1Oqmu8ronsLTbTfCZWnpmbZ6CM/pt/1Q8MG+wTCMgB/V0g+/P8Uju0ogrt5nvvgMfJ6wx9Botks18re3NPX1/GosPxDF4DPBdp4yoHGf4YESlPSA3/kGrppm5CuHb0FecJ6xbr94sLHIuZbLN2yupG/6+DRTF86H1gjohbhUBWPxfwPKXxF8wAIppBF4FzFoWfV9BXSqKaqmGUS3yRsmqlo377AhNqEg4d3RLkmVAuIVanKQ== 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=Ri2INS/tlETf7qxoUesnLtDWAT9NOBLEabKKCuqNW4k=; b=e4XWMTVr2kIT522jyx+HnFD3uO/bMSwoggLLX7k7nd2YZzOnINB1I27um2OfQr+jUfRld3YcKX5+2ww7CfZyfsk83bV62zs1fy+q6UIPMe83n2BaQovzfDJskGZlM2Btfk+mKsciJxWZxM/KZ1dU26Q9WSnV82iQZ4p3JGO4HVMMtyHg+wk9hU0NYCKG1N+hh4ahZL07B473pB8kyR/HXmx8Ra0RTEfCdYT81PSALHa0tbOhCy/YH6yDpRsWZnxRO7eArbmNyNuvSGOvlFHojBXiTXfE2Yk8C8pA7g+VF37va//5GkpwvCsuyQ+m3y5QhjOoqq3EkYDQdddYhWOgaA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ri2INS/tlETf7qxoUesnLtDWAT9NOBLEabKKCuqNW4k=; b=QQAqb5kWNPdctvGhGpYsgS+ijrgH7rVbE4oiaPz0CxZhRpEfywdF28i6v6pdPzheYYYtULV1e0FFn4qPXVBp3p2uDK3vzTlC0xg2xUNgcYniqLG+QVqn69z8zP8Mw7HCOjvuXv2xStm33yOxp/OBYX4ur5Ow/EY+c1Jl0NEtQoM= Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by DB9PR08MB7606.eurprd08.prod.outlook.com (2603:10a6:10:309::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Thu, 4 Apr 2024 16:18:30 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::363f:3fc8:fc36:58ed]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::363f:3fc8:fc36:58ed%5]) with mapi id 15.20.7409.042; Thu, 4 Apr 2024 16:18:30 +0000 Message-ID: Date: Thu, 4 Apr 2024 17:18:28 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 6/7] gdb: Add qMemTagAddrCheck packet Content-Language: en-US To: Gustavo Romero , gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org References: <20240404064819.2848899-1-gustavo.romero@linaro.org> <20240404064819.2848899-7-gustavo.romero@linaro.org> From: Luis Machado In-Reply-To: <20240404064819.2848899-7-gustavo.romero@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0697.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:37b::12) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|DB9PR08MB7606:EE_|DB1PEPF000509FD:EE_|AM9PR08MB6660: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: uZ3otbmCG2foux2CHZt5iKblSdVKMPg1a/SJ1YLn2IKu9qoyFjBvBTxj+65as/7l6kyvvzYni7gmhzfsbpZ2sSTezlseFPW85DJCmNJZIbKKudxATZgR5TFNemVPs+lSs//pN1n8fSPdNeF9W5cTw/gNmX/k35tgfJF+3G2FMkXMBUZwo56lSvK6q8Ao4YqYIkCFX5Xb5Jx+ABpLu9MRHZjMx+Z1tmC3fEIzKE+qZy70koF8b1GQngo0HDbyvvDrr2mh7LkTsb3ArK+OjFyOcHtPZG5TWP1axFWY4ps5LENUk/RSXj65dtOO6hFBYTKoc4aAzh5k58DsfoNs4GMI6ilO+df3Z/hpbKhnRurcquKSYHOeRqizNh7u2MVQHiwS94b2VNzuHeQe1nf332OUwgr4DY1ayEsVBGLv4YNtYqlcp3piOgyrE2SgwBkiUkP/Ot3MH2JzZYtNNA/P2e+2WsY/ISX19wbI+c7SDNjWHplx1eW2WfTHpqE8RsoRmO2Bb15EsObhf7Zh2UDtTzyKRKv9zvRXSkejvfhME3NW+8cYIAZlFSxq8D2Kq5pXeDSGCu8pM8q4c1JOajyGJtF6AsEF0KhMKyMW4+XpTb9t30aLvKBRlCe6u5xIPWqkva87E+zq/RG//JSuVQph/71NaV2A9AOTVZR4e3MwdQ5y5I0= 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)(376005)(1800799015)(366007);DIR:OUT;SFP:1102; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7606 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF000509FD.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 51e08ce6-f398-422c-b745-08dc54c2e2b7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w7OIXKfVNwma2vsolzpdq79XjbLY46Pa/WfN2WMtJ466HPR4NT0gjY8Lf+I6biUjaihsMYMpzfoq/4M9hSgB2XsalaX1cJwA2FaxJPmUQhQ8F3sgATRklZv7R2cHChyaMORZOf6w0EPbzKXo0TT/jv4j2aDMHiij9NUcrbEYEflZFB2lkYGlShS/p1uKZZNSxRvzjNB7/zWeziR4zmk9BtRyOvahqGsI+DHz8PMGI0xtKVSJgoyCPOnqTKshkFiw5N1KNyCCSnWx0FyVdmz6RXjKo64fXcX37mh78rJf9SbB1Y0Vn3keWgzcUNS1sJNOXUn1XL0/XG8/FPiVjyoc9PtfivP79CBS4PoUCQPD/4rT5ba3JpFYMjOcF5x6s3SlXh3LD7pfgKbCrFmYNp0cB6LLbp1a4RuQIn2YErZ+vV1nsVvJH3V6LXnGQs45GjrMiBtuKK0Ng0o71Jxv0xRShcRg1cGPtdYXKo0+CfTNFOwSaUDnChtbeKYSJbM3Fsj54svmgnply6ERDRvDqwuPIPG8RsGpBgN9RVFxcTxnpGMIKNRQwxbb4I4qVL92xVj+n0jmwH5QP1Ix+pb0loRojMY+Wnh5KXOmTo8ngmM4H064ghR/w3PaVd9XXWKs813t4NYsh0bEoSn447zd8mu+z7t9PklC/ufudUGnCG73XrFCPcKCeY8aX3Ow28EYKxbQ1kLn7/ck0RCE9MuSJ7phBsPirG5DdanaetpgJSbvS4IjMaAXPWiP4/2YKC76iUnX 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)(82310400014)(1800799015)(36860700004)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2024 16:18:38.3847 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51e08ce6-f398-422c-b745-08dc54c2e2b7 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: DB1PEPF000509FD.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6660 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_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 List-Id: On 4/4/24 07:48, Gustavo Romero wrote: > This commit adds a new packet, qMemTagAddrCheck, allowing GDB remote > targets to use it to query the stub if a given address is tagged. I'm not a big fan of the packet name, but naming those things is sometimes hard. So here goes my attempt. Based on the target hook, how about qAddressIsTagged? > > It also adds a new GDB remote feature, 'memory-tagging-check-addr', And the above could be adjusted to "memory-tagging-address-check+"? Just trying to make things a bit more clear and less abbreviated (guilty of doing that myself sometimes!). > which must be advertised by the GDB stub to inform it can reply to > memory tagging address checks via the new qMemTagCheckAddr packet. > > Currently, the memory tagging address check is done via a read query, > where the contents of /proc//smaps is read and the flags are > inspected for memory tagging-related flags that indicate the address is > in a memory tagged region. > > This is not ideal, for example, for QEMU stub and other cases, such as > on bare-metal, where there is no notion of an OS file like 'smaps.' > Hence, the qMemTagCheckAddr packet allows checking addresses in an > OS-agnostic way. > > The is_address_tagged target hook in remote.c uses the qMemTagCheckAddr > packet to check an address if the stub advertises the > 'memory-tagging-check-add+' feature, otherwise it falls back to using > the current mechanism, which reads the contents of /proc//smaps via > vFile requests. > > Signed-off-by: Gustavo Romero > --- > gdb/remote.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 53 insertions(+), 1 deletion(-) > > diff --git a/gdb/remote.c b/gdb/remote.c > index 9717db55e27..94ac8520740 100644 > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -337,6 +337,9 @@ enum { > packets and the tag violation stop replies. */ > PACKET_memory_tagging_feature, > > + /* Support checking if an address is tagged via qMemTagCheckAddr packet. */ > + PACKET_memory_tagging_check_addr_feature, > + > PACKET_MAX > }; > > @@ -758,6 +761,10 @@ struct remote_features > bool remote_memory_tagging_p () const > { return packet_support (PACKET_memory_tagging_feature) == PACKET_ENABLE; } > > + bool remote_memory_tagging_check_addr_p () const > + { return packet_support (PACKET_memory_tagging_check_addr_feature) == > + PACKET_ENABLE; } > + > /* Reset all packets back to "unknown support". Called when opening a > new connection to a remote target. */ > void reset_all_packet_configs_support (); > @@ -5764,6 +5771,8 @@ static const struct protocol_feature remote_protocol_features[] = { > { "no-resumed", PACKET_DISABLE, remote_supported_packet, PACKET_no_resumed }, > { "memory-tagging", PACKET_DISABLE, remote_supported_packet, > PACKET_memory_tagging_feature }, > + { "memory-tagging-check-addr", PACKET_DISABLE, remote_supported_packet, > + PACKET_memory_tagging_check_addr_feature }, > }; > > static char *remote_support_xml; > @@ -5875,6 +5884,10 @@ remote_target::remote_query_supported () > != AUTO_BOOLEAN_FALSE) > remote_query_supported_append (&q, "memory-tagging+"); > > + if (m_features.packet_set_cmd_state (PACKET_memory_tagging_check_addr_feature) > + != AUTO_BOOLEAN_FALSE) > + remote_query_supported_append (&q, "memory-tagging-check-addr+"); > + > /* Keep this one last to work around a gdbserver <= 7.10 bug in > the qSupported:xmlRegisters=i386 handling. */ > if (remote_support_xml != NULL > @@ -15534,6 +15547,21 @@ create_store_memtags_request (gdb::char_vector &packet, CORE_ADDR address, > strcpy (packet.data (), request.c_str ()); > } > > +static void > +create_is_address_tagged_request (gdb::char_vector &packet, CORE_ADDR address) > +{ > + int addr_size; > + std::string request; > + > + addr_size = gdbarch_addr_bit (current_inferior ()->arch()) / 8; You should add another argument to create_is_address_tagged_request to pass in the gdbarch, then you can use it when invoking gdbarch_addr_bit. > + request = string_printf ("qMemTagCheckAddr:%s", phex_nz (address, addr_size)); > + > + if (packet.size () < request.length () + 1) > + error (_("Contents too big for packet qMemTagCheckAddr.")); > + > + strcpy (packet.data (), request.c_str ()); > +} > + > /* Implement the "fetch_memtags" target_ops method. */ > > bool > @@ -15580,7 +15608,27 @@ remote_target::store_memtags (CORE_ADDR address, size_t len, > bool > remote_target::is_address_tagged (gdbarch *gdbarch, CORE_ADDR address) > { > - return gdbarch_tagged_address_p (gdbarch, address); > + struct remote_state *rs = get_remote_state (); > + > + if (!m_features.remote_memory_tagging_check_addr_p ()) > + /* Fallback to arch-specific method of checking whether an address is > + tagged. */ > + return gdbarch_tagged_address_p (gdbarch, address); > + > + create_is_address_tagged_request (rs->buf, address); Here you can pass the gdbarch you've already obtained from the incoming argument of is_address_tagged. > + > + putpkt (rs->buf); > + getpkt (&rs->buf); > + > + /* Check if reply is OK. */ > + if (packet_check_result (rs->buf).status () != PACKET_OK) > + return false; > + > + gdb_byte tagged_addr; > + /* Convert only 2 hex digits, i.e. 1 byte in hex format. */ > + hex2bin (rs->buf.data (), &tagged_addr , 1); > + > + return tagged_addr != 0; The current code assumes any reply != 0 means we have a tagged address. I think we need to make that a bit more strict/explicit (in the documentation as well). If we get a reply that is not 00 or 01, should we error out or issue a complaint? If we plan on extending the packet to account for other return values, we should make that known in the code and in the documentationm abd take appropriate action. That way we avoid causing confusion for remote debugging stub implementors. > }> > /* Return true if remote target T is non-stop. */ > @@ -16066,6 +16114,10 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL, > add_packet_config_cmd (PACKET_memory_tagging_feature, > "memory-tagging-feature", "memory-tagging-feature", 0); > > + add_packet_config_cmd (PACKET_memory_tagging_check_addr_feature, > + "memory-tagging-check-addr-feature", > + "memory-tagging-check-addr-feature", 0); > + > /* Assert that we've registered "set remote foo-packet" commands > for all packet configs. */ > { To make sure the new packet is exercised correctly when the gdb testsuite is executed, it is worth adding some self tests. See remote.c:test_memory_tagging_functions for an example of how it is done. Basically we want to validate that gdb always handles things correctly and fails gracefully. For example, we should handle the following replies: - EXX (error) - 00/01 (the expected return values) - Any other numeric combinations of any arbitrary length - Any other mix of numeric/non-numeric data of any arbitrary length Pending the items above, the code looks OK to me. Also, I've validated things on my end as well, and MTE still works fine for native/core/remote (gdbserver).