From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 26AFD385843E; Fri, 9 Feb 2024 16:19:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26AFD385843E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707495583; bh=LSJ8mEd3osbMqB4WblfMVxl4zq0WVqmHstHnjdOu8pY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yhBu5YLWQXAuuh2He8vJCQB8yoAhn7j3NYZ/+B2Rbl2kczAzj4RFad17LJi7u7gZS vFBJx/+9SVSNfVp8PpvAjAespraCGepe5TA57u8d/iJ75S6Ab4ZQGOJ1T+Uo/c1ZW3 mhjo1R0NE0889eCsdCcnzV10VzvRlLIGjAdRjyY4= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tdep/31278] GDB on arm-linux-gnueabihf fails gdb.reverse/func-map-to-same-line.exp Date: Fri, 09 Feb 2024 16:19:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: vries at gcc dot gnu.org 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: 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 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31278 --- Comment #6 from Tom de Vries --- (In reply to Tom de Vries from comment #5) > So I guess the question is why the frame id has that strange stack_addr. I added this debug patch: ... diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index fc6704f434e..1f6a0a17305 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -980,6 +980,8 @@ dwarf2_frame_cache (frame_info_ptr this_frame, void **this_cache) try { + frame_debug_printf ("Calculating CFA ... "); + /* Calculate the CFA. */ switch (fs.regs.cfa_how) { @@ -1001,6 +1003,9 @@ dwarf2_frame_cache (frame_info_ptr this_frame, void **this_cache) default: internal_error (_("Unknown CFA rule.")); } + + frame_debug_printf (" ... CFA calculated: %llx", (unsigned long long)cache->cfa); +=20=20=20=20=20=20=20 } catch (const gdb_exception_error &ex) { ... And then using: ... $ gdb.sh -q -batch \ outputs/gdb.reverse/func-map-to-same-line/func-map-to-same-line \ -ex start \ -ex record \ -ex "break 36" \ -ex continue \ -ex reverse-stepi \ -ex "set debug frame 1" \ -ex reverse-stepi ... I find: ... [frame] frame_unwind_register_value: enter [frame] frame_unwind_register_value: frame=3D0, regnum=3D7(r7) [frame] frame_unwind_register_value: -> address=3D0xfffef4d8 lazy [frame] frame_unwind_register_value: exit [frame] dwarf2_frame_cache: ... CFA calculated: 12 [frame] frame_unwind_arch: next_frame=3D1 -> armv7 [frame] frame_unwind_register_value: enter [frame] frame_unwind_register_value: frame=3D1, regnum=3D15(pc) [frame] frame_unwind_register_value: enter [frame] frame_unwind_register_value: frame=3D1, regnum=3D14(lr) [frame] frame_unwind_register_value: -> address=3D0xe lazy [frame] frame_unwind_register_value: exit [frame] frame_unwind_register_value: exit ... So r14 is read from address 0xe, which is caused by an incorrect CFA, of 0x= 12. The CFA is calculated based on r7, which is read from to 0xfffef4d8, result= ing in '2'. When stepping through func2, r7 is actually saved at 0xfffef4d4. In the .s file we have: ... nop mov sp, r7 .cfi_def_cfa_register 13 @ sp needed ldr r7, [sp], #4 .cfi_restore 7 .cfi_def_cfa_offset 0 bx lr .cfi_endproc ... I'm not sure why when stopped at the start of ldr we try to read from 7, th= ough cfa reg 13 also doesn't sound right for a thumb function. Regardless, we're reading r7 from the wrong place. --=20 You are receiving this mail because: You are on the CC list for the bug.=