From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80051.outbound.protection.outlook.com [40.107.8.51]) by sourceware.org (Postfix) with ESMTPS id 7E1553858C56 for ; Mon, 16 May 2022 09:05:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E1553858C56 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=FMFbECZ1D+eoDdRFT+/tyJz7JjRhI1sAjoh0Nk/QWGwFIqPpgn5zD+dJtrnj9RkHOVWxFFBQiqTRzr3ntVkx0BpZZ5RniwARNwVig6N5lXqgCxt1emiggkgnDJ8dU7X8cYMatIY9iIipfcC+B9yU+6aUSDDgyPCLrMf748ZIqVRPtSeABvwIAPoG71uebn4xeKL2U0FRiK7+oo9vcuISphilCO4BfGfiMQ/rXhPI6353mL+iRzS0ZEXVVWdR8KzdojFhHd/aMGqD8ZLo6kSwEnbNk2DkoiZT4L2JbL3V2IS+h0Yg3R6M2LOYogyUQ2kgwKgNTMKa9hFb5lyyx9CvTw== 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=3gi8unVnBL6tnyCMNpZFO8wufBqheLvc94MMZggRXEg=; b=cOnXOepsN3I861E/BUVU1cZq9RgwexLiLJ8AiDTjPU7Eqt0gik8rjrhwINl1Vbrq/KwQySRYBJeA20T78IB/K7YJ4QB4vm2IY5A6SSJr1y7pWtdeNxyoSK1fAjIeNfOR2DUQa4epwVZMCI7IgPxUVkV5PN/Tnv3iS6jrIjWn1XfKemL4lYY5KCbTJYSnLT3m5pkex85PrpPzNVqgVHdmeNQ6nQzvdcGmi5WJDgi+bhsvrDeQvMBPfjZgOgvJRhDHgZcwW4O6bWvCbRqU6K9Pc3lIhYADXq23q2Yk8NjS95O4/G2ZPpBBOpUDeidstH0xbWsslKr0/Z0JrxvixAcFHg== 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]) Received: from AM6PR10CA0053.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:80::30) by DU0PR08MB7713.eurprd08.prod.outlook.com (2603:10a6:10:3bf::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Mon, 16 May 2022 09:05:53 +0000 Received: from VE1EUR03FT064.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:80:cafe::3a) by AM6PR10CA0053.outlook.office365.com (2603:10a6:209:80::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Mon, 16 May 2022 09:05:53 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT064.mail.protection.outlook.com (10.152.19.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Mon, 16 May 2022 09:05:53 +0000 Received: ("Tessian outbound 42cead292588:v119"); Mon, 16 May 2022 09:05:52 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ef93efeb857ba15b X-CR-MTA-TID: 64aa7808 Received: from cccb5e6fcb77.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F09BB6FF-A33B-45A7-8640-74A4A26CB0BB.1; Mon, 16 May 2022 09:05:46 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cccb5e6fcb77.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 16 May 2022 09:05:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=faPeKUKWO5wIMvNBoHK1h5dFynrXjAQNR8PHIDP+Zkb6uNM8uDVE8giCHkwy4gAn4ME+sW8E7YpUJLCGfn/+1/M4BxcWXnRbpKUdtHXfBbn8UVVa6hv04lGXPfuoqYc4fJT7gR6L7ZA4wqMv/Sw4wZ5gsefkdWxeDetproYwlUPSqlVRDt8soGWXafSC0/Rd1lXMsaNBxL7/YYylOiFS0gB8I5RuqsqFr67Z2XqS77qZO18gF0KnVtQkj4Dy58f0YM+hVfY0nuonJTIDsW9tBy9uT3rI6iGlgNs/XKI/oVQIAQFUlSbaAuoRn/GcBvHsFDicfTheT23pD0Oo5tkhHA== 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=3gi8unVnBL6tnyCMNpZFO8wufBqheLvc94MMZggRXEg=; b=nL7QgIreQWcNDa6V+UZY440+syr47j63SjWDYPxSUIArZHcCrkbSpHBSZrQ9Z2E4NXLukGDTuEMT6ldhxKfyAhDyeWi2IYTja/TO5Q7249mM4dA4yi9iAh8eeZFgB56McGl9qW5lL/BQIKJV55JBEhhm74Zk3GPf32412qeeqNtrnkCLbSWz3nioxtDlIGALyJYDx5P7h/dqMx50+AyFbaRX0gLG2C1Rk41SChaTK2CjUz6pcFpNVk6pzYaV8cF306mpFYnBTX550+pOhlEJhlrjIClWBj4qklbuZQf2+qDxzce8tqfMFw8yT63IRYR3tE4k1styiWVvM8rqRGs5OQ== 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 VE1PR08MB4958.eurprd08.prod.outlook.com (2603:10a6:803:108::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.17; Mon, 16 May 2022 09:05:43 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7080:6233:cf8f:a8a6]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7080:6233:cf8f:a8a6%7]) with mapi id 15.20.5250.018; Mon, 16 May 2022 09:05:43 +0000 Message-ID: <0a776760-d3b9-4007-8383-c45f1520e6ba@arm.com> Date: Mon, 16 May 2022 10:05:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Content-Language: en-US In-Reply-To: <20220513122737.2159359-1-yyc1992@gmail.com> To: gdb-patches@sourceware.org, Yichao Yu From: Luis Machado Subject: Re: [PATCH] Return the regnum for PC (32) on aarch64 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0003.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:62::15) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 2d0bab88-8293-4176-66f6-08da371b47a7 X-MS-TrafficTypeDiagnostic: VE1PR08MB4958:EE_|VE1EUR03FT064:EE_|DU0PR08MB7713:EE_ X-Microsoft-Antispam-PRVS: 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: 82nG7EFbH/aMFZmyxm7kKXnopCdiL7crfHnqDNbfiuvK9HKcIdTn4ejqOyKT09PHa/vIvc7Cj6fBJxlGLmIhgLsadvm9gUxrSw14NgOaMDWYa0dFCRIwSzOoYfBNVS/1BJ9aRTbZJQUk3wo4a85Tq4aHUlRyC8eiHeheLIlg93UXQW60402vFqZiiAQNsgXynEAAlS6LzvvqCbZXujUE8doi6uvV0jDwzcw0/iiCVFcj6tVPUNSp6ezeb+6AXRqpOR8zxB+mzBpfgbuf7sXtxQrqF2H5oMwzz+FhmOh8cdOalSroDnBDRorkkNgVcK8npQKDckMSJHFv9s2/Wdk/5WDsP4TciMzxBcmeIp5eUELjDn095ZfcZqlwJiXRhzPQIxUc/y+4XFkojaZACJ0J+wPASwxRrww/nGeT5t3DBH7sFAlnIvbI/urBtb5agS8ihWe7x3h45IYHqMHg/3MJhpPiL+rxRg2wTFHCp0X8xpsqMZgp111Y2rHS0y18T/XcLEsrfNIlN5Lb7xmKnzt4jO5eyU2L4lLBopMUVEHOqYTmSrezXQJYIasMds0947oN/2xFaG6PkldEBy3RQ9h9n1RJ9Oq2KtksF86tdhlyDK/Gm1JR8Wb8hcD3WjTKzAat/LHu2VW3NhbndygUSYzo04MfofZQEGoMn0tqVxabuPz/QRRtvvGRrwyU29I4umrmjY5EAjKJdlCNUxUFcDXap95Y9QTI+vX5/cvQ0mMNys8QkG4SkIlCBTFfb0hlL9hned7uyeR8xdPcvSvnhIuW4Bp2B6FYh2lyBHKD65lL0vIzbK9mdGhhO8/YuxQ1PTIar3wqdnZ9vYa105kBlRSUqY3/zI6woaA2sg9Q5zR6YnY94ygbKnLaLbnTDMI8dUhT 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:(13230001)(4636009)(366004)(38100700002)(2616005)(5660300002)(8936002)(6506007)(86362001)(31696002)(6916009)(2906002)(966005)(6486002)(6512007)(508600001)(316002)(186003)(31686004)(8676002)(36756003)(66946007)(66556008)(66476007)(83380400001)(44832011)(26005)(2004002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4958 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: VE1EUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d863bb78-5f42-40b8-0fc2-08da371b41bf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RhojMG5jQLbEeQ3bF2SzNsDO38ZpK7VGvSETlhUF9Q1gokIv7Rkm/kLSOVQzLPb6c08dJnWJsP+D3VZgrFNmRXKyi0uzt1iEZoibnK/an+AsJwTfIisEw7ymLYK5gZ2/DKaa8NJV0HnAyOPMKh8Hi6f8Kfp9mOkPWW7GmdWYNn0y5QKRkn47KtBfy5IuKs3yxzJPxtX7CWzn9fJ61ZmYm4jssMp4mDlpf+h5ck7j46Oi0yuX2mF/xZtU5baw2MhwzKRYIikKJaNXXQCEc/AUseLSXuNF8pYvvMg82z0cxRLYcg3UqiA6eGuPmGuuAS9FwERSUJFHfJLdTW1EYowPyZtI4RNVpcuytYkp7/wdNjYxgdMbxQ+Y1owcTIqG2MtoYf8QODbYx0CwYeQG2BFsgvhoQFn6B5l+lnrKFFNQhUpOdraZ339D03OFMhY9tdpXNko2OXhWzeA+7q6dKZRK8aMaltTC+AfGX+Qa2GrzJ9e/nuqdOrQtQR/lVqyUcLsNNnKF1NW8kLOMfgj7z2jzqQqAkCVeiYziR1+p80vFi1I2BjBqOr/HxFy8ujCCsG+DDAiRuCPjEFQ+AM6Ka6QGCbEzBENu9xQXyvoYL58joaIz6KP2a5DHgFlfOVpoEWU11cNuD4CsweBvQxZCPFfngm/pb7aOxKVyV1dA9S6vSbnXp5RxVpccQyAQiogLx/LZ68zl2gKRcUxTjKBoKQB/d5Mm90vxH04puVrwqhgtHegs7pSKyqpvX7MMpxvVLK58EcVrzWe7zTSFJg0Wg+iBvl6/q02zXZgAvoau3Jueln3PiyIq/v/Gn6NkJmSGjL2jkZ0dYeTfxsZcIpDDLWUX+9xCcjHcCVIFBDmVgHjTfFQ= 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(36860700001)(40460700003)(82310400005)(83380400001)(81166007)(36756003)(356005)(26005)(6506007)(6512007)(336012)(966005)(6486002)(316002)(44832011)(186003)(508600001)(5660300002)(2906002)(8936002)(8676002)(2616005)(47076005)(6862004)(31696002)(86362001)(31686004)(70586007)(70206006)(2004002)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2022 09:05:53.0738 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d0bab88-8293-4176-66f6-08da371b47a7 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: VE1EUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7713 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2022 09:06:00 -0000 Hi, Thanks for the patch. It looks good to me. There are just some adjustments/suggestions on the testcase itself. > This will allow the unwind info to explicitly specify a different value > for the return address than the link register. Such usage, e.g. for signal frames, > is mentioned in aadwarf64 from ARM. > > Ref https://sourceware.org/pipermail/gdb/2022-May/050091.html > --- > gdb/aarch64-tdep.c | 3 + > gdb/aarch64-tdep.h | 1 + > gdb/testsuite/gdb.arch/aarch64-unwind-pc.S | 48 +++++++++++++++ > gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp | 63 ++++++++++++++++++++ > 4 files changed, 115 insertions(+) > create mode 100644 gdb/testsuite/gdb.arch/aarch64-unwind-pc.S > create mode 100644 gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp > > diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c > index 9d06ebfe27c..f9eb455232f 100644 > --- a/gdb/aarch64-tdep.c > +++ b/gdb/aarch64-tdep.c > @@ -2219,6 +2219,9 @@ aarch64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) > if (reg == AARCH64_DWARF_SP) > return AARCH64_SP_REGNUM; > > + if (reg == AARCH64_DWARF_PC) > + return AARCH64_PC_REGNUM; > + > if (reg >= AARCH64_DWARF_V0 && reg <= AARCH64_DWARF_V0 + 31) > return AARCH64_V0_REGNUM + reg - AARCH64_DWARF_V0; > > diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h > index e4cdebb6311..aa1bedbdac6 100644 > --- a/gdb/aarch64-tdep.h > +++ b/gdb/aarch64-tdep.h > @@ -34,6 +34,7 @@ struct regset; > /* AArch64 Dwarf register numbering. */ > #define AARCH64_DWARF_X0 0 > #define AARCH64_DWARF_SP 31 > +#define AARCH64_DWARF_PC 32 > #define AARCH64_DWARF_PAUTH_RA_STATE 34 > #define AARCH64_DWARF_PAUTH_DMASK 35 > #define AARCH64_DWARF_PAUTH_CMASK 36 > diff --git a/gdb/testsuite/gdb.arch/aarch64-unwind-pc.S b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.S > new file mode 100644 > index 00000000000..8589a64fd56 > --- /dev/null > +++ b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.S > @@ -0,0 +1,48 @@ > +/* Copyright 2022-2022 Free Software Foundation, Inc. 2022-2022 -> 2022 > + > + This file is part of GDB. > + > + 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 . */ > + > + .text > + .globl main > + .type main,#function > +main: > + .cfi_startproc > + stp x29, x30, [sp, -16]! > + .cfi_def_cfa sp, 16 > + .cfi_offset x29, 0 > + .cfi_offset x30, 8 > + bl test_func > + ldp x29, x30, [sp], 16 > + .cfi_restore x29 > + .cfi_restore x30 > + .cfi_def_cfa sp, 0 > + mov x0, 0 > + ret > + .cfi_endproc > + > + .globl test_func > +test_func: > + .cfi_startproc > + // Unwind x30 to a different value > + // CFA_val_expression x30 const2u 0x1234 > + .cfi_escape 0x16, 30, 0x03, 0x0a, 0x34, 0x12 > + // CFA_val_expression pc breg30 0 > + .cfi_escape 0x16, 32, 0x02, 0x8e, 0x00 > + mov x0, x30 > + .cfi_register 32, x0 > + mov x30, 0x1234 > + ret x0 > + .cfi_endproc > diff --git a/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp > new file mode 100644 > index 00000000000..c047c7d2f1a > --- /dev/null > +++ b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp > @@ -0,0 +1,63 @@ > +# Copyright 2022-2022 Free Software Foundation, Inc. 2022-2022 -> 2022 > + > +# 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 . > + > +# This file is part of the gdb testsuite. > + > +# Test explicitly unwinding PC on aarch64 How about... "Test explicitly unwinding the PC DWARF register on aarch64"? > + > +if {![is_aarch64_target]} then { > + verbose "Skipping arm displaced stepping tests." > + return > +} > + Copy/paste problem possibly? The usual way to report this is: verbose "Skipping ${gdb_test_file_name}." > +standard_testfile .S > + > +if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { > + return -1 > +} > + > +if ![runto_main] { > + return -1 > +} > + > +proc test_reg_vals { i } { > + gdb_test "p \$pc - &main" "= 8" "p \$pc, $i" > + gdb_test "p \$x30" "= 4660" "p \$x30, $i" > +} I'd drop the argument to the proc. We can surround the proc call in a prefix instead. See below. > + > +proc test_unwind_pc { i } { > + gdb_test "si" "" "single step, $i" Instead of passing regardless of the output, can we validate that we really stepped things correctly? > + gdb_test "backtrace" \ > + ".*#1.*in main ().*" \ > + "backtrace, $i" > + gdb_test "up" "" "parent frame, $i" > + test_reg_vals "$i" > +} Drop the proc argument as well and use a prefix instead. See below. > + > +# Ready to enter the function > +gdb_test "si" "bl test_func" "call site" > +# Step through the 3 instructions in the function to make sure that > +# we have the same unwind info throughout. > +test_unwind_pc 1 > +test_unwind_pc 2 > +test_unwind_pc 3 You can make these like so, for example... with_test_prefix "1st stepi" { test_unwind_pc } with_test_prefix "2nd stepi" { test_unwind_pc } with_test_prefix "3rd stepi" { test_unwind_pc } > +# Check again after we returned > +gdb_test "si" "" "single step out" Same as before. Instead of passing regardless of the output, can we validate that we really stepped out? This would make the test more robust. > +gdb_test "backtrace" \ > + "#0\[\t \]+main ().*" \ > + "backtrace, 4" > +test_reg_vals 4 > + Given this is the final check, do we need to number it? We could just... +with_test_prefix "final" { + gdb_test "backtrace" \ + "#0\[\t \]+main ().*" \ + "backtrace" + test_reg_vals +} > +gdb_continue_to_end "aarch64-unwind-pc" At this point we've already exercised what we wanted, right? Is the above test needed?