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 A6115385483F for ; Fri, 14 Oct 2022 13:46:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A6115385483F 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 29EAA2YN019386; Fri, 14 Oct 2022 15:46:36 +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 3k75sd9by1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Oct 2022 15:46:36 +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 611AD10002A; Fri, 14 Oct 2022 15:46:31 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3D5D322F7DC; Fri, 14 Oct 2022 15:46:31 +0200 (CEST) Received: from jkgcxl0002.jkg.st.com (10.75.127.48) 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; Fri, 14 Oct 2022 15:46:27 +0200 From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= To: CC: , , =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= Subject: [PATCH] gdb/arm: Don't rely on loop detection to stop unwind Date: Fri, 14 Oct 2022 15:46:00 +0200 Message-ID: <20221014134559.721433-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.48] 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-14_08,2022-10-14_01,2022-06-22_01 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, 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: Fri, 14 Oct 2022 13:46:45 -0000 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 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; } -- 2.25.1