From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 458E43858437; Thu, 27 Jan 2022 13:11:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 458E43858437 From: "clyon at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tdep/28829] New: ARM Cortex-M: cannot backtrace from interrupt handler Date: Thu, 27 Jan 2022 13:11:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tdep X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: clyon at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Thu, 27 Jan 2022 13:11:31 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28829 Bug ID: 28829 Summary: ARM Cortex-M: cannot backtrace from interrupt handler Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: tdep Assignee: unassigned at sourceware dot org Reporter: clyon at gcc dot gnu.org Target Milestone: --- Hello, Playing with sample STM32 code on a board with Cortex-M33 and Security extension (STM32L552) I put a breakpoint in SysTick_Handler from NUCLEO-L552ZE-Q/Examples/GTZC/GTZC_TZSC_MPCBB_TrustZone/NonSecure/Src/stm32= l5xx_it.c:132 When I ask for a backtrace, with GDB trunk I get: (gdb) bt #0 SysTick_Handler () at [...]/stm32l5xx_it.c:132 Backtrace stopped: Cannot access memory at address 0xd034f8d6 If I apply the patches I posted recently to add support for FNC_RETURN on s= uch devices (https://sourceware.org/pipermail/gdb-patches/2022-January/185127.html), I = get: (gdb) bt #0 SysTick_Handler () at [...]/stm32l5xx_it.c:132 #1 #2 0x00000000 in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) which only partially better ;-) When I single-step in gdb's arm_m_exception_cache, I notice that sp =3D get_frame_register_unsigned (this_frame, ARM_SP_REGNUM); returns 0x2002ff78, but later in the same function unwound_sp =3D arm_cache_get_prev_sp (cache, tdep); returns 0x2002ff70. Since the breakpoint is set after the prologue, I think I might need to add something like arm_scan_prologue (this_frame, cache); but this leads to a crash. Looking into arm_scan_prologue, I was surprised to see that arm_frame_is_th= umb returns false although the processor is Cortex-M (so thumb-only). This is because t_bit =3D=3D 0x1000000 and cpsr =3D=3D 0xf, which is surpri= sing? I have access to the board only until tomorrow, so I'm dumping my findings = here in case I can get help very quickly or someone else picks up the problem la= ter. --=20 You are receiving this mail because: You are on the CC list for the bug.=