From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140071.outbound.protection.outlook.com [40.107.14.71]) by sourceware.org (Postfix) with ESMTPS id 518883857C4E for ; Tue, 17 May 2022 15:44:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 518883857C4E ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Vm7WC4M2F2pkWgAXBfoW8PpLbCzRbXc+21845poG9M8TCA2TrYaFopLzzIQzrXiuDg42SC+3WQWlrL0TNLBoYH0oScuXKDBBHQsSNbrumyDdp4PV0oipczAqgJyPZFWM3Liw2tMpc2H9a5KAvzXZPH8usO5LAtAN9Hg5Y65cMwk1JNzfrPAomR/PQ41EGtVrElfRnqLW1Gp9UrWkeZ155I65tb4nQOtaAixFW2HZqgtoFVe5MRyUvi6aDDRRrGCppBKIbOvSRqp9m019wXHdI4lKOLpcIQGdY9vi+LfSDeS90EFGWmgBdcygHGReWVKzATgD3mvvHO1ZGKC+Ri0vIw== 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=kvtSpJcx4iS8Vq0FWeoPgqh59Q1Sf3ocCEa+wWkmBvQ=; b=Z5SMEmFmKuRs0u8YR7tjeRYgoE52RuioF573bJS4ZbYqra3UAISAsc7FlNVT9q8dkivsNgd10RtUaT0Jv/EcsmPX1zEuGVAPRvDEU0Qt/Z5WinfhXAwS4OHUYpQAyxR+k7/iPA8UOIi8af48+hmBY4YJSf7lNUK09JLoyq3UpGXDE+ZWc3PuIW/0jJURrS5sxUgNmzpOCZWyMSo6somN0IHT7hBftQpqeHUYRUF0+vQbij8M/X3PL4LtPreheuXRbH8ifws8gBPtXX3151hwNoQwPDw9r2u/Z6DNrD5jRkonMLtNq8MMjvn/h9Gh5o45KCAWA7yBfegvxK8snYjKmQ== 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 DB8PR09CA0007.eurprd09.prod.outlook.com (2603:10a6:10:a0::20) by HE1PR0801MB2074.eurprd08.prod.outlook.com (2603:10a6:3:4a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 15:44:54 +0000 Received: from DBAEUR03FT048.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:a0:cafe::15) by DB8PR09CA0007.outlook.office365.com (2603:10a6:10:a0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.13 via Frontend Transport; Tue, 17 May 2022 15:44: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 DBAEUR03FT048.mail.protection.outlook.com (100.127.142.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Tue, 17 May 2022 15:44:53 +0000 Received: ("Tessian outbound 9a0893f586e2:v119"); Tue, 17 May 2022 15:44:53 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c5090355d5c7bed1 X-CR-MTA-TID: 64aa7808 Received: from f4908db8792a.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AB4A5395-2373-4C1C-8943-07AA9A63BAAF.1; Tue, 17 May 2022 15:44:42 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f4908db8792a.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 17 May 2022 15:44:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ys61ffk615BkK0n3TJ1ZF/N8dE5sSlk7BCUYltmCwbKZ0wakywUSDJWYP95dDW+SGmk4E2HZil6RaLfIDy4Euamy3VmpqX0otOeWBVE679YcscSzpCslPbKLTwd60VLbe8dVKk93JQ1Tj6Q1w605q7RnHYMNHjYvPaCdLTJw2oHftP90dgKT/v5AzwvIxSdFe0lb5fNU2MgwugmRCHsFIBSgJcaV7SAfY/Pl/NpyfIh92XNtX17ei5RqOjKfkr22yvhZvWWgDN04UVgWs9GaaVJVzBFQtFKB5BL6EXEBew5nkktj3hT+Bpr7NloKZilaxR7vKLMK7sF9btbxu7Wljg== 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=kvtSpJcx4iS8Vq0FWeoPgqh59Q1Sf3ocCEa+wWkmBvQ=; b=cOqsC8hIhsRJtiQ3j7zXDjUU3e/2I4pAWtKBk+4wqq0QrOWa3hHX6CvB6gs1dR7Zzq+ZwCeUCfHBS0uzhAkIIw0rFJAurUB2KXoJdp0ZSQBXuaihylplBYz3RVj5f9f5rP74GIKNum8dFStsbjOQLENgGr090MBvEAbkABZv3faszsiUaLl0PzeU4KHHXP8NW7yiEsJs35wz5u19WIeT8DTfjHCzfMWlB0L/pyt7Clt1BWcFCg5bqC74jA48xIvpGP+nr/493hqAxQ88/ZJaMSbIQeeTSmz8RpskW8+Ze9P1H1cSl7tn2e8V1c3c8fBeP4MEr+QiiyTKkOGi5MOAoA== 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 PR3PR08MB5627.eurprd08.prod.outlook.com (2603:10a6:102:83::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 15:44:40 +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; Tue, 17 May 2022 15:44:40 +0000 Message-ID: <98ee6a2d-1af4-404f-bf47-9e730e84642a@arm.com> Date: Tue, 17 May 2022 16:44:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH 1/3] gdb/arm: Set the correct address to the FPU register on Content-Language: en-US To: Torbjorn SVENSSON , Christophe Lyon , Yvan ROUX - foss , "gdb-patches@sourceware.org" References: <20220516135454.GA27993@gnbcxd0114.gnb.st.com> <20220516135803.GB27993@gnbcxd0114.gnb.st.com> <8596b573-ad8e-df22-592d-b342c89a315e@arm.com> From: Luis Machado In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P265CA0076.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2bd::11) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: bfe8ad6e-7568-4d7c-ae85-08da381c2fcc X-MS-TrafficTypeDiagnostic: PR3PR08MB5627:EE_|DBAEUR03FT048:EE_|HE1PR0801MB2074: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: T1Dc0BRs/94LQeSwYKSWNU73YeOkB/SVI9X5cE3SP20ESBVP3QJfQHonW4LLtdkK1j7JgBEi7VW1FXkRI3zLJqueNGSTEwjJnhilZ6VmcTmJn3VKcJFvbgSpi1Ck50jFz30mefj2NgzTPXr0p8XgIBGhAZfFDyTrmPfxbh6Scdaw7EowWtlx1t2h4J63YVzdPn1l8PVxpFtFtO1oLAAJ9tuR3WrxodJF3V3EJCpd3C6bpCMMYEqOzoJgKmh+5cpvG/DlitA7V62DMWBh3+d+clpciCZHqy637EIdS/8TJnT6V2iMqrbYlNbkA13+a8mTIamV3+NYpxnTgZHDoHXFKNgAV2iO3Gmf5P0EzWxASZUjC28z8KFRfaWCUPTdYqz/5TtF06URBIwAA75NbQxd27Gz5IJDBYwEhrR1PeQJLQBFqcgKazZp085B9jKN/+9mhCkX7BUD1xuzoH5Nih5xNc0uJY520WeuJom06FFILdh9hCqN5T72zGyFtOEZY3EpDnBFoCsY2jVL9ZI3Ff/CpFb36zX2+jTUPootyCaybB3k8AswlluQxAocZIwD7S0FMocTaYTRTsZJBQhDPLvrzuqMGwpYuDfj0myU/oxC/j5YZ4ktIDqnTnC5GsNi1+GbPjvZF2BarY7cCJzM3tFYdFGrZUyx41D2eThKkeJwzUfpGA69Z5lAsaj63UiKd2z+hRUoiJ8cAtoenSxSI2qYE7b73zxudms+CpaN8hfPENbi7f97EcbCJHO1thL2WH8YQzu8XaAflUXXPmnzN597XeZlcS4ahK9OZK/VS+unCsoH5IPmhh4eUTRnb9erkSrv 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)(186003)(83380400001)(66556008)(508600001)(66476007)(8676002)(26005)(5660300002)(44832011)(36756003)(6486002)(966005)(2616005)(38100700002)(31686004)(110136005)(6506007)(31696002)(316002)(53546011)(8936002)(86362001)(66946007)(2906002)(6512007)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5627 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: DBAEUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 128a432d-1db7-46cd-4a28-08da381c27af X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /w+UGiR4oMfAnQgaV57RybK5y0FzRSsELmqYklNsiwCfGZlh91NEObb2aDcqhF6RurF3TTNR/6nFXQyhLCDg6kE3/MWiilapRBoV8/EM4onKdeilsnu3PrQIhVHC2N8vIdSueSypSXK/tvtrW30wrsbacZFZkBhV5dEzgmZvioSAKZul6rTAD4N2rWAFUgttHxTgq91cFHM613g4tzhdQ7oSe//a+JkWXdwa+fQKD5hRhYeSI7HQSfUentSXdDofBjeX7gI7YA3PmxS7+4Lmf4pDs4/MSOJSfLO0vPNDRiq2w9Ig6z0k4ggUKLIoJq2ru1y5xMp5QBn5UtV7xuT1wWV0qEqij6r4kUbLCGu5z4LhLmflKoEvGuUxPFaeRwa/7rfdORmWrfk/dpp5J9nIjv8fUHmts3h5C63E5s1LMLGqNPrwCi4B76Cymbq/ZNRUfHrQrDdAw7+KmU1gwn6kZmZloiz2uj3r7pWi4EZfrSAu2bRNgpiiLBGbbS/UyVOHmUkaFrM74sZxFxut3lVn7XEunrgYpZ8hKa8ooMkIpJgytIrLZz97UOtMl5/YPXwQJ9Wfly7u6WmqqJ8dsYp+ZL2TxtwFZ3RxScI8+YD08DtWJPFsXo96N3RNUP8tbJPPAQy5oXOmPFn8OE6wcNUckr+p9bAxAfpIiI0d06PD4UQY+363oWdU0ajyxdt1hZg4k9bJD1mLNnn0bgtVt1HqU8mgM2T5VJqMWMkv/Wr6isyTUXqK6r68cOvxpDSUSi4SoHArlFWAFHiecoKbh3rXKe68pS1qQjoE9Hi9ZteOhrI= 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)(46966006)(36840700001)(40470700004)(70586007)(70206006)(81166007)(8676002)(36860700001)(40460700003)(6506007)(6512007)(47076005)(31696002)(26005)(82310400005)(53546011)(31686004)(110136005)(2906002)(316002)(6486002)(966005)(186003)(83380400001)(356005)(8936002)(5660300002)(86362001)(44832011)(336012)(36756003)(508600001)(2616005)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 15:44:53.8529 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bfe8ad6e-7568-4d7c-ae85-08da381c2fcc 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: DBAEUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2074 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, 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: Tue, 17 May 2022 15:45:01 -0000 On 5/17/22 10:49, Torbjorn SVENSSON via Gdb-patches wrote: > Hello, > > > ST Restricted > >> -----Original Message----- >> From: Christophe Lyon >> Sent: den 16 maj 2022 16:47 >> To: Yvan ROUX - foss ; gdb- >> patches@sourceware.org >> Cc: Torbjorn SVENSSON >> Subject: Re: [PATCH 1/3] gdb/arm: Set the correct address to the FPU >> register on >> >> Hi! >> >> >> On 5/16/22 15:58, Yvan Roux via Gdb-patches wrote: >>> Registers offsets weren't computed from SP address. >>> >>> Signed-off-by: Torbj�rn SVENSSON >>> Signed-off-by: Yvan Roux >>> --- >>> gdb/arm-tdep.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c >>> index 49664093f00..c37254c2ce1 100644 >>> --- a/gdb/arm-tdep.c >>> +++ b/gdb/arm-tdep.c >>> @@ -3475,7 +3475,7 @@ arm_m_exception_cache (struct frame_info >> *this_frame) >>> if (tdep->have_sec_ext && !default_callee_register_stacking) >>> { >>> /* Handle floating-point callee saved registers. */ >>> - fpu_regs_stack_offset = 0x90; >>> + fpu_regs_stack_offset = unwound_sp + 0x90; >> >> Sorry, it looks like this was my mistake when I committed ef273377587d. >> >> I haven't checked the manual, and I may have forgotten, but shouldn't >> this be >> fpu_regs_stack_offset = unwound_sp + sp_r0_offset + 0x90? > > As I see it, it can be either > fpu_regs_stack_offset = unwound_sp + 0x90; > or > fpu_regs_stack_offset = unwound_sp + sp_r0_offset + 0x68; > The offset values (0x90 and 0x68) can be seen in the "Stack Frame" chapter at https://developer.arm.com/documentation/100701/0200/Exception-handlers It would be nice to #define these constants and put some comments pointing at this documentation. > > Based on the rest of the code, maybe "unwound_sp + sp_r0_offset + 0x68" is the preferred expression here as it removes the "integer callee saved" part from the equation. > >> How did you test this? Does your patch actually work? > > I've not tested the code on target (I don't know how to reliably trigger the code), I've just looked at how the rest of the register values are handled in the same block of code in GDB and they are all using the unwound_sp variable to identify the appropriate address. Was this spotted on visual inspection only? Would it be possible to craft some code that runs into an exception and then forces GDB to go through the frame restoring the registers?