From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2042.outbound.protection.outlook.com [40.107.22.42]) by sourceware.org (Postfix) with ESMTPS id 2EE083858C2D for ; Tue, 11 Oct 2022 16:34:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2EE083858C2D ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=fG5QyqD1E211Gw4d07MYk7KVaNgK+HJ0XGpRBLjZwHbH1rQqnYxGWXdHO+IRGAVntV5N3ZDyQY6JoA68tVQeVBf66v2N6sGvRCgGjZtxLaHa+5HrF6avkY+bd/RxuiWk3pQ0nGWQWhEyMi6+0hJT8OAwMthC96Egqwpnr6HOhJYblKywFcmXYJg4ejDfq0yQzrjYX2oyHJmFuaWDmPwMge5jcVvLJCg3CYlf1e2G80G9nJurpu54lvPIm3XNzceMe3NrlYCMHWMKpx54CLWgIfhEQKJV/sO0AhOWkM+QdEImvconD/wJmf/U7EQUg63YHWWeuG7Q1fu+kch9EKfebw== 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=T98XVgKwhU7mMI9LVNKpL9KLbBSuIq90NCudn0DPVYE=; b=eo2d5fJJpq1st4ZI4KSblOLLBjAXvSpflIGi2YAAQ7q2Jxov7wxZYQUJ2GSmUa71JYEXPdEvqvQTocE6w05+FhJ9QPSC/3fxc+drGmJPRfkB0LTQ4Cm+/nVLJg2dtvViehKuL3WVOL8aFLlSHSp/ZU0+/4IPkrfBGCnJQYS6CGiprcp37FyV7hnfxBREarHLZ+eNjF51nj7lFSg/EQPDz/bXJ0zdHU9SvgWR0YQrK7PeaCMdct5eqXfEp1RDuGwUf78MO4ToBYoMxbdYt8AK7dicEuak/xb3lF1SBKItxm45peXYc5gNWTVXKR7Kb0dSRhh/TyXSf9So1W3LoowNkg== 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 AM6P193CA0127.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:85::32) by AS8PR08MB8802.eurprd08.prod.outlook.com (2603:10a6:20b:5bc::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.19; Tue, 11 Oct 2022 16:34:31 +0000 Received: from VI1EUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:85:cafe::c7) by AM6P193CA0127.outlook.office365.com (2603:10a6:209:85::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.21 via Frontend Transport; Tue, 11 Oct 2022 16:34:31 +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 VI1EUR03FT004.mail.protection.outlook.com (100.127.144.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 16:34:30 +0000 Received: ("Tessian outbound ce981123c49d:v128"); Tue, 11 Oct 2022 16:34:30 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 74e62e2ac75496b5 X-CR-MTA-TID: 64aa7808 Received: from cb4364118d6d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 69CC5E30-A67B-4375-97A7-C8E0A0570056.1; Tue, 11 Oct 2022 16:34:23 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cb4364118d6d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 11 Oct 2022 16:34:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AvRc0tTQy72L5Ja6Nk+T/MluDx2OQXI8bpAdnl1FrPfRCYkVngGxJu3M3Oqw78eNeQNA9RIC8jmhmNchu0+9WB8eOVc406xCOoi0TGVzVJEuh6h2S46WXsU784LFHgA6ZIDnhkZ/qDWZW4O6gsH7boavENfWN7y9BSQ4VmLM3VJUK29f7SyvTjefOTkW91pHPFexJ+qgUK9V17zwY669wF8dck0a2RA0tk+9iYh+OobECohlVw8b0xJx8X31ELmpn9a/cE6uA95Z5VgtI9rXSiDBhCDD7eOvCsQ+Y8YmkI3dvxH+3N+eMMNP/24ueO/pV+L/AYYPcZrNgPrE6wV9DA== 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=T98XVgKwhU7mMI9LVNKpL9KLbBSuIq90NCudn0DPVYE=; b=ofOii+/iTYAzzCBH7thUHwXbpkvlqxCAIe7LaqZ221scV90XoRz2I/U24v9Hmwsg3lrz57N4BVwrIEY0gqLe5lB3pQZVMvApcIn19fHk6JV0tLQcMkpUyhQxFuzNM5mj2Kfldyuw+gYIacEPXGZXEL3yBsLWjFKq9+MmhDnar09FORDC07NuL9xNJz5HhByb8xhJpETYCl8d8f7AD4jf/6QL+ZcDSReqmmk0R+jqllZ1C3UchpnbIngMT4p/QTZ2rd7/0dr1uv5zeLJ18vucsrBhzo0qkZdSnFpCYegnc/siN3n/mtVvnAaBeCk3CXa5MKMicd4jr/q2+7tXj2+Lbw== 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 AS4PR08MB8070.eurprd08.prod.outlook.com (2603:10a6:20b:589::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.19; Tue, 11 Oct 2022 16:34:21 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::bbeb:a49e:d969:5d2]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::bbeb:a49e:d969:5d2%6]) with mapi id 15.20.5709.015; Tue, 11 Oct 2022 16:34:21 +0000 Message-ID: Date: Tue, 11 Oct 2022 17:34:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2] gdb/arm: Unwind S-registers for exception frames Content-Language: en-US To: =?UTF-8?Q?Torbj=c3=b6rn_SVENSSON?= , gdb-patches@sourceware.org Cc: yvan.roux@foss.st.com, Simon Marchi References: <20221011080025.567502-1-torbjorn.svensson@foss.st.com> From: Luis Machado In-Reply-To: <20221011080025.567502-1-torbjorn.svensson@foss.st.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0011.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:150::16) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|AS4PR08MB8070:EE_|VI1EUR03FT004:EE_|AS8PR08MB8802:EE_ X-MS-Office365-Filtering-Correlation-Id: 72d4b2ca-f0e9-48f7-74de-08daaba67906 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: QmDfd7ZA3fL5EdXG1WSJpNQHugONHqZXYv6vfGv7fogOEDcoCjeTYMGVwATu7T3/b9VvObDpSsFLjVjdw5KiWk2ePgoMVsqiCmVRrRFPBaoW7cLB4LVzNK4wry/PEWNwXiXf9pK4xqr4L9S0WJFIJVCAaa+q6SHMfrfSz3GJcYn3p1vbEt1MRGmSD8W73aI2ucuL/nLLcWMPd5AutU9nhxEvvCxNLH8L89hw1AD9XmAJCpndOPgr3duI4gDzaxYOFq5SJg/MNKD0z2crW0fDgiwotiaTQFQzaE+MMr8rqEg2uWw54CRIcgZt3MG5AVY9mLjd886xFf/cbdOUDxh3lDCd5b/KfoObNdaBfeCFUK/oDT80066xJmfDrhxBx/WOGEhXFqTmvkN8EPVfyDOb3Zi0RDb0gf5xvPe7nUS1ETabKemQD684V02i/vyt/tz84NaANYCHsoTqlxfU9K3qSmvs5qcjXOLVQfiBS3FUbOHzw+CNuP6/4crgDEvpY9hAnXPqitVqTOzECxixUH9RH55PAaNJZ3gkTFlPr4r6iWtpdXy0P270abHfDl+5q6RGTaxlVOWJWwu2iG/pWcCup2SldzTsF5Adm2+5TDkjpuC21SCMqKfZb+x8pmJfgFrR4TjJJYUXL1FAv/KRmrFIFMRuJekFmNE+xH5Y8Jz0a9TZovC+O2ne4KvUoF2vgTjYFm5O/7ejVM5dQ17z9k/mYcdiBgCygN3Gy4qRJzmTZxvPuQpz584MRDa6+ssGMhjp7LwgemI4Md2/HLHkbitHfCuBt2shLizLqAO/GLU3TFkxewbuZJbjf2p1w6vjphP4 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:(13230022)(4636009)(39860400002)(396003)(136003)(366004)(376002)(346002)(451199015)(5660300002)(41300700001)(8936002)(2906002)(31696002)(86362001)(44832011)(6666004)(6506007)(2616005)(66574015)(186003)(53546011)(83380400001)(6512007)(26005)(66476007)(8676002)(66946007)(4326008)(66556008)(316002)(38100700002)(6486002)(966005)(478600001)(36756003)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB8070 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: VI1EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 08743a1b-eb2c-4d53-8aa0-08daaba6735d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZcCy9DHMvN72bYi3RHnaklOtixHHk8K2Jm9xaYE3JZPFut76PwnEyuHUZUI0N+JqdaPZUXLIcjfUxObMyQ4IPN7uvNbs098L4cqj7Cb0FbjV+iV/QPxif/ZdvMpPb/ecgF61WIhFTpAYK3lQ27ntmjoa67kHEAsPYm9PKGZzsais7Zna9ohZly96sqhIN+8yKZ1Fwf51bXlsaymmEejJe23CtZY3aSai193lol8MGzpOEMp7uL7AeHw/MVOec6Ea4vcYa9xWPiHrACsbOH+MI5DgKN3zQ6jLxVRjuvQ+HATTVYSYo4ppaYZ/tusUR8+EYf8Wzea2CzJ4UvPx1+YZJdu8MxeTtD+CC6LjN4MQmS+SQYGjV6tocIRL/c92nP9xamZrCCNrImhltaVuTqxwITGoJtMbcrH3mltsSSnJOTNKyOtVKA09Uw+tSekjUFF7ESbDDg7sgpEamgiLt6FRaelJiHzetLKTtUYwKNpJFskSIb/8qTUn1gBERXnsI/fQnMM3Lf9ig+eV9hdzAG9Mbi8chFBZQIcZwuBzPh/SEp4mmYDMiBTBvXpMk98EYphb5F7ox8IeXsOXT1s7FYyPo8mWwY6pA70wBCKEjve4ocwilrxwpqtB/lQUpTvn3Uiexub7GsdQM0Q45+6+e8fKhVCG/p0avGayR6kbxIxLnJ6rl4e9kaSm5cuRX9wjhV0Dp/S5etVbarbGYDz6mbS06iPCPb9UJXvbD+rHbS67DzAAruaJEgxrR/FzQaLnEYscSc5QaZcH0SADvTyNGJmz7Kwo+el4dkYNrl3gYeeZpV0sZD8cTZsK2dt1VJmeeH89VjqdbuuFvf6UV2IuL71+mQ== 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:(13230022)(4636009)(396003)(376002)(136003)(39860400002)(346002)(451199015)(46966006)(40470700004)(36840700001)(336012)(2906002)(6506007)(8936002)(2616005)(44832011)(186003)(66574015)(53546011)(6512007)(41300700001)(26005)(5660300002)(81166007)(47076005)(356005)(82310400005)(82740400003)(40460700003)(86362001)(31696002)(40480700001)(36756003)(83380400001)(36860700001)(316002)(966005)(6486002)(31686004)(478600001)(107886003)(70206006)(70586007)(6666004)(8676002)(4326008)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 16:34:30.8639 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72d4b2ca-f0e9-48f7-74de-08daaba67906 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: VI1EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8802 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, NICE_REPLY_A, RCVD_IN_DNSWL_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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2022 16:34:50 -0000 Hi Torbjörn, On 10/11/22 09:00, Torbjörn SVENSSON wrote: > After sending the v1 patch yesterday, I had an epiphany that the solution could be simplified. > The v2 of the patch is an alternative implementation that appears to work equally well. > Which do you prefer? > > > Save the address on the stack that contains the value for the > S-register when unwinding, just like already done for the > D-registers. > > Signed-off-by: Torbjörn SVENSSON > --- > gdb/arm-tdep.c | 19 +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) > > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c > index d357066653b..f725d437825 100644 > --- a/gdb/arm-tdep.c > +++ b/gdb/arm-tdep.c > @@ -3625,10 +3625,13 @@ arm_m_exception_cache (struct frame_info *this_frame) > if (read_fp_regs_from_stack) > { > CORE_ADDR addr = unwound_sp + sp_r0_offset + 0x20; > - for (int i = 0; i < 8; i++) > + for (int i = 0; i < 16; i++) > { > - cache->saved_regs[ARM_D0_REGNUM + i].set_addr (addr); > - addr += 8; > + if (tdep->have_s_pseudos) > + cache->saved_regs[tdep->s_pseudo_base + i].set_addr (addr); > + if (i % 2 == 0) > + cache->saved_regs[ARM_D0_REGNUM + i].set_addr (addr); > + addr += 4; > } > } > cache->saved_regs[ARM_FPSCR_REGNUM].set_addr (unwound_sp > @@ -3641,10 +3644,14 @@ arm_m_exception_cache (struct frame_info *this_frame) > if (read_fp_regs_from_stack) > { > CORE_ADDR addr = unwound_sp + sp_r0_offset + 0x68; > - for (int i = 8; i < 16; i++) > + for (int i = 16; i < 32; i++) > { > - cache->saved_regs[ARM_D0_REGNUM + i].set_addr (addr); > - addr += 8; > + if (tdep->have_s_pseudos) > + cache->saved_regs[tdep->s_pseudo_base + i] > + .set_addr (addr); > + if (i % 2 == 0) > + cache->saved_regs[ARM_D0_REGNUM + i].set_addr (addr); > + addr += 4; > } > } > Although this is a working solution to the problem, I'm afraid the proper way to address this issue is to support pseudo-registers based on frame registers. But from past discussions, there doesn't seem to be consensus about the right way to do it or even if we should do it. See https://sourceware.org/pipermail/gdb-patches/2018-May/149243.html. Simon, was this ever pursued after this thread?