From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D22D53858403; Fri, 10 Dec 2021 12:30:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D22D53858403 From: "tomas.vanek at fbl dot cz" To: gdb-prs@sourceware.org Subject: [Bug gdb/28549] ARM/Cortex-M: improper stack unwinding when the target is in lockup state Date: Fri, 10 Dec 2021 12:30:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tomas.vanek at fbl dot cz X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: luis.machado at linaro dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Dec 2021 12:30:35 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28549 tomas.vanek at fbl dot cz changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomas.vanek at fbl dot cz --- Comment #14 from tomas.vanek at fbl dot cz --- Fredrik, I'm afraid that simply adding lockup addresses to the list of magic address= is not correct. The Cortex-M lockup differs from an exception! The lockup does= not stack anything, it just sets PC (and other special regs). So there is no po= int in trying to unwind lockup frame. It does not seem possible, the previous P= C is lost. Unwinding lockup state as it was an exception may result again in peeking n= ot existing memory (arm_m_exception_cache() reads word @ unwound_sp + 28) So I would recommend splitting arm_m_addr_is_magic() to arm_m_addr_is_exc_return() and arm_m_addr_is_lockup(). Then introduce another Cortex-M specific unwinder "arm m lockup" with a tri= vial implementation: arm_m_lockup_this_id() will always return outer_frame_id and arm_m_lockup_unwind_sniffer() will check PC for arm_m_addr_is_lockup() Tom --=20 You are receiving this mail because: You are on the CC list for the bug.=