From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id bJ8DGI9bBWY/dRkAWB0awg (envelope-from ) for ; Thu, 28 Mar 2024 07:59:11 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=C+rRlk/r; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=C+rRlk/r; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 523C91E0C0; Thu, 28 Mar 2024 07:59:11 -0400 (EDT) Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 26D171E030 for ; Thu, 28 Mar 2024 07:59:09 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 88E8F3858404 for ; Thu, 28 Mar 2024 11:59:08 +0000 (GMT) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2089.outbound.protection.outlook.com [40.107.6.89]) by sourceware.org (Postfix) with ESMTPS id E5EAF3858D1E for ; Thu, 28 Mar 2024 11:58:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E5EAF3858D1E 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 E5EAF3858D1E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.6.89 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1711627125; cv=pass; b=n7GRpaQ6/TS+WQhnuK2NdRH4aDwB1fqa9zs+uVRFX8509+RuPYyrR/h5tXtjtraLM3yxj9gHNLrwmBGhW6bKrlUXE+0RMUSMtKVb6zTliM67pDvesdZ9daEidHNwekeYh4mXEk0XyBuq/9AmyRifxFsN7GElo8fUevx5RZ8y5Ck= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1711627125; c=relaxed/simple; bh=xAaTfT+bfha6xmql2uTQwEb79j0ELlpPqTeFmPzAOKY=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:To:From: MIME-Version; b=CLbqYfdqJDJfprAQ9uRVKI68mElMyD82wWzYFl9wVKHx82ZFcqxi6XlgBvocum9AGTz4QJWCGv+R/TW2BD8N/a1Bg9jXpPGQXcgdPniZaOKzwrcohWh45OyA1CvuJCKjjhtHt4k3gLAOh0aCoxhAvo+Zm51Jr1HeH6oYLxJtpVk= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=WgsPwajKAj0YKtG2qPZIRKBPzixXEeCxJOWWR92ZiyjNw6Q6SlhItIc22VtoWpSIqiXFQGX+9aDZBKWF642WRI6dtS0g38aalxFO0+kuA934PFi0MFf8l3/DsJtMHYliGxuLawLggF7rPkTblJ685gnAxQUu1N02Yb50o6HTh5eDgRWRy2O6k6TMwKo9EN5F0CCs/OdoUzUqheVHnGQDl/kxuNbtqtACNq627i/5ps+6CSdfUry8KUZXzxYA8SrLwdk39EE2LSv4WOVgV/d4rL2Q4Agm3xjfnv9ear2TFdkr4zxrICDDHUB9BWjWSsnc6Eew01DxsuKRhKTghZ3LWw== 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=Qnl/22W6xmftL85+w4rOSaTR8nwz9WnuLCFCsyvZEhg=; b=kw3T9/JJqS5ENjnipiXHuY3DOBVIIRMT7CcwDRzdLPEu5dYAs7KRrdRHfNln3+gMUgj7H7Uo3uC0y/sWSkyrrX3ZXkQXowXEm2xO4dFp70yE/MrtUsYVIUfNcWllDMVCQce2XMwf1f4/4HqOZNHW1nr8MepOdklhjMTSkZd9rqmArOAbDj/04x/pb9pZuPMmZ5PxwNVKhHJ0TH6D+71FkQiaaw5OQrWqdv//Rh7E8LTdxHJV4tjl3nzMBlnwaxi3LmtJHsPUadEGsO/Tkgz6OeiQ6Jr88kYqK6dR+vlMisjmiw6x6OQxF3TSaTmRw++/MjPX/6QdszysHXGjzz0lFA== 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=Qnl/22W6xmftL85+w4rOSaTR8nwz9WnuLCFCsyvZEhg=; b=C+rRlk/r4X+DBVauC3NYxKFtfOP/wUl3JzjPe6gG6z9icAI7tlqPXJHqCOCQbdnFPbLSqJIODG5/AheSqieY60HiOUBsvaljWIsvD/d6MrC2yewTnCDH76zYMzN6KPB6bSw3Vef4acEnbG2wO8OU7RpOQUreHtawhIL+hDZJ+ZI= Received: from AS4PR10CA0023.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5d8::15) by GV2PR08MB9277.eurprd08.prod.outlook.com (2603:10a6:150:d5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Thu, 28 Mar 2024 11:58:34 +0000 Received: from AMS1EPF00000044.eurprd04.prod.outlook.com (2603:10a6:20b:5d8:cafe::51) by AS4PR10CA0023.outlook.office365.com (2603:10a6:20b:5d8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Thu, 28 Mar 2024 11:58:33 +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 AMS1EPF00000044.mail.protection.outlook.com (10.167.16.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Thu, 28 Mar 2024 11:58:33 +0000 Received: ("Tessian outbound dc0a9029eb2c:v300"); Thu, 28 Mar 2024 11:58:33 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e66ef6f20e9c59d6 X-CR-MTA-TID: 64aa7808 Received: from 33c466e47957.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5F6C0064-37CC-4355-B229-3B8C24018868.1; Thu, 28 Mar 2024 11:58:26 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 33c466e47957.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 28 Mar 2024 11:58:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FYYIjqyCHxhhQJB1OXdnQqAwg0A6Elo7R4Nz8T2MVCrdcQx6b61x80vPMS6AWEsUZgXHLNfoPESB1NJcK5G3/kseBotZgf0m6m0Ypbj2sleKfy1U17kBlxMIPK8ykZZB+gFBDcN7ENNIWq6BsPPvt/mNFElq2oehYA6Qytmv0FttXgHB1pbyOg1x59cVQAugN+Chf4HrcDayG1GAQHG22XMiAL8Hm+6ICMQ9Cv9S6CGmH9gpjNGjN9Ow7v9Ct/NY4oHwfjDn3mdGG1dj0ye5giWw8nEt3IfWh8UxiCxSQsO1KRwFdLm1a9x+sxxFF3rlGP9Uvsw6prx2jv7tkYHqrA== 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=Qnl/22W6xmftL85+w4rOSaTR8nwz9WnuLCFCsyvZEhg=; b=BQWgGoAzNoxlMrWz4EI/sTI+S673xVJ6XHIAOfjFt4pGxSSNGDviJoMZJJeRwGlgzZxRzwrwbjRu2/ajKrvjXT7TH836jN785oRs05DK2rjRrZZVl4ykJWkJAhvbWwmWcBV0pW6UKmDG4DQNOM4xbRG6yKgkYFmx1nj4bK8djijWVRbrMxyryjZYOCDbabhtvTvH1phPQMEA77a7S9zUQghCsKqvM4Yvn6z1EZAhKmQ2wWCrxRccUOx1VvIifS4v5ki4yfkTszOhWxhCyrgNAoZR8zOqRs1lwoelqHDAFTC21CAaj2zlclFXQIaI6NKPw3wMIIv00tMMZtP0RSPguw== 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=Qnl/22W6xmftL85+w4rOSaTR8nwz9WnuLCFCsyvZEhg=; b=C+rRlk/r4X+DBVauC3NYxKFtfOP/wUl3JzjPe6gG6z9icAI7tlqPXJHqCOCQbdnFPbLSqJIODG5/AheSqieY60HiOUBsvaljWIsvD/d6MrC2yewTnCDH76zYMzN6KPB6bSw3Vef4acEnbG2wO8OU7RpOQUreHtawhIL+hDZJ+ZI= 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 VI0PR08MB10682.eurprd08.prod.outlook.com (2603:10a6:800:205::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Thu, 28 Mar 2024 11:58:20 +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.031; Thu, 28 Mar 2024 11:58:20 +0000 Message-ID: <8e7bbf75-4914-42a3-a97c-a28beca5378e@arm.com> Date: Thu, 28 Mar 2024 11:58:17 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] gdb: Make tagged pointer support configurable. To: "Schimpe, Christina" , gdb-patches@sourceware.org References: <20240327074739.2969623-1-christina.schimpe@intel.com> <20240327074739.2969623-2-christina.schimpe@intel.com> Content-Language: en-US From: Luis Machado In-Reply-To: <20240327074739.2969623-2-christina.schimpe@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0403.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:189::12) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|VI0PR08MB10682:EE_|AMS1EPF00000044:EE_|GV2PR08MB9277:EE_ X-MS-Office365-Filtering-Correlation-Id: b576794e-8ce5-4e7c-f317-08dc4f1e64c2 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: RXATjK4Yk62oP2ElYaqXtlons7e3VjpA+McW3skNS7YzEC7khnjPgKJvU+v8+UeridgMmKqpE5FWCmpxioFOwjFXUJXMTJNAXy5DW6H8bqImfYwMF8f78kODHnTeyyIEq28O2X0F38tp3P/mS+oMZAwmtzkekl8U90SkrURL6panqrzeXqTuuv7xknXp69pZOF94bmkP2lUC5+xdUvS+NdkqS1xBzwY4Gr2s01a/ywgKxo43PPc91D2T/lN7F0z6waiigjcTtB8+6vUvnKpAofmul8fwXzHEWHF6FTbxYjxpRASpfWFQAvDA2T8xs8407dq9Zojf9B3FYe978APP1OYWxNBCZYa8s8ZeXQJeAT/6U0o1NNgT6bGTQOZVt01C4NalHhLp9rkx+4n5Az7Irv2QFqHnziJWmTsBttEAAU4vAZkmffeXbCvSv+3dTjM7EAuRPEi04n60TTvtxivFF4Ko/8Dyea4MTZIuEFY3RILZjxGJRP5S4haGnKvTceCqKQRXVP4Hedc6GeGD7qkxBxOOiXwplATDYx14vRvGyCu4BaGykjIz991JG5a8e8qxwPVTQPLl7MxB2hGpGtJMalYbo8tV1DD+xCgfIHtOHidu8tQyyA8WB1G802x1BH+qBXwKUm5jNDsjfu4IwhhDfcGRUxgp/sR8JBjBHxkfVxY= 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)(366007)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR08MB10682 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: AMS1EPF00000044.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 28bc4d6b-6d20-4243-3f6b-08dc4f1e5ca7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BlXcxdHjkcdBoLNJ6OoiEfntqA+hGpvMLwhV4fmlEZU7egCBvd3CoOal1zItufDWjVFT8+ngUcr4aYFo6ie4Wt2LB3XhKWn/QFJBFRdWsx8Vy04J8HYZQyIyb468ng3yUI7yaWQ3oAvcnsSKCjZB9VMw1UkrlyRh+pU2DteYP67YgycuwX+ZUKSco+Lf0Dqo56Hc9LCV7lUT56NAYPl7dpVGvbLA+OIjFt3TOe30L3sLAgar+Umrv1EUPjsn2rSzuFwftmWERk4XB1hethAN9e+VFE2z36mW295JVEK92SJFYlIK/cTn70Cucx81NTsKHnVg/ayEVWaYB4zVhxBSbJoFT8ibN6Amjm7xGss9LRnXI5bZEHSzJPSlt7JgrzNXNy9uAMTwWs5dS1D8VGJ0gpckNPtlkmlxMFKAl1FZSCqELk/tc7HHDBZgjs9cqiKAgPe5I22hEWDUFVnMRW//T8XbPuDEXmka1CB6meJayXx4KpePc1XHUdmtJBUWWEzMzfELQwos7gVEhHvZWYF2D9UpRayfN321SA1PyxylaztrFUOOjSBeaOPqFi0na1pCHEEqRuCZgP+DtlpDT+XAWFhE4AbT5/0ECKbAUnFNtjs2e0y9UR86s/mdMHEwyb4D9IJg4siFwDcLC5uVb+00LALGssPjyYg+rkYGtyacfKF5q4W6MsoneGkLHm3dstCPeSYb885HTLs/O9MIEuyNM40m6ZBLUrRToAytJNDliNGmklcfugHH/6tzn2TbqKG9 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)(36860700004)(1800799015)(82310400014)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2024 11:58:33.7253 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b576794e-8ce5-4e7c-f317-08dc4f1e64c2 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: AMS1EPF00000044.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB9277 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 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Hi, On 3/27/24 07:47, Schimpe, Christina wrote: > From: Christina Schimpe > > The gdbarch function gdbarch_remove_non_address_bits adjusts addresses to > enable debugging of programs with tagged pointers on Linux, for instance for > ARM's feature top byte ignore (TBI). > Once the function is implemented for an architecture, it adjusts addresses for > memory access, breakpoints and watchpoints. > > Linear address masking (LAM) is Intel's (R) implementation of tagged > pointer support. It requires certain adaptions to GDB's tagged pointer > support due to the following: > - LAM supports address tagging for data accesses only. Thus, specifying > breakpoints on tagged addresses is not a valid use case. > - In contrast to the implementation for ARM's TBI, the kernel supports tagged > pointers for memory access. > > This patch makes GDB's tagged pointer support configurable such that it is > possible to enable the address adjustment for a specific feature only (e.g > memory access, breakpoints or watchpoints). Thanks for the series. More of a general question, we're splitting the more general handling of bit removal from addresses into 3 different categories in gdb. Isn't gdbserver also affected by this change? At least for aarch64 we have non-address-bits removal. Do we need to do anything in gdbserver so it can properly handle removal of non-address-bits on its own, without the help of gdb? Also, another more general comment is related to the naming of the hooks. I suppose it is down to personal preference, but spelling out the entire word is likely to make the meaning of a function/hook clearer. For instance: gdbarch_remove_non_address_bits -> gdbarch_remove_non_addr_bits_memory Maybe we should... gdbarch_remove_non_address_bits -> gdbarch_remove_non_address_bits_memory The same applies to the other hooks and function names. wpt -> watchpoint or wpt -> hw_watchpoint bpt -> breakpoint or bpt -> hw_breakpoint > --- > gdb/aarch64-linux-nat.c | 3 +- > gdb/aarch64-linux-tdep.c | 14 +++++---- > gdb/aarch64-tdep.c | 12 +++++-- > gdb/breakpoint.c | 4 +-- > gdb/gdbarch-gen.h | 50 ++++++++++++++++++++++------- > gdb/gdbarch.c | 66 ++++++++++++++++++++++++++++++++------- > gdb/gdbarch_components.py | 54 +++++++++++++++++++++++++++----- > gdb/target.c | 4 +-- > 8 files changed, 163 insertions(+), 44 deletions(-) > > diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c > index 3face34ce79..bd02a7b2d08 100644 > --- a/gdb/aarch64-linux-nat.c > +++ b/gdb/aarch64-linux-nat.c > @@ -959,7 +959,8 @@ aarch64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p) > kernel can potentially be tagged addresses. */ > struct gdbarch *gdbarch = thread_architecture (inferior_ptid); > const CORE_ADDR addr_trap > - = gdbarch_remove_non_address_bits (gdbarch, (CORE_ADDR) siginfo.si_addr); > + = gdbarch_remove_non_addr_bits_memory (gdbarch, > + (CORE_ADDR) siginfo.si_addr); > > /* Check if the address matches any watched address. */ > state = aarch64_get_debug_reg_state (inferior_ptid.pid ()); > diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c > index 0b9784f38e4..d2d42efe305 100644 > --- a/gdb/aarch64-linux-tdep.c > +++ b/gdb/aarch64-linux-tdep.c > @@ -2458,7 +2458,7 @@ aarch64_linux_tagged_address_p (struct gdbarch *gdbarch, struct value *address) > CORE_ADDR addr = value_as_address (address); > > /* Remove the top byte for the memory range check. */ > - addr = gdbarch_remove_non_address_bits (gdbarch, addr); > + addr = gdbarch_remove_non_addr_bits_memory (gdbarch, addr); > > /* Check if the page that contains ADDRESS is mapped with PROT_MTE. */ > if (!linux_address_in_memtag_page (addr)) > @@ -2484,7 +2484,8 @@ aarch64_linux_memtag_matches_p (struct gdbarch *gdbarch, > > /* Fetch the allocation tag for ADDRESS. */ > std::optional atag > - = aarch64_mte_get_atag (gdbarch_remove_non_address_bits (gdbarch, addr)); > + = aarch64_mte_get_atag (gdbarch_remove_non_addr_bits_memory (gdbarch, > + addr)); > > if (!atag.has_value ()) > return true; > @@ -2523,7 +2524,7 @@ aarch64_linux_set_memtags (struct gdbarch *gdbarch, struct value *address, > else > { > /* Remove the top byte. */ > - addr = gdbarch_remove_non_address_bits (gdbarch, addr); > + addr = gdbarch_remove_non_addr_bits_memory (gdbarch, addr); > > /* Make sure we are dealing with a tagged address to begin with. */ > if (!aarch64_linux_tagged_address_p (gdbarch, address)) > @@ -2580,7 +2581,7 @@ aarch64_linux_get_memtag (struct gdbarch *gdbarch, struct value *address, > return nullptr; > > /* Remove the top byte. */ > - addr = gdbarch_remove_non_address_bits (gdbarch, addr); > + addr = gdbarch_remove_non_addr_bits_memory (gdbarch, addr); > std::optional atag = aarch64_mte_get_atag (addr); > > if (!atag.has_value ()) > @@ -2654,8 +2655,9 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch, > uiout->text ("\n"); > > std::optional atag > - = aarch64_mte_get_atag (gdbarch_remove_non_address_bits (gdbarch, > - fault_addr)); > + = aarch64_mte_get_atag ( > + gdbarch_remove_non_addr_bits_memory (gdbarch, fault_addr)); > + > gdb_byte ltag = aarch64_mte_get_ltag (fault_addr); > > if (!atag.has_value ()) > diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c > index 545ec872fd8..86d620bd181 100644 > --- a/gdb/aarch64-tdep.c > +++ b/gdb/aarch64-tdep.c > @@ -4582,9 +4582,15 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) > tdep->ra_sign_state_regnum = ra_sign_state_offset + num_regs; > > /* Architecture hook to remove bits of a pointer that are not part of the > - address, like memory tags (MTE) and pointer authentication signatures. */ > - set_gdbarch_remove_non_address_bits (gdbarch, > - aarch64_remove_non_address_bits); > + address, like memory tags (MTE) and pointer authentication signatures. > + Configure address adjustment for watch-, breakpoints and memory > + transfer. */ > + set_gdbarch_remove_non_addr_bits_wpt (gdbarch, > + aarch64_remove_non_address_bits); > + set_gdbarch_remove_non_addr_bits_bpt (gdbarch, > + aarch64_remove_non_address_bits); > + set_gdbarch_remove_non_addr_bits_memory (gdbarch, > + aarch64_remove_non_address_bits); > > /* SME pseudo-registers. */ > if (tdep->has_sme ()) > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index 053d17df03e..24b322b9bb4 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -2234,7 +2234,7 @@ update_watchpoint (struct watchpoint *b, bool reparse) > loc->gdbarch = v->type ()->arch (); > loc->pspace = frame_pspace; > loc->address > - = gdbarch_remove_non_address_bits (loc->gdbarch, addr); > + = gdbarch_remove_non_addr_bits_wpt (loc->gdbarch, addr); > b->add_location (*loc); > > if (bitsize != 0) > @@ -7473,7 +7473,7 @@ adjust_breakpoint_address (struct gdbarch *gdbarch, > } > > adjusted_bpaddr > - = gdbarch_remove_non_address_bits (gdbarch, adjusted_bpaddr); > + = gdbarch_remove_non_addr_bits_bpt (gdbarch, adjusted_bpaddr); > > /* An adjusted breakpoint address can significantly alter > a user's expectations. Print a warning if an adjustment > diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h > index ebcff80bb9e..ec296c86668 100644 > --- a/gdb/gdbarch-gen.h > +++ b/gdb/gdbarch-gen.h > @@ -684,19 +684,47 @@ extern CORE_ADDR gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR ad > extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype *addr_bits_remove); > > /* On some architectures, not all bits of a pointer are significant. > - On AArch64, for example, the top bits of a pointer may carry a "tag", which > - can be ignored by the kernel and the hardware. The "tag" can be regarded as > - additional data associated with the pointer, but it is not part of the address. > + On AArch64 and amd64, for example, the top bits of a pointer may carry a > + "tag", which can be ignored by the kernel and the hardware. The "tag" can be > + regarded as additional data associated with the pointer, but it is not part > + of the address. > > Given a pointer for the architecture, this hook removes all the > - non-significant bits and sign-extends things as needed. It gets used to remove > - non-address bits from data pointers (for example, removing the AArch64 MTE tag > - bits from a pointer) and from code pointers (removing the AArch64 PAC signature > - from a pointer containing the return address). */ > - > -typedef CORE_ADDR (gdbarch_remove_non_address_bits_ftype) (struct gdbarch *gdbarch, CORE_ADDR pointer); > -extern CORE_ADDR gdbarch_remove_non_address_bits (struct gdbarch *gdbarch, CORE_ADDR pointer); > -extern void set_gdbarch_remove_non_address_bits (struct gdbarch *gdbarch, gdbarch_remove_non_address_bits_ftype *remove_non_address_bits); > + non-significant bits and sign-extends things as needed. It gets used to > + remove non-address bits from pointers used for watchpoints. */ > + Do we need to make a distinction between software watchpoint / hardware watchpoints? > +typedef CORE_ADDR (gdbarch_remove_non_addr_bits_wpt_ftype) (struct gdbarch *gdbarch, CORE_ADDR pointer); > +extern CORE_ADDR gdbarch_remove_non_addr_bits_wpt (struct gdbarch *gdbarch, CORE_ADDR pointer); > +extern void set_gdbarch_remove_non_addr_bits_wpt (struct gdbarch *gdbarch, gdbarch_remove_non_addr_bits_wpt_ftype *remove_non_addr_bits_wpt); > + > +/* On some architectures, not all bits of a pointer are significant. > + On AArch64 and amd64, for example, the top bits of a pointer may carry a > + "tag", which can be ignored by the kernel and the hardware. The "tag" can be > + regarded as additional data associated with the pointer, but it is not part > + of the address. > + > + Given a pointer for the architecture, this hook removes all the > + non-significant bits and sign-extends things as needed. It gets used to > + remove non-address bits from pointers used for breakpoints. */ > + Similarly, do we need to make a distinction between software breakpoints and hardware breakpoints? > +typedef CORE_ADDR (gdbarch_remove_non_addr_bits_bpt_ftype) (struct gdbarch *gdbarch, CORE_ADDR pointer); > +extern CORE_ADDR gdbarch_remove_non_addr_bits_bpt (struct gdbarch *gdbarch, CORE_ADDR pointer); > +extern void set_gdbarch_remove_non_addr_bits_bpt (struct gdbarch *gdbarch, gdbarch_remove_non_addr_bits_bpt_ftype *remove_non_addr_bits_bpt); > + > +/* On some architectures, not all bits of a pointer are significant. > + On AArch64 and amd64, for example, the top bits of a pointer may carry a > + "tag", which can be ignored by the kernel and the hardware. The "tag" can be > + regarded as additional data associated with the pointer, but it is not part > + of the address. > + > + Given a pointer for the architecture, this hook removes all the > + non-significant bits and sign-extends things as needed. It gets used to > + remove non-address bits from any pointer used to access memory (called in > + memory_xfer_partial). */ > + > +typedef CORE_ADDR (gdbarch_remove_non_addr_bits_memory_ftype) (struct gdbarch *gdbarch, CORE_ADDR pointer); > +extern CORE_ADDR gdbarch_remove_non_addr_bits_memory (struct gdbarch *gdbarch, CORE_ADDR pointer); > +extern void set_gdbarch_remove_non_addr_bits_memory (struct gdbarch *gdbarch, gdbarch_remove_non_addr_bits_memory_ftype *remove_non_addr_bits_memory); > > /* Return a string representation of the memory tag TAG. */ > > diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c > index 9319571deba..f59e090d294 100644 > --- a/gdb/gdbarch.c > +++ b/gdb/gdbarch.c > @@ -143,7 +143,9 @@ struct gdbarch > int frame_red_zone_size = 0; > gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity; > gdbarch_addr_bits_remove_ftype *addr_bits_remove = core_addr_identity; > - gdbarch_remove_non_address_bits_ftype *remove_non_address_bits = default_remove_non_address_bits; > + gdbarch_remove_non_addr_bits_wpt_ftype *remove_non_addr_bits_wpt = default_remove_non_address_bits; > + gdbarch_remove_non_addr_bits_bpt_ftype *remove_non_addr_bits_bpt = default_remove_non_address_bits; > + gdbarch_remove_non_addr_bits_memory_ftype *remove_non_addr_bits_memory = default_remove_non_address_bits; > gdbarch_memtag_to_string_ftype *memtag_to_string = default_memtag_to_string; > gdbarch_tagged_address_p_ftype *tagged_address_p = default_tagged_address_p; > gdbarch_memtag_matches_p_ftype *memtag_matches_p = default_memtag_matches_p; > @@ -407,7 +409,9 @@ verify_gdbarch (struct gdbarch *gdbarch) > /* Skip verify of frame_red_zone_size, invalid_p == 0 */ > /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */ > /* Skip verify of addr_bits_remove, invalid_p == 0 */ > - /* Skip verify of remove_non_address_bits, invalid_p == 0 */ > + /* Skip verify of remove_non_addr_bits_wpt, invalid_p == 0 */ > + /* Skip verify of remove_non_addr_bits_bpt, invalid_p == 0 */ > + /* Skip verify of remove_non_addr_bits_memory, invalid_p == 0 */ > /* Skip verify of memtag_to_string, invalid_p == 0 */ > /* Skip verify of tagged_address_p, invalid_p == 0 */ > /* Skip verify of memtag_matches_p, invalid_p == 0 */ > @@ -910,8 +914,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) > "gdbarch_dump: addr_bits_remove = <%s>\n", > host_address_to_string (gdbarch->addr_bits_remove)); > gdb_printf (file, > - "gdbarch_dump: remove_non_address_bits = <%s>\n", > - host_address_to_string (gdbarch->remove_non_address_bits)); > + "gdbarch_dump: remove_non_addr_bits_wpt = <%s>\n", > + host_address_to_string (gdbarch->remove_non_addr_bits_wpt)); > + gdb_printf (file, > + "gdbarch_dump: remove_non_addr_bits_bpt = <%s>\n", > + host_address_to_string (gdbarch->remove_non_addr_bits_bpt)); > + gdb_printf (file, > + "gdbarch_dump: remove_non_addr_bits_memory = <%s>\n", > + host_address_to_string (gdbarch->remove_non_addr_bits_memory)); > gdb_printf (file, > "gdbarch_dump: memtag_to_string = <%s>\n", > host_address_to_string (gdbarch->memtag_to_string)); > @@ -3198,20 +3208,54 @@ set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, > } > > CORE_ADDR > -gdbarch_remove_non_address_bits (struct gdbarch *gdbarch, CORE_ADDR pointer) > +gdbarch_remove_non_addr_bits_wpt (struct gdbarch *gdbarch, CORE_ADDR pointer) > +{ > + gdb_assert (gdbarch != NULL); > + gdb_assert (gdbarch->remove_non_addr_bits_wpt != NULL); > + if (gdbarch_debug >= 2) > + gdb_printf (gdb_stdlog, "gdbarch_remove_non_addr_bits_wpt called\n"); > + return gdbarch->remove_non_addr_bits_wpt (gdbarch, pointer); > +} > + > +void > +set_gdbarch_remove_non_addr_bits_wpt (struct gdbarch *gdbarch, > + gdbarch_remove_non_addr_bits_wpt_ftype remove_non_addr_bits_wpt) > +{ > + gdbarch->remove_non_addr_bits_wpt = remove_non_addr_bits_wpt; > +} > + > +CORE_ADDR > +gdbarch_remove_non_addr_bits_bpt (struct gdbarch *gdbarch, CORE_ADDR pointer) > +{ > + gdb_assert (gdbarch != NULL); > + gdb_assert (gdbarch->remove_non_addr_bits_bpt != NULL); > + if (gdbarch_debug >= 2) > + gdb_printf (gdb_stdlog, "gdbarch_remove_non_addr_bits_bpt called\n"); > + return gdbarch->remove_non_addr_bits_bpt (gdbarch, pointer); > +} > + > +void > +set_gdbarch_remove_non_addr_bits_bpt (struct gdbarch *gdbarch, > + gdbarch_remove_non_addr_bits_bpt_ftype remove_non_addr_bits_bpt) > +{ > + gdbarch->remove_non_addr_bits_bpt = remove_non_addr_bits_bpt; > +} > + > +CORE_ADDR > +gdbarch_remove_non_addr_bits_memory (struct gdbarch *gdbarch, CORE_ADDR pointer) > { > gdb_assert (gdbarch != NULL); > - gdb_assert (gdbarch->remove_non_address_bits != NULL); > + gdb_assert (gdbarch->remove_non_addr_bits_memory != NULL); > if (gdbarch_debug >= 2) > - gdb_printf (gdb_stdlog, "gdbarch_remove_non_address_bits called\n"); > - return gdbarch->remove_non_address_bits (gdbarch, pointer); > + gdb_printf (gdb_stdlog, "gdbarch_remove_non_addr_bits_memory called\n"); > + return gdbarch->remove_non_addr_bits_memory (gdbarch, pointer); > } > > void > -set_gdbarch_remove_non_address_bits (struct gdbarch *gdbarch, > - gdbarch_remove_non_address_bits_ftype remove_non_address_bits) > +set_gdbarch_remove_non_addr_bits_memory (struct gdbarch *gdbarch, > + gdbarch_remove_non_addr_bits_memory_ftype remove_non_addr_bits_memory) > { > - gdbarch->remove_non_address_bits = remove_non_address_bits; > + gdbarch->remove_non_addr_bits_memory = remove_non_addr_bits_memory; > } > > std::string > diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py > index 7d913ade621..555bc4707c5 100644 > --- a/gdb/gdbarch_components.py > +++ b/gdb/gdbarch_components.py > @@ -1232,18 +1232,56 @@ possible it should be in TARGET_READ_PC instead). > Method( > comment=""" > On some architectures, not all bits of a pointer are significant. > -On AArch64, for example, the top bits of a pointer may carry a "tag", which > -can be ignored by the kernel and the hardware. The "tag" can be regarded as > -additional data associated with the pointer, but it is not part of the address. > +On AArch64 and amd64, for example, the top bits of a pointer may carry a > +"tag", which can be ignored by the kernel and the hardware. The "tag" can be > +regarded as additional data associated with the pointer, but it is not part > +of the address. > > Given a pointer for the architecture, this hook removes all the > -non-significant bits and sign-extends things as needed. It gets used to remove > -non-address bits from data pointers (for example, removing the AArch64 MTE tag > -bits from a pointer) and from code pointers (removing the AArch64 PAC signature > -from a pointer containing the return address). > +non-significant bits and sign-extends things as needed. It gets used to > +remove non-address bits from pointers used for watchpoints. > """, > type="CORE_ADDR", > - name="remove_non_address_bits", > + name="remove_non_addr_bits_wpt", > + params=[("CORE_ADDR", "pointer")], > + predefault="default_remove_non_address_bits", > + invalid=False, > +) > + > +Method( > + comment=""" > +On some architectures, not all bits of a pointer are significant. > +On AArch64 and amd64, for example, the top bits of a pointer may carry a > +"tag", which can be ignored by the kernel and the hardware. The "tag" can be > +regarded as additional data associated with the pointer, but it is not part > +of the address. > + > +Given a pointer for the architecture, this hook removes all the > +non-significant bits and sign-extends things as needed. It gets used to > +remove non-address bits from pointers used for breakpoints. > +""", > + type="CORE_ADDR", > + name="remove_non_addr_bits_bpt", > + params=[("CORE_ADDR", "pointer")], > + predefault="default_remove_non_address_bits", > + invalid=False, > +) > + > +Method( > + comment=""" > +On some architectures, not all bits of a pointer are significant. > +On AArch64 and amd64, for example, the top bits of a pointer may carry a > +"tag", which can be ignored by the kernel and the hardware. The "tag" can be > +regarded as additional data associated with the pointer, but it is not part > +of the address. > + > +Given a pointer for the architecture, this hook removes all the > +non-significant bits and sign-extends things as needed. It gets used to > +remove non-address bits from any pointer used to access memory (called in > +memory_xfer_partial). > +""", > + type="CORE_ADDR", > + name="remove_non_addr_bits_memory", > params=[("CORE_ADDR", "pointer")], > predefault="default_remove_non_address_bits", > invalid=False, > diff --git a/gdb/target.c b/gdb/target.c > index 107a84b3ca1..586eee2ee73 100644 > --- a/gdb/target.c > +++ b/gdb/target.c > @@ -1597,8 +1597,8 @@ memory_xfer_partial (struct target_ops *ops, enum target_object object, > if (len == 0) > return TARGET_XFER_EOF; > > - memaddr = gdbarch_remove_non_address_bits (current_inferior ()->arch (), > - memaddr); > + memaddr = gdbarch_remove_non_addr_bits_memory (current_inferior ()->arch (), > + memaddr); > > /* Fill in READBUF with breakpoint shadows, or WRITEBUF with > breakpoint insns, thus hiding out from higher layers whether