From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7897) id D4F093858D1E; Sat, 15 Oct 2022 09:40:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D4F093858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665826802; bh=KSJnlGK8ofHxt2R8/2PSkusdgfZ8quNA6HGVF+CBhmI=; h=From:To:Subject:Date:From; b=Vm9CCEjooiIQVudIryVX35AWpXeac1qGb3rRi/9bTuTUGKKtHH2BkyWVG4uQEvUFe abnqb6fKVTCGVYifoByUx2k/WRemcoLyM8M8E7rp81+Yy+kDqVRHOzTbFAj8WH+g2J /BpSjyMIe0/KX25FYWOhLPyFFVO41kamr4aGhM3M= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Torbjorn Svensson To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/arm: Don't rely on loop detection to stop unwinding X-Act-Checkin: binutils-gdb X-Git-Author: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= X-Git-Refname: refs/heads/master X-Git-Oldrev: 488054071bb4dd5cb087661f92687bc836169170 X-Git-Newrev: 619cce4cac9b7ad5f4604cd5a63933e71515e16f Message-Id: <20221015094002.D4F093858D1E@sourceware.org> Date: Sat, 15 Oct 2022 09:40:02 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D619cce4cac9b= 7ad5f4604cd5a63933e71515e16f commit 619cce4cac9b7ad5f4604cd5a63933e71515e16f Author: Torbj=C3=B6rn SVENSSON Date: Fri Oct 14 15:34:24 2022 +0200 gdb/arm: Don't rely on loop detection to stop unwinding =20 Setting SP of the next frame to the same address as the current frame is an ugly way to stop the unwinding. A cleaner way is to rely on the frame_unwind_stop_reason function to return UNWIND_OUTERMOST. =20 Signed-off-by: Torbj=C3=B6rn SVENSSON Diff: --- 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). = */ =20 CORE_ADDR lr =3D get_frame_register_unsigned (this_frame, ARM_LR_REGNUM); - CORE_ADDR sp =3D get_frame_register_unsigned (this_frame, ARM_SP_REGNUM); =20 /* 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 unknow= n. */ if (lr =3D=3D 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; } =20 @@ -3387,8 +3386,8 @@ arm_m_exception_cache (frame_info_ptr this_frame) { warning (_("Non-secure to secure stack unwinding disabled.")); =20 - /* 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; } =20 @@ -3452,8 +3451,8 @@ arm_m_exception_cache (frame_info_ptr this_frame) { warning (_("Non-secure to secure stack unwinding disabled.")); =20 - /* 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; }