From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 51E7D3858D35; Fri, 5 Nov 2021 09:51:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51E7D3858D35 From: "tarek.bouchkati at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/28549] New: ARM/Cortex-M: improper stack unwinding when the target is in lockup state Date: Fri, 05 Nov 2021 09:51:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: tarek.bouchkati at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: Fri, 05 Nov 2021 09:51:10 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28549 Bug ID: 28549 Summary: ARM/Cortex-M: improper stack unwinding when the target is in lockup state Product: gdb Version: 9.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: tarek.bouchkati at gmail dot com Target Milestone: --- =3D=3D=3D environment =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D $ gdb-multiarch -v GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2 using STM32H723ZG MCU, containing a Cortex-M7 MCU using OpenOCD as gdbserver =3D=3D=3D how to reproduce =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D start debug session with empty flash $ openocd -f interface/stlink-dap.cfg -f target/stm32h7x.cfg since the flash is empty, the core is in lockup state, ie: PC =3D 0xfffffffe, LR =3D 0xffffffff now using gdb-multiarch, do: (gdb) tar ext :3333 we get the following error in openocd: Error: Failed to read memory at 0xfffffffe =3D=3D=3D analysis =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D doing the same operation with higher verbosity, here is OpenOCD log: Debug: gdb_server.c:384 gdb_log_incoming_packet(): received packet: mffffff= fe,2 Debug: gdb_server.c:1495 gdb_read_memory_packet(): addr: 0x00000000fffffffe, len: 0x00000002 Debug: target.c:2466 target_read_buffer(): reading buffer of 2 byte at 0xfffffffe Debug: stlink_usb.c:1112 stlink_usb_error_check(): STLINK_SWD_AP_WDATA_ERROR Error: arm_adi_v5.c:561 mem_ap_read(): Failed to read memory at 0xfffffffe This means that gdb is requesting to read this address, most probably to un= wind the stack =3D=3D=3D expected behavior =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D do not unwind the stack when PC value is "magic" =3D exception address --=20 You are receiving this mail because: You are on the CC list for the bug.=