From patchwork Fri May 29 23:01:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezra Sitorus X-Patchwork-Id: 136106 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 071FC4BA7986 for ; Fri, 29 May 2026 23:03:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 071FC4BA7986 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=f11HbTMD; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=f11HbTMD X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011050.outbound.protection.outlook.com [52.101.70.50]) by sourceware.org (Postfix) with ESMTPS id 0515A4BA23F3 for ; Fri, 29 May 2026 23:02:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0515A4BA23F3 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 0515A4BA23F3 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=52.101.70.50 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1780095753; cv=pass; b=YHYT1Mhe+/Xa5GJvg7ja96b77KavNx3VbryHA4duxA/5q8sfKiK809J6ps3Wa8fzRebPMU7Gqee1dYh/LwvaYSZh4m8jQU1Y3+iVg4MjY4PxF1dOnT4yAZq948Sz9dtKHMLaV3rnXSw+e03jTHbdn5ZT6p6dlB60EDTCHUZciec= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1780095753; c=relaxed/simple; bh=kMYC61g2s7N7HZIuWlMV4hucxmPXvETFEa0KVDgFPms=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=f+hvn2E3rD2Jky5j4DCxScgw51d6gNGEP7ldD6BR8V6NXwl+kjl7Gic0AZqfVY1pYwHp4BXy3NNpODTPy/B9fLYB5QiARlQxIQ0hsXGNkEAHyXw+5GridCX2ZayMv46ewD8zIrkkMquvA4dN95d/H2wkKZKTfI/r9qMbrtedaig= ARC-Authentication-Results: i=3; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=f11HbTMD; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=f11HbTMD DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0515A4BA23F3 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=Ii7niiiGg4La47ZYe5erqZgr9FSKc1625HEQLRkba3007Zb4qZ9NWbm0OMm+4M7w1klPmX5oZoKsxZV7WI7IXYDc6Hel+ogjYIkRJbk0oWK30lObl/jVkHuqJkMfvAGVcU0f74qU+u3jkUDoRR9bDscQYDLp5L2chgypeR5c+S+YaaxyH95CZItAyClbDBeCWYuJDtBCYVK1zT8F7HE8OKZVHJ3v8ILSZKhcOcSJ7UXf9yyTqItM4K6jsZgltGaF3269oh2dOgdlYT/zWVPj/5/VpwxTRsyFKp6UM9oVRrcegjd9s1PQai6TU2dN+pInBEVvviwLJphHRN0dXjoXCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=4mOIr0WCdab4ak4SroIOl5vsj2tiCaLp5qMciEOFLM4=; b=Kot1iqoRoTziR5EY/P3t6WbXzRM1yQ07s58XtpdiPHjzQmgCBWGsIJFtCT4++1zj+72dhwuIE26yxrCBoLvO+VyHocbrWb4QOJwRJL2iZaxoDMQNgaij5W2FIBSbt3gpuOBGd2nwefXCASkKE7WBXhVCM0uNfEAfwIGhzUHZMbQNPnFrCS1T9PLJQW9el2Ysr3KkcjYFGPt9OBAnBHBjGSJTxrYKsz+MdOLTkp2uv7RvllVr6lMn/nT4ojyCz6dItELI0HhlojujFvyh+0s8PUsd1Y7finP4INNTwSr1Pfu79tQpVrWuA8S1fE6t9n9OHDM8XmT0armidA3OxjWoYg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) 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=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4mOIr0WCdab4ak4SroIOl5vsj2tiCaLp5qMciEOFLM4=; b=f11HbTMD+nx8raWWmfzpyJUuPeewqITg3OvwfHnJQ3oR+97b9ia8gDGWu2h1ZojfB23aV4AuwSoCYaxNkBe4Y5ckU6ylNdrHsVgIjsAC/0XGw79nwfu8NDSj6bMveKp4Z3uxbcPk4ns1Z4+1oygKNCMRgOzDrPlgcqBCGUOBlU4= Received: from DUZPR01CA0191.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::20) by DU0PR08MB10325.eurprd08.prod.outlook.com (2603:10a6:10:471::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.71.15; Fri, 29 May 2026 23:02:17 +0000 Received: from DB1PEPF000509EB.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::86) by DUZPR01CA0191.outlook.office365.com (2603:10a6:10:4b6::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.71.15 via Frontend Transport; Fri, 29 May 2026 23:02:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 4.158.2.129 as permitted sender) receiver=protection.outlook.com; client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by DB1PEPF000509EB.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.71.7 via Frontend Transport; Fri, 29 May 2026 23:02:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jh/IziUoWiUeXK75MQAnOPhT27i261KjrNncPp5SMQItkQOgFqUKXxQMvMngN6y2uVTGriRntoFCZy6gBmb/B7qZn28XDjdghcA/+haSjOrZ6IzcdoOawlvt4V26/PF54rtVnkcEaxUi6ctw4j8iLPeD5E7qMvuOSp2rWc18qvHFBHK6cRqjs5Bdjq69JJQbFGH7c4BamMt7xtyBsh/0CrSJnlYwK4LKkya5znmRq13+9b9yjyISocSfiS9CWH/rFXJphyNFPbv5vT6su059tBs4aKZloHPxOxZo7JTk9Q0vmTOVbXIQUM2efi4ES1xBp3a9N8UxG/2BdfAmdgNWQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=4mOIr0WCdab4ak4SroIOl5vsj2tiCaLp5qMciEOFLM4=; b=gKS0r5LDq/v9nNCJXzs8viy9FVLLaBI33rn7kWtkwgf54H6Cwf2ID0IqvaWRcHhPfbbQSf/RWbVUNSu+yPx7Tp5qUk4CXAz1hdzgc4b2oWy0piHoCio1sqU6xwqxA6KusDXZP0SR/zy/SzkCdZgL75jkOzE2reQxwmN82zmHLQFWBFjviNqc+1WsAP52YnghVcDJ0Ahqw3viXZxA3Hb6xcnK3DQHxsNfCPDVgnMssLRYlYeXgPglqbv4Qo8p6chUPY+sNjhr0wlXCMh1uWgW8bBtq+PJVx+vVIyhG7fZJBS1jofyCDWKECepvytCI201gluJKyDIcUlCYRD8tVuPGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 172.205.89.229) 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4mOIr0WCdab4ak4SroIOl5vsj2tiCaLp5qMciEOFLM4=; b=f11HbTMD+nx8raWWmfzpyJUuPeewqITg3OvwfHnJQ3oR+97b9ia8gDGWu2h1ZojfB23aV4AuwSoCYaxNkBe4Y5ckU6ylNdrHsVgIjsAC/0XGw79nwfu8NDSj6bMveKp4Z3uxbcPk4ns1Z4+1oygKNCMRgOzDrPlgcqBCGUOBlU4= Received: from AS4P191CA0011.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d5::9) by PA6PR08MB10595.eurprd08.prod.outlook.com (2603:10a6:102:3d1::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.71.12; Fri, 29 May 2026 23:01:11 +0000 Received: from AM4PEPF00027A66.eurprd04.prod.outlook.com (2603:10a6:20b:5d5:cafe::73) by AS4P191CA0011.outlook.office365.com (2603:10a6:20b:5d5::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.71.15 via Frontend Transport; Fri, 29 May 2026 23:01:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 172.205.89.229) 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 172.205.89.229 as permitted sender) receiver=protection.outlook.com; client-ip=172.205.89.229; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (172.205.89.229) by AM4PEPF00027A66.mail.protection.outlook.com (10.167.16.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.92.5 via Frontend Transport; Fri, 29 May 2026 23:01:11 +0000 Received: from AZ-NEU-EX03.Arm.com (10.240.25.137) by AZ-NEU-EX04.Arm.com (10.240.25.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Fri, 29 May 2026 23:01:10 +0000 Received: from D2G2X7XGD1.arm.com (10.57.93.232) by mail.arm.com (10.240.25.137) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Fri, 29 May 2026 23:01:10 +0000 From: To: CC: , , , Ezra Sitorus Subject: [PATCH v3] gdb/aarch64: record/replay support for LRCPC3 Date: Sat, 30 May 2026 00:01:09 +0100 Message-ID: <20260529230109.4123-1-Ezra.Sitorus@arm.com> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A66:EE_|PA6PR08MB10595:EE_|DB1PEPF000509EB:EE_|DU0PR08MB10325:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f36cf10-302e-4c62-8268-08debdd65461 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700016|13003099007|18002099003|56012099006|6133799003|5023799004|11063799006|3023799007; X-Microsoft-Antispam-Message-Info-Original: LmH9cdwGs2bV+6vPaNhNDkPekDqY6Ijzv3HdwVdXmmDUnje4nqYg2hOHQq0c8C8efYvZESTcGR8gc36lFn2Lch6zEuPA2IED1TRqaFrpdF+TA8qxvMulTzhkO2PzTi1cCRiD2rHjkxOcFQBL2tn7KgVUGwJZPi6wJSf3D6U/lYq7YiWh3UqOHqGm3wJnEa09DNywe0dw+cCPv99dBzfG7g4QdpxRBmDsudYibfBkb/wZBzoLHhYHEr0E2SSAR6+0HFQ07WrXkvpZf8BIzVZ4T6mcQGZ0aRFkeuEjYjSqvoRLVhRiHFeZihlF5t3u4CYcpfIVEP6ga2XbSpTXNGQHoYL9vZaUCXtO/C4ddlfY8zOu7TTqwqqhB0boIoh0X80ccX/ZONv1MRnKjwq6HpIplSnvJHxdmzQEXvon59c20QTXyl++t3sluKNFQ4tXOjIv+u3tx+8FTXYUGpbDr35B+sZcy7/Ltar1rDOM3hIiDRLEdAvyPk+gfce4ZrCNDN5vJUxoNcS5CJxnNipCmiR7P0u+rJPBCUbBydpHlY3ocTvcocWfLO13j1lYE9UHrVzk6Y53YDPZ80+L09kMcgNjl9+QPTcwyRisp8jdBSPSBAGWHhYKZZj01EgcXIZg+mQ8HkbXCNdirCQjCiAnPW/26BK8sEVmOK3mDdJnir4J6euKAM5GLU9wBAqSYp6BE5Vp X-Forefront-Antispam-Report-Untrusted: CIP:172.205.89.229; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(1800799024)(36860700016)(13003099007)(18002099003)(56012099006)(6133799003)(5023799004)(11063799006)(3023799007); DIR:OUT; SFP:1101; X-Exchange-RoutingPolicyChecked: VG1JJG1+9YCM0hpQUnrA88TEXc1Ts0pnRT3i0nnPLS9HfnDgYtEd9Hvi/dtmjwFGOxr3V1ulBUec/59mG0XkUc0Q/DqEb0/K7f7BliOsaMoIIWU8mlwKNGbQGZgIUe2gvT1Nx8IiPKOilQYlAFNsbd0OLpY4SLfF426sLplar3pLUxVncxcqnr9ZdJ68CELihtN6sp4y10NBEKaiZFzySRyxO3A+WJYxQBoXdOuY1qoMVXDlwSTC+If5zvLCxCnb0Z03AoYpU97aGOtAUjk8K+sY+9ls2JHWXy0wFDBmifI5+iKtv+uooiKQS7snuo8obKJpcIyG9lo8bccdoQ4Q4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA6PR08MB10595 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF000509EB.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a53be57b-eebd-44e3-89c4-08debdd62d48 X-Microsoft-Antispam: BCL:0; ARA:13230040|14060799003|1800799024|82310400026|376014|35042699022|36860700016|13003099007|18002099003|6133799003|56012099006|11063799006|5023799004|3023799007; X-Microsoft-Antispam-Message-Info: 0xmpmB/KEvlAOfqC9ButeRHO8LI7rJwtFO7CPIjEea4gBya3H5zOSoPJnWENl2XVBbjO8+a0sMYqe5g8baNrDfbu0I4nLYO/5fvx4T9lDnqlcK6w/57X8xW6j7pkyHoZHGFVk463RDEsVpgJQi4pMCgvqDdg89at63GEuRphbuuvq0zRh6+QGQzY2RrrU6BAVG3sMFzUbn0crZoLcCoxovA90bJ75LPjXLR4skkJsDs8OpkMTbTebV2sktM9pjx6giTCEj8+CW68xW0912JrdWvfKonkekQQeW/rFxaAODuWBHDzhFEPVaYf6cJNS6nT22zHS9eW0Zt8xl9NWVgOZJtsglEGhyHI6kD+ZImEOb7Ckz2/gnmjHcC9/2PXUjyUoOf4+c3iDWnglGtGZbU+reF69nl6NYPlOgE2giz+7iJPhuPDmFGimsJI5wT46xKn+6hsCEN0WgsPlwVShm5UE9ZcxNqaShc6cySktY0AOpK0qdTCeODEEvQrjtv0Y7hyms4ni48OMzDRCnUHhWcVkqNHhRk0IntC6GOEZ7Hw2b5Fl3VthtZAk5iW5qI3fVp3pi9XSXjlBxSMqwMUVTy9QyZFozP1XrfiJreIoHB034ox7Glmxj/xoKGagAaftGja0U5MltD9lO3NwUMQzkTKzODoCh0BpMx2d7lKSHh/JhZl2a5olaCngtsPOlQ5g5fM X-Forefront-Antispam-Report: CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(14060799003)(1800799024)(82310400026)(376014)(35042699022)(36860700016)(13003099007)(18002099003)(6133799003)(56012099006)(11063799006)(5023799004)(3023799007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TVI1AQryS+SA+tJh0VW8dSFhilQOzhmwfBebd3QkQ0lEPBYXFZLnwJrUCRmKJ74YhbrabZ7qla008JkRcfksunmkyuUIukKwYib9cbyaSTQ+2jfZ1adqzwttF0is47Yu4oO9esTeYwLuzhNF9lSzrd4CK+0uT1gYgyfcr+XIKpohNZoDU1vh1yleEfpkamBFSV+7DBcU8yIgBBmASMPmq/H6F4+sFyF0qAT4a+Mvo34IPJQnXkPjWOfTdCxFpBAWsNOvJzCbBVfI8nWuK6Tx89jJvloziaIhPKh9wWBhbToYIVJ0TOcfm0Yrgd9qeF6IROae1snLSlkpNtCO05MEsSrL6av24dtr3AdfZ9fQpartUCixE+tObaEIQmSuIpYPKGdI2MKhioBzV+sAKu+1e9FCzfh4B4mHXsqbjhepACOjrgb/K8qIEufBeeQ9rASZ X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2026 23:02:16.8457 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f36cf10-302e-4c62-8268-08debdd65461 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129]; Helo=[outbound-uk1.az.dlp.m.darktrace.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509EB.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB10325 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_SHORT, PROLO_LEO1, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, URIBL_BLOCKED shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 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~patchwork=sourceware.org@sourceware.org From: Ezra Sitorus FEAT_LRCPC3 introduces various load/store instructions with release consistency for cases where ordering is required. This patch teaches GDB to decode these instructions for recording and reversing. The gdb.reverse/aarch64-lrcpc3.exp testcase verifies that the instructions are recorded and correctly reversed. In particular, there are some interesting cases to note: * ldapur/stlur are SIMD instructions, but are not decoded in the simd function. * There are writeback cases to cover too. These were taken from the binutils testcases: gas/testsuite/gas/aarch64/rcpc3.s. The full testsuite was done on aarch64-none-linux-gnu without LRCPC3. The gdb.arch and gdb.reverse tests were run on Shrinkwrap with LRCPC3 support. Please note: 1) There is no support for LRCPC and LRCPC2 instructions 2) LRCPC3 is gated with +rcpc3 in GCC/binutils and LLVM. --- Changes from v2: * Renamed the constant to HWCAP2_LRCPC3. * Fixed up the HWCAP bit check. It fails correctly on systems without LRCPC3 support. * Cleaned up the test argument lists. Ezra gdb/aarch64-tdep.c | 87 ++++++++ gdb/testsuite/gdb.reverse/aarch64-lrcpc3.c | 216 +++++++++++++++++++ gdb/testsuite/gdb.reverse/aarch64-lrcpc3.exp | 190 ++++++++++++++++ gdb/testsuite/lib/gdb.exp | 59 +++++ 4 files changed, 552 insertions(+) create mode 100644 gdb/testsuite/gdb.reverse/aarch64-lrcpc3.c create mode 100644 gdb/testsuite/gdb.reverse/aarch64-lrcpc3.exp diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 673815c2..0cce4072 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -5812,6 +5812,93 @@ aarch64_record_load_store (aarch64_insn_decode_record *aarch64_insn_r) aarch64_insn_r->reg_rec_count = 1; } } + /* LRCPC3 instructions. This covers ldiapp/stilp, ldapur/stlur (FP/SIMD), + ldapr/stlr. */ + else if ((insn_bits24_27 & 0x0b) == 0x09 && insn_bits28_29 == 0x01 + && insn_bits10_11 == 0x02 && !insn_bit21) + { + /* ldapur/stlur (FP/SIMD), ldapr/stlr. We can differentiate between the + 2 types by checking the vector flag. */ + if (insn_bit23 || vector_flag) + { + /* For the vector instruction, the offset comes from the imm9 + bitfield, whereas the other can only take possible values from the + size bitfield. */ + int16_t imm9_off = sbits (aarch64_insn_r->aarch64_insn, 12, 20); + offset = vector_flag ? imm9_off : -(1 << size_bits); + uint32_t regnum_offset = vector_flag ? AARCH64_V0_REGNUM : 0; + if (ld_flag) + { + record_buf[0] = reg_rt + regnum_offset; + aarch64_insn_r->reg_rec_count = 1; + if (!vector_flag) + { + /* The Rn register always has writeback in LRCPC3. This is + not the case in LRCPC. */ + record_buf[1] = reg_rn; + aarch64_insn_r->reg_rec_count = 2; + } + } + else + { + regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn, + &address); + /* (vector_flag && insn_bit23) is the STLUR instruction with Q + register. */ + datasize = (vector_flag && insn_bit23) ? 128 : (8 << size_bits); + /* LRCPC3 adds STLR with a pre-indexed offset. There is another + STLR variant without offset but this has a different encoding. */ + if (!vector_flag) + { + record_buf[0] = reg_rn; + aarch64_insn_r->reg_rec_count = 1; + } + record_buf_mem[0] = datasize >> 3; + record_buf_mem[1] = address + offset; + aarch64_insn_r->mem_rec_count = 1; + } + } + else + { + /* ldiapp/stilp. */ + uint8_t opc2 = bits (aarch64_insn_r->aarch64_insn, 12, 15); + reg_rt2 = bits (aarch64_insn_r->aarch64_insn, 16, 20); + if (ld_flag) + { + record_buf[0] = reg_rt; + record_buf[1] = reg_rt2; + aarch64_insn_r->reg_rec_count = 2; + + /* If the registers don't match and there's no offset then + there's WB. */ + if (reg_rn != reg_rt && reg_rn != reg_rt2 && opc2 == 0) + { + record_buf[2] = reg_rn; + aarch64_insn_r->reg_rec_count = 3; + } + } + else + { + datasize = 8 << size_bits; + regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn, + &address); + offset = (opc2 == 0) ? (2 << size_bits) : 0; + address -= offset; + + record_buf_mem[0] = datasize >> 3; + record_buf_mem[1] = address; + record_buf_mem[2] = datasize >> 3; + record_buf_mem[3] = address + (datasize >> 3); + aarch64_insn_r->mem_rec_count = 2; + + if (offset != 0) + { + record_buf[0] = reg_rn; + aarch64_insn_r->reg_rec_count = 1; + } + } + } + } /* Load/store register (register offset) instructions. */ else if ((insn_bits24_27 & 0x0b) == 0x08 && insn_bits28_29 == 0x03 && insn_bits10_11 == 0x02 && insn_bit21) diff --git a/gdb/testsuite/gdb.reverse/aarch64-lrcpc3.c b/gdb/testsuite/gdb.reverse/aarch64-lrcpc3.c new file mode 100644 index 00000000..d61d3239 --- /dev/null +++ b/gdb/testsuite/gdb.reverse/aarch64-lrcpc3.c @@ -0,0 +1,216 @@ +/* This test program is part of GDB, the GNU debugger. + + Copyright 2024-2026 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include +#include +#include + +#define INITIAL_STRING "This is just some string." +#define BUF_SIZE sizeof (INITIAL_STRING) + +#define PREPARE_SRC_AND_PTR(OFFSET) \ + strcpy (src, INITIAL_STRING); \ + __asm__ volatile ("mov x21, %0" \ + : \ + : "r"((uint64_t *)((uint8_t *)src + (OFFSET))) \ + : "x21") + +#define PREPARE_GPR(OFFSET) \ + __asm__ volatile ("mov x19, #0\n" ::: "x19"); \ + __asm__ volatile ("mov x20, #0\n" ::: "x20"); \ + PREPARE_SRC_AND_PTR (OFFSET) + +#define PREPARE_VECTOR_REG(OFFSET) \ + __asm__ volatile ("movi v22.2d, #0\n" ::: "v22"); \ + PREPARE_SRC_AND_PTR (OFFSET) + +int +main (void) +{ + alignas (16) char src[BUF_SIZE]; + + PREPARE_GPR (0); + /* Before ldiapp-0. */ + __asm__ volatile ("ldiapp x19, x20, [x21]\n" : : : "x19", "x20", "memory"); + /* After ldiapp-0. */ + + PREPARE_GPR (0); + /* Before ldiapp-1. */ + __asm__ volatile ("ldiapp w19, w20, [x21]\n" : : : "x19", "x20", "memory"); + /* After ldiapp-1. */ + + PREPARE_GPR (0); + /* Before ldiapp-2. */ + __asm__ volatile ("ldiapp x19, x20, [x21], #16\n" + : + : + : "x19", "x20", "x21", "memory"); + /* After ldiapp-2. */ + + PREPARE_GPR (0); + /* Before ldiapp-3. */ + __asm__ volatile ("ldiapp w19, w20, [x21], #8\n" + : + : + : "x19", "x20", "x21", "memory"); + /* After ldiapp-3. */ + /* Register overlap between source and destination registers. Since there is + no offset, writeback is disabled. */ + + PREPARE_GPR (0); + /* Before ldiapp-4. */ + __asm__ volatile ("ldiapp x21, x20, [x21]\n" : : : "x20", "x21", "memory"); + /* After ldiapp-4. */ + + PREPARE_GPR (0); + /* Before ldiapp-5. */ + __asm__ volatile ("ldiapp w21, w20, [x21]\n" : : : "x20", "x21", "memory"); + /* After ldiapp-5. */ + + PREPARE_GPR (0); + /* Before stilp-0. */ + __asm__ volatile ("stilp x19, x20, [x21]\n" : : : "memory"); + /* After stilp-0. */ + + PREPARE_GPR (0); + /* Before stilp-1. */ + __asm__ volatile ("stilp w19, w20, [x21]\n" : : : "memory"); + /* After stilp-1. */ + + PREPARE_GPR (16); + /* Before stilp-2. */ + __asm__ volatile ("stilp x19, x20, [x21, #-16]!\n" : : : "x21", "memory"); + /* After stilp-2. */ + + PREPARE_GPR (8); + /* Before stilp-3. */ + __asm__ volatile ("stilp w19, w20, [x21, #-8]!\n" : : : "x21", "memory"); + /* After stilp-3. */ + /* Register overlap. Since there is no offset, writeback is disabled. */ + + PREPARE_GPR (0); + /* Before stilp-4. */ + __asm__ volatile ("stilp x21, x20, [x21]\n" : : : "memory"); + /* After stilp-4. */ + + PREPARE_GPR (0); + /* Before stilp-5. */ + __asm__ volatile ("stilp w21, w20, [x21]\n" : : : "memory"); + /* After stilp-5. */ + + PREPARE_GPR (0); + /* Before ldapr-0. */ + __asm__ volatile ("ldapr x19, [x21], #8\n" : : : "x19", "x21", "memory"); + /* After ldapr-0. */ + + PREPARE_GPR (0); + /* Before ldapr-1. */ + __asm__ volatile ("ldapr w19, [x21], #4\n" : : : "x19", "x21", "memory"); + /* After ldapr-1. */ + + PREPARE_GPR (8); + /* Before stlr-0. */ + __asm__ volatile ("stlr x19, [x21, #-8]!\n" : : : "x21", "memory"); + /* After stlr-0. */ + + PREPARE_GPR (4); + /* Before stlr-1. */ + __asm__ volatile ("stlr w19, [x21, #-4]!\n" : : : "x21", "memory"); + /* After stlr-1. */ + + PREPARE_VECTOR_REG (0); + /* Before ldap1-0. */ + __asm__ volatile ("ldap1 {v22.d}[0], [x21]\n" : : : "v22", "memory"); + /* After ldap1-0. */ + + PREPARE_VECTOR_REG (0); + /* Before stl1-0. */ + __asm__ volatile ("stl1 {v22.d}[0], [x21]\n" : : : "memory"); + /* After stl1-0. */ + + PREPARE_VECTOR_REG (0); + /* Before ldapur-0. */ + __asm__ volatile ("ldapur d22, [x21]\n" : : : "v22", "memory"); + /* After ldapur-0. */ + + PREPARE_VECTOR_REG (0); + /* Before stlur-0. */ + __asm__ volatile ("stlur d22, [x21]\n" : : : "memory"); + /* After stlur-0. */ + + PREPARE_VECTOR_REG (256); + /* Before ldapur-1. */ + __asm__ volatile ("ldapur d22, [x21, #-256]\n" : : : "v22", "memory"); + /* After ldapur-1. */ + + PREPARE_VECTOR_REG (256); + /* Before stlur-1. */ + __asm__ volatile ("stlur d22, [x21, #-256]\n" : : : "memory"); + /* After stlur-1. */ + + PREPARE_VECTOR_REG (-255); + /* Before ldapur-2. */ + __asm__ volatile ("ldapur d22, [x21, #255]\n" : : : "v22", "memory"); + /* After ldapur-2. */ + + PREPARE_VECTOR_REG (-255); + /* Before stlur-2. */ + __asm__ volatile ("stlur d22, [x21, #255]\n" : : : "memory"); + /* After stlur-2. */ + + PREPARE_VECTOR_REG (0); + /* Before ldapur-3. */ + __asm__ volatile ("ldapur h22, [x21]\n" : : : "v22", "memory"); + /* After ldapur-3. */ + + PREPARE_VECTOR_REG (0); + /* Before stlur-3. */ + __asm__ volatile ("stlur h22, [x21]\n" : : : "memory"); + /* After stlur-3. */ + + PREPARE_VECTOR_REG (0); + /* Before ldapur-4. */ + __asm__ volatile ("ldapur s22, [x21]\n" : : : "v22", "memory"); + /* After ldapur-4. */ + + PREPARE_VECTOR_REG (0); + /* Before stlur-4. */ + __asm__ volatile ("stlur s22, [x21]\n" : : : "memory"); + /* After stlur-4. */ + + PREPARE_VECTOR_REG (0); + /* Before ldapur-5. */ + __asm__ volatile ("ldapur d22, [x21]\n" : : : "v22", "memory"); + /* After ldapur-5. */ + + PREPARE_VECTOR_REG (0); + /* Before stlur-5. */ + __asm__ volatile ("stlur d22, [x21]\n" : : : "memory"); + /* After stlur-5. */ + + PREPARE_VECTOR_REG (0); + /* Before ldapur-6. */ + __asm__ volatile ("ldapur q22, [x21]\n" : : : "v22", "memory"); + /* After ldapur-6. */ + + PREPARE_VECTOR_REG (0); + /* Before stlur-6. */ + __asm__ volatile ("stlur q22, [x21]\n" : : : "memory"); + /* After stlur-6. */ + + return 0; +} diff --git a/gdb/testsuite/gdb.reverse/aarch64-lrcpc3.exp b/gdb/testsuite/gdb.reverse/aarch64-lrcpc3.exp new file mode 100644 index 00000000..b9e48147 --- /dev/null +++ b/gdb/testsuite/gdb.reverse/aarch64-lrcpc3.exp @@ -0,0 +1,190 @@ +# Copyright 2024-2026 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test instruction record for AArch64 FEAT_LRCPC3 instructions. +# Based on gdb.reverse/aarch64-mops.exp +# +# The basic flow of the record tests are: +# 1) Stop before executing the instructions of interest. Record +# the initial value of the registers that the instruction will +# change, i.e. the destination register. +# 2) Execute the instructions. Record the new value of the +# registers that changed. +# 3) Reverse the direction of the execution and execute back to +# just before the instructions of interest. Record the final +# value of the registers of interest. +# 4) Check that the initial and new values of the registers are +# different, i.e. the instruction changed the registers as expected. +# 5) Check that the initial and final values of the registers are +# the same, i.e. GDB record restored the registers to their +# original values. + +require allow_aarch64_lrcpc3_tests + +standard_testfile + +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ + [list debug additional_flags=-march=armv8-a+rcpc3]]} { + return +} + +if {![runto_main]} { + return +} + +gdb_test_no_output "record full" + +proc test_single_asm {name diff_reg diff_mem same_reg same_mem} { + with_test_prefix $name { + + set before_seq [gdb_get_line_number "Before ${name}"] + set after_seq [gdb_get_line_number "After ${name}"] + + set insn [lindex [split $name "-"] 0] + + gdb_test "break $before_seq" \ + "Breakpoint ${::decimal} at ${::hex}: file .*/aarch64-lrcpc3.c, line ${::decimal}\\." \ + "$insn before instruction sequence" + + gdb_continue_to_breakpoint "about to execute instruction sequence" \ + [multi_line ".*/aarch64-lrcpc3.c:${::decimal}" \ + "${::decimal}\[ \t\]+__asm__ volatile \\(\"${insn} .*\".*"] + + # Depending on the compiler, the line number information may put GDB a few + # instructions before the beginning of the asm statement. + arrive_at_instruction $insn + # Add a breakpoint that we're sure is at the prologue instruction. + gdb_test "break *\$pc" \ + "Breakpoint ${::decimal} at ${::hex}: file .*/aarch64-lrcpc3.c, line ${::decimal}\\." \ + "break at prologue instruction" + + # Record the initial memory and register values. + set regs [concat $diff_reg $same_reg] + set mem [concat $diff_mem $same_mem] + foreach r $regs { + set ${r}_initial [capture_command_output "info register $r" ""] + } + foreach m $mem { + set ${m}_initial [capture_command_output "x/x $m" ""] + } + + gdb_test "break $after_seq" \ + "Breakpoint ${::decimal} at ${::hex}: file .*/aarch64-lrcpc3.c, line ${::decimal}\\." \ + "$insn after instruction sequence" + gdb_continue_to_breakpoint "executed instruction sequence" \ + [multi_line ".*/aarch64-lrcpc3.c:${::decimal}" ".*"] + + # Record the new memory and register values. + foreach r $regs { + set ${r}_new [capture_command_output "info register $r" ""] + } + foreach m $mem { + set ${m}_new [capture_command_output "x/x $m" ""] + } + + # Execute in reverse to before the instruction sequence. + gdb_test_no_output "set exec-direction reverse" + + gdb_continue_to_breakpoint "reversed execution of instruction sequence" \ + [multi_line ".*/aarch64-lrcpc3.c:${::decimal}" \ + "${::decimal}\[ \t\]+__asm__ volatile \\(\"${insn} .*\".*"] + + # Record the final memory and register values. + foreach r $regs { + set ${r}_final [capture_command_output "info register $r" ""] + } + foreach m $mem { + set ${m}_final [capture_command_output "x/x $m" ""] + } + + foreach v [concat $same_reg $same_mem] { + gdb_assert ![string compare [set ${v}_initial] [set ${v}_new]] \ + "check $v initial value versus $v new value" + gdb_assert ![string compare [set ${v}_initial] [set ${v}_final]] \ + "check $v initial value versus $v final value" + } + + foreach v [concat $diff_reg $diff_mem] { + gdb_assert [string compare [set ${v}_initial] [set ${v}_new]] \ + "check $v initial value versus $v new value" + gdb_assert ![string compare [set ${v}_initial] [set ${v}_final]] \ + "check $v initial value versus $v final value" + } + + # Restore forward execution and go to end of recording. + gdb_test_no_output "set exec-direction forward" + gdb_test "record goto end" \ + [multi_line \ + "Go forward to insn number ${::decimal}" \ + "#0 main \\(\\) at .*/aarch64-lrcpc3.c:${::decimal}" \ + ".*"] + } +} + +set ldiapp_cases { + { ldiapp-0 { x19 x20 } { } { x21 } { src } } + { ldiapp-1 { w19 w20 } { } { x21 } { src } } + { ldiapp-2 { x19 x20 x21 } { } { } { src } } + { ldiapp-3 { w19 w20 x21 } { } { } { src } } + { ldiapp-4 { x21 x20 } { } { } { src } } + { ldiapp-5 { w21 w20 } { } { } { src } } +} + +set stilp_cases { + { stilp-0 { } { src } { x19 x20 x21 } { } } + { stilp-1 { } { src } { w19 w20 x21 } { } } + { stilp-2 { x21 } { src } { x19 x20 } { } } + { stilp-3 { x21 } { src } { x19 x20 } { } } + { stilp-4 { } { src } { x20 x21 } { } } + { stilp-5 { } { src } { w20 x21 } { } } +} + +set ldapr_stlr_cases { + { ldapr-0 { x19 x21 } { } { } { src } } + { ldapr-1 { w19 x21 } { } { } { src } } + { stlr-0 { x21 } { src } { x19 } { } } + { stlr-1 { x21 } { src } { w19 } { } } +} + +set ldap1_stl1_cases { + { ldap1-0 { v22 } { } { x21 } { src } } + { stl1-0 { } { src } { v22 } { } } +} + +set ldapur_stlur_cases { + { ldapur-0 { v22 } { } { x21 } { src } } + { stlur-0 { } { src } { x21 v22 } { } } + { ldapur-1 { v22 } { } { x21 } { src } } + { stlur-1 { } { src } { x21 v22 } { } } + { ldapur-2 { v22 } { } { x21 } { src } } + { stlur-2 { } { src } { x21 v22 } { } } + { ldapur-3 { v22 } { } { x21 } { src } } + { stlur-3 { } { src } { x21 v22 } { } } + { ldapur-4 { v22 } { } { x21 } { src } } + { stlur-4 { } { src } { x21 v22 } { } } + { ldapur-5 { v22 } { } { x21 } { src } } + { stlur-5 { } { src } { x21 v22 } { } } + { ldapur-6 { v22 } { } { x21 } { src } } + { stlur-6 { } { src } { x21 v22 } { } } +} + +set all_cases [concat \ + $ldiapp_cases $stilp_cases $ldapr_stlr_cases \ + $ldap1_stl1_cases $ldapur_stlur_cases] + +foreach c $all_cases { + lassign $c name diff_reg diff_mem same_reg same_mem + test_single_asm $name $diff_reg $diff_mem $same_reg $same_mem +} diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index cd59ada7..07f9c8df 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5287,6 +5287,65 @@ gdb_caching_proc allow_aarch64_fpmr_tests {} { return $allow_fpmr_tests } +# Run a test on the target to see if it supports AArch64 LRCPC3 (Load-Acquire +# RCpc instructions) extensions. Return 1 if so, 0 if it does not. Note this +# causes a restart of GDB. + +gdb_caching_proc allow_aarch64_lrcpc3_tests {} { + global srcdir subdir gdb_prompt inferior_exited_re + + set me "allow_aarch64_lrcpc3_tests" + + if { ![is_aarch64_target] } { + return 0 + } + + # Take the opportunity to check whether the toolchain knows about LRCPC3. + set compile_flags "{additional_flags=-march=armv8-a+rcpc3}" + + # Compile a program that tests the LRCPC3 feature. + set src { + #include + #include + + /* Feature check for LRCPC3. */ + #ifndef HWCAP2_LRCPC3 + #define HWCAP2_LRCPC3 (1ULL << 46) + #endif + + int main (void) { + bool lrcpc3_supported = getauxval (AT_HWCAP2) & HWCAP2_LRCPC3; + + /* Return success if LRCPC3 is supported. */ + return !lrcpc3_supported; + } + } + + if {![gdb_simple_compile $me $src executable $compile_flags]} { + return 0 + } + + # Compilation succeeded so now run it via gdb. + clean_restart + gdb_load $obj + gdb_run_cmd + gdb_expect { + -re ".*$inferior_exited_re normally.*${gdb_prompt} $" { + verbose -log "\n$me: lrcpc3 support detected" + set allow_lrcpc3_tests 1 + } + -re ".*$inferior_exited_re with code 01.*${gdb_prompt} $" { + verbose -log "\n$me: lrcpc3 support not detected" + set allow_lrcpc3_tests 0 + } + } + gdb_exit + remote_file build delete $obj + + verbose "$me: returning $allow_lrcpc3_tests" 2 + return $allow_lrcpc3_tests +} + # Run a test on the target to see if it supports the AArch64 CSSC feature. # Return 1 if so, 0 if it does not. Note this causes a restart of GDB.