From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140082.outbound.protection.outlook.com [40.107.14.82]) by sourceware.org (Postfix) with ESMTPS id C3A9E3857822 for ; Wed, 18 May 2022 13:36:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C3A9E3857822 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=iEW5KoDnmJ8/jfHv+OJ20+kUELCxYifozgcjw0JEfWhhWwk8uKLhpu1PbCSFuCwYbbk61HuTXV/L7pRQw6LDmD9X0JOo7A4gmMe+Yk97NRINIGC+L6QqYKD3+KooiN1NkWdgmEQ7ke/9Snpr6vj36TsAt9c653SgYlXXu2alQRcLTInfvS6rC1Q9LuuuaybAp4GMjjfyT3ct8dVZa74GrQT2SDCkEBoW8+uaYwKNn3B137WlyuxY8M4sqv7EweSbboeHFKmd8T1IElXaCgZp+YUptrhU5LNwAjXoWlvrBNmLTbR/YqG0YvRtHR8w2aqBZvS7vTb5yRfDAPuQlFZCPw== 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=gv1SDmaioO2clyST20sJcT6M5DyWocx993KCLS1jtRw=; b=WanXo6NZrvFtpdt+MOovxFwT+IpcRxBqJFBMQPHf1iJc9KwjJNA1n3ROo/CV42mG2QWDj5S7PGUZUXcdz8E04zn/nD6dKQ/5Cf0A3AzNN8rwDtm/cetbc4JxRONBPD0PFQu3PjkcyGH0WVkXza45Yk3QU7AWTngDRdE7L214yrs+iT5E9GgnuKX51xWP/OktiLp721+AhBW8BGq7m8nB+NJpi0e4zJ7MrOPXWYaMeGWwRr3tIO16wzMTthg3dX3Wv+CJobQsW8HSexQsF06JO0SVqwVfPGk8D3pP9uP2XT8Ubq5LPUAm7FMZJDqJ8GoXa02TZCGurGPgTVJy5hGQCw== 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 DB7PR02CA0017.eurprd02.prod.outlook.com (2603:10a6:10:52::30) by DU0PR08MB7486.eurprd08.prod.outlook.com (2603:10a6:10:356::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Wed, 18 May 2022 13:36:54 +0000 Received: from DBAEUR03FT064.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:52:cafe::a) by DB7PR02CA0017.outlook.office365.com (2603:10a6:10:52::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.15 via Frontend Transport; Wed, 18 May 2022 13:36:54 +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 DBAEUR03FT064.mail.protection.outlook.com (100.127.143.3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14 via Frontend Transport; Wed, 18 May 2022 13:36:54 +0000 Received: ("Tessian outbound 07c1c99345b0:v119"); Wed, 18 May 2022 13:36:54 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ea37fd06a6b1dc3b X-CR-MTA-TID: 64aa7808 Received: from 7c5a167c9f46.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FDEA146E-5B1D-4E31-85BC-C0C43B0B7248.1; Wed, 18 May 2022 13:36:47 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7c5a167c9f46.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 18 May 2022 13:36:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SXaw1seEfiZy0oee5xGv28llPicTDb1UVHMXu4Eb0xJThcEAiWQ3quQl2oj33V+cAVnWLCkh4nAd53EfkH8mNv6pRd7ACXDJOkXaAR68eXPv4sOVziKWnaukn/qCiPrJvbG0ePjFC1M73PodZNXWuycShx5lUrp6mhiXTHMVMJUOLan9bpFQACVK2s/XsqhUEzbstguSx1g5pETERoiQ5ya8EbSg06dk7zSgI0Wh/+5nhHVoapYw1ZIwcC6pALVhpyhcGEyXULEikPs4dIPKdKnkXhZPQ8PuXKUJXiy/Nq0hXx8aYrRVVqdbNbnKhM0y3s19UOKPdIeLGL8o+HjEYQ== 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=gv1SDmaioO2clyST20sJcT6M5DyWocx993KCLS1jtRw=; b=avghYCH3XR3IwmOoggDWRIFPLNBuuGU13m2BX0A+rAZOxq4mmHEUvq//LLBKkKbI4l0GVPqkBJbxjpNnRbMeEIEPJHzLnv7Gb2vU9Wf5vfCATe06+6jWUTMEGEnJQqoK8DrOCodsfdtdPGLYx3WvMxBxIBFYMNotke84wkwJLs9KKIckTxJngP0uO5onhlAMI2nXOyRX4BHtyVAydOnweq8B6jxU604m5WF7e5QCdF7hwt3PM1toXT6D94rmGoWtGBPr2ipom81v6EhsqNI/yq3kn4qhuT06Mbksvwonqu0Gsf8M4eSBOJwqKMz71kaLVcCr6dtFqIUkPBEBuTEM9w== 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 VI1PR08MB2864.eurprd08.prod.outlook.com (2603:10a6:802:21::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14; Wed, 18 May 2022 13:36:45 +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; Wed, 18 May 2022 13:36:44 +0000 Message-ID: <999b0a41-8c30-3551-5c84-0d70e4ccf1b5@arm.com> Date: Wed, 18 May 2022 14:36:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v3] Return the regnum for PC (32) on aarch64 Content-Language: en-US To: Yichao Yu Cc: gdb-patches@sourceware.org References: <20220517173650.844755-1-yyc1992@gmail.com> <8d311bd0-d814-934f-8639-8841a10c803d@arm.com> From: Luis Machado In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0022.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::9) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 1782440d-f96c-4600-f971-08da38d37918 X-MS-TrafficTypeDiagnostic: VI1PR08MB2864:EE_|DBAEUR03FT064:EE_|DU0PR08MB7486: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: FpTi12lO2uvo+5rUQ4OPTt0RJBCwRnJ1LL4kgDowsJdBG6NLB0Wx6mgznXNllGokUbTnilBoe+ghd0Jw9psIEP5Pz1TqvJDGjxo8EE2MjDGBmccSHxcC0jy9JnKlxJYVxToX4CNAIECIPB0ALvce3xmewoIaPIsKFEa9iFrExB/W2bmlxSJA1hsHgFVCFuNnHkyBcfj45LJtnILgXgg/iQz/sa/XNvsWlJoYq5kSNpVrs1b2Q8qCqchLQzCxat35b6NLiuCx79o2RSV8YMH2BtRFoP20LWgbF6JQoej+SfJ8Eg4c41g9mxigWfBJ/7uSVZshdb1SGyMM2fMRyVkESUNTwUjewFdQNYu/0lvMD0zEWD0GH+GmETsrW5bQxbMkCmhxI8cOeBCoWobpAADjbbKE3pgU/r/cRsMQGsCCKWgRimS0Jlrd0cZ1COoSxc5Cs+qsBzOWPhMX9nOVl+F8d+ImRZIFRWhCatGXvXFmkgggE/+G/2PvpoTLU3tocRWEPXQPxA4uZ+722WsRlWbVFAh54EUcddUGAKfg5epW+L0L0S1NKccxxjNS2AOf8eGqyveQGGF+zMXzuf8vCtE1IjCcnpana7uT/baJ3nlKw2HL4QmzW2e1euHhh352f4oIc0Vf+W39vd1JsrNUDPwKfGBZQins2XR4VEIsOKdqK3ER2lJKpmCVFoSSGg4S0Y7XNYo+PiRftYw6Xq925xgbvq3sTHBkXksHswoUloUYnyDKaEHFRM/Igz4mjsdo70YmxXkb9Fsn7mG2Aq73Wq7ChC7h9X2HnYTWck+xPcIDEpS0h0tuc3Ywi63mNIXJHMlh1Z2KVd5DQKatNvexnozadpAvXBXxJy9XlJFt7RgAjsg= 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)(966005)(31696002)(26005)(6506007)(186003)(83380400001)(53546011)(508600001)(6512007)(2616005)(86362001)(4326008)(38100700002)(44832011)(5660300002)(36756003)(8936002)(6486002)(2906002)(66556008)(316002)(66946007)(31686004)(8676002)(66476007)(6916009)(2004002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2864 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: DBAEUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 442eb83e-2c2e-4463-a941-08da38d3726f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6EbxKYp8nbnskbP+lQgmCTqdq0tiZxzNBQWGxz+mVV4mHxG6njXuF/dvHr8ZUCu6Je2C6b4YCGoednOyKtkqo8nWuiFu5fkskRfS9uzE2/UJoPrNwkUEzSKshOxASFr78JamubAjy4///G4FzVnvFchy8RzOTDF2XpBg7Pi3jOykksr1qe61FskLTHSiPduCe7EFJ92PbL5PQJbm3kxzJwSlC81ZaTx0kjxYy1LUFQ3LpKjMxOW0PTBW0XjsS1ro0IFP5/ES8HrZIX6Pk9OGZRix8ClTI5ERkPxnqKKK95IyQLwqlw0/vrB0rCsWa+EqWWp6w/5QBLLoXZxXKgeS7zETeYSvaCmaMdQD6PUZlbHLGmvtuJ/+FHA7/KLxMznYk7Wup2KFpukV4W6cG7Jbadl5j0v/WKZuoIZMlEmpEyz7CT9bkUKwmK8lXQ8Q+3R0VhlUXYWEzxhtjhb3G6dnssSINVHB7uAV7y1L4Ywd5YgFqL9Is0HqylVDJn+k6et4DHIctjkHlCoTE+Jnlsrq69DnCNjVY3d4b2IFFvPnXI32nId6Qz0zOIxfF3WPJBs32N9gxUjmryCpuLPonop/w6sAvcyhVAn6kR3QmGl/X6QyjU/XMMCe9ZkDgwjWCedtpAV5KPyMoFMSzDcz/eoz6ruvk7VcZN0dAZ7H/3jNRUBiCrqmnsQmzepafFevn/eMC63lxg1Gr1vfofZ9/VtCYJ32e7RtZtHjExPwKF5pUsq+vVh9R3K8i5uoQBIsYEEsRVRSMJgTuQGKFdZraLcziDf1+lZA1efyVZ9/eMMQq8x3W8EvHtMPQurepQE188/jcJP2LXcWoNhzp5XlY7FAmGptjBMt4BScmn7/1aVt/iw= 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)(36840700001)(40470700004)(46966006)(31686004)(83380400001)(36756003)(2616005)(316002)(6512007)(6486002)(40460700003)(966005)(82310400005)(47076005)(6506007)(31696002)(70206006)(4326008)(81166007)(8936002)(53546011)(508600001)(86362001)(8676002)(26005)(6862004)(186003)(336012)(356005)(36860700001)(2906002)(44832011)(70586007)(5660300002)(2004002)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 13:36:54.7281 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1782440d-f96c-4600-f971-08da38d37918 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: DBAEUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7486 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, NICE_REPLY_A, 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: Wed, 18 May 2022 13:37:03 -0000 On 5/18/22 14:01, Yichao Yu wrote: > On Wed, May 18, 2022 at 5:54 AM Luis Machado wrote: >> >> On 5/18/22 02:03, Yichao Yu wrote: >>> Sorry for the duplicated post.... I think somehow the university >>> network prevented the email from going out earlier today... >> >> No problem. I've been having some inbound e-mail issues as well. > > I assume by this you mean that someone else will commit it. (cuz I > believe I can't). > Just to confirm, do you have a copyright assignment in place with the FSF? I see one of your previous patches has been pushed before by one of the maintainers. >> >>> >>> On Tue, May 17, 2022 at 8:45 PM Yichao Yu wrote: >>>> >>>> This will allow the unwind info to explicitly specify a different value >>>> for the return address from the link register. >>>> Such usage, although uncommon, is valid and useful for signal frames. >>>> It is also supported by aadwarf64 from ARM (Note 9 in [1]). >>>> >>>> Ref https://sourceware.org/pipermail/gdb/2022-May/050091.html >>>> >>>> [1] https://github.com/ARM-software/abi-aa/blob/2022Q1/aadwarf64/aadwarf64.rst#dwarf-register-names >>>> --- >>>> 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 | 70 ++++++++++++++++++++ >>>> 4 files changed, 122 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..6cc4f80e349 >>>> --- /dev/null >>>> +++ b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.S >>>> @@ -0,0 +1,48 @@ >>>> +/* Copyright 2022 Free Software Foundation, Inc. >>>> + >>>> + 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..105b9a9cc3a >>>> --- /dev/null >>>> +++ b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp >>>> @@ -0,0 +1,70 @@ >>>> +# Copyright 2022 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 . >>>> + >>>> +# This file is part of the gdb testsuite. >>>> + >>>> +# Test explicitly unwinding the PC DWARF register on aarch64 >>>> + >>>> +if {![is_aarch64_target]} then { >>>> + verbose "Skipping ${gdb_test_file_name}." >>>> + return >>>> +} >>>> + >>>> +standard_testfile .S >>>> + >>>> +if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { >>>> + return -1 >>>> +} >>>> + >>>> +if ![runto_main] { >>>> + return -1 >>>> +} >>>> + >>>> +proc test_reg_vals {} { >>>> + gdb_test "p \$pc - &main" "= 8" "p \$pc" >>>> + gdb_test "p/x \$x30" "= 0x1234" "p \$x30" >>>> +} >>>> + >>>> +proc test_unwind_pc { inst } { >>>> + gdb_test "si" "$inst" "single step" >>>> + gdb_test "backtrace" \ >>>> + ".*#1.*in main ().*" \ >>>> + "backtrace" >>>> + gdb_test "up" "in main ().*" "parent frame" >>>> + test_reg_vals >>>> +} >>>> + >>>> +# 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. >>>> +with_test_prefix "1st stepi" { >>>> + test_unwind_pc "mov x0, x30" >>>> +} >>>> +with_test_prefix "2nd stepi" { >>>> + test_unwind_pc "mov x30, 0x1234" >>>> +} >>>> +with_test_prefix "3rd stepi" { >>>> + test_unwind_pc "ret x0" >>>> +} >>>> +# Check again after we returned >>>> +with_test_prefix "final" { >>>> + # Check that we've stepped out (si prints out the new function name) >>>> + gdb_test "si" ".*main *().*" "single step out" >>>> + gdb_test "backtrace" \ >>>> + "#0\[\t \]+main ().*" \ >>>> + "backtrace" >>>> + test_reg_vals >>>> +} >>>> -- >>>> 2.36.1 >>>> >> >> Thanks. This LGTM for aarch64. Please push it.