From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id CC25A3858D1E for ; Sat, 15 Oct 2022 09:40:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC25A3858D1E Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29F5S5Rp004547; Sat, 15 Oct 2022 11:40:29 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3k7j9m9th9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 15 Oct 2022 11:40:29 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id ABD6A10002A; Sat, 15 Oct 2022 11:40:24 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 71CF921A908; Sat, 15 Oct 2022 11:40:24 +0200 (CEST) Received: from [10.252.13.96] (10.75.127.44) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.31; Sat, 15 Oct 2022 11:40:23 +0200 Message-ID: <2c9240b2-7106-dacd-bd4c-dea2b30d27e7@foss.st.com> Date: Sat, 15 Oct 2022 11:40:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH] gdb/arm: Don't rely on loop detection to stop unwind To: Luis Machado , CC: References: <20221014134559.721433-1-torbjorn.svensson@foss.st.com> <3c83c771-bdc5-8d05-dd32-01a11420cf1e@arm.com> Content-Language: en-US From: Torbjorn SVENSSON In-Reply-To: <3c83c771-bdc5-8d05-dd32-01a11420cf1e@arm.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-15_05,2022-10-14_01,2022-06-22_01 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP 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: Sat, 15 Oct 2022 09:40:39 -0000 On 2022-10-14 19:13, Luis Machado wrote: > On 10/14/22 14:46, Torbjörn SVENSSON wrote: >> Setting SP of the next frame to the same address as the current frame >> is an ugly way to stop the unwind.  A cleaner way is to rely on the > > stop the unwind -> stop the unwinding. > >> frame_unwind_stop_reason function to return UNWIND_OUTERMOST. >> >> Signed-off-by: Torbjörn SVENSSON >> --- >>   gdb/arm-tdep.c | 13 ++++++------- >>   1 file changed, 6 insertions(+), 7 deletions(-) >> >> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c >> index fa6b08e4a54..b5facae8a5e 100644 >> --- a/gdb/arm-tdep.c >> +++ b/gdb/arm-tdep.c >> @@ -3356,7 +3356,6 @@ arm_m_exception_cache (frame_info_ptr this_frame) >>        to the exception and if FPU is used (causing extended stack >> frame).  */ >>     CORE_ADDR lr = get_frame_register_unsigned (this_frame, >> ARM_LR_REGNUM); >> -  CORE_ADDR sp = get_frame_register_unsigned (this_frame, >> ARM_SP_REGNUM); >>     /* ARMv7-M Architecture Reference "A2.3.1 Arm core registers" >>        states that LR is set to 0xffffffff on reset.  ARMv8-M >> Architecture >> @@ -3364,8 +3363,8 @@ arm_m_exception_cache (frame_info_ptr this_frame) >>        reset if Main Extension is implemented, otherwise the value is >> unknown.  */ >>     if (lr == 0xffffffff) >>       { >> -      /* Terminate any further stack unwinding by referring to self.  */ >> -      arm_cache_set_active_sp_value (cache, tdep, sp); >> +      /* Terminate any further stack unwinding.  */ >> +      arm_cache_set_active_sp_value (cache, tdep, 0); >>         return cache; >>       } >> @@ -3387,8 +3386,8 @@ arm_m_exception_cache (frame_info_ptr this_frame) >>       { >>         warning (_("Non-secure to secure stack unwinding disabled.")); >> -      /* Terminate any further stack unwinding by referring to self.  */ >> -      arm_cache_set_active_sp_value (cache, tdep, sp); >> +      /* Terminate any further stack unwinding.  */ >> +      arm_cache_set_active_sp_value (cache, tdep, 0); >>         return cache; >>       } >> @@ -3452,8 +3451,8 @@ arm_m_exception_cache (frame_info_ptr this_frame) >>           { >>             warning (_("Non-secure to secure stack unwinding >> disabled.")); >> -          /* Terminate any further stack unwinding by referring to >> self.  */ >> -          arm_cache_set_active_sp_value (cache, tdep, sp); >> +          /* Terminate any further stack unwinding.  */ >> +          arm_cache_set_active_sp_value (cache, tdep, 0); >>             return cache; >>           } > LGTM. Thanks. Pushed.