Skip to content

Commit 80f6b8c

Browse files
committed
std.debug: fix incorrect FP unwinding on RISC-V and SPARC
I broke this when porting this logic for the `std.debug` rework in #25227. The offset that I copied was actually being treated as relative to the address of the *saved* base pointer. I think it makes more sense to do what I did and just treat all offsets as relative to this frame's base.
1 parent c383cd5 commit 80f6b8c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/std/debug.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,8 @@ const StackIterator = union(enum) {
993993

994994
/// Offset of the saved return address wrt the frame pointer.
995995
const ra_offset = off: {
996+
if (native_arch.isRISCV()) break :off -1 * @sizeOf(usize);
997+
if (native_arch.isSPARC()) break :off 15 * @sizeOf(usize);
996998
if (native_arch.isPowerPC64()) break :off 2 * @sizeOf(usize);
997999
// On s390x, r14 is the link register and we need to grab it from its customary slot in the
9981000
// register save area (ELF ABI s390x Supplement §1.2.2.2).

0 commit comments

Comments
 (0)