authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-18 15:01:48+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-18 22:27:35+02:00
log49cd0e6f7ce108292528c8210f3b967b31e2c341
tree1bc7cd6d21ee780a066bb713de1d6a16b11e870a
parent5e57ed9fdaaad4571f224baa58e3ac8edb1d747b
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.debug: fix frame pointer unwinding on or1k


1 files changed, 5 insertions(+), 1 deletions(-)

lib/std/debug.zig+5-1
......@@ -988,6 +988,8 @@ const StackIterator = union(enum) {
988988 // On LoongArch and RISC-V, the frame pointer points to the top of the saved register area,
989989 // in which the base pointer is the first word.
990990 if (native_arch.isLoongArch() or native_arch.isRISCV()) break :off -2 * @sizeOf(usize);
991 // On OpenRISC, the frame pointer is stored below the return address.
992 if (native_arch == .or1k) break :off -2 * @sizeOf(usize);
991993 // On SPARC, the frame pointer points to the save area which holds 16 slots for the local
992994 // and incoming registers. The base pointer (i6) is stored in its customary save slot.
993995 if (native_arch.isSPARC()) break :off 14 * @sizeOf(usize);
......@@ -999,7 +1001,9 @@ const StackIterator = union(enum) {
9991001 const fp_to_ra_offset = off: {
10001002 // On LoongArch and RISC-V, the frame pointer points to the top of the saved register area,
10011003 // in which the return address is the second word.
1002 if (native_arch.isRISCV() or native_arch.isLoongArch()) break :off -1 * @sizeOf(usize);
1004 if (native_arch.isLoongArch() or native_arch.isRISCV()) break :off -1 * @sizeOf(usize);
1005 // On OpenRISC, the return address is stored below the stack parameter area.
1006 if (native_arch == .or1k) break :off -1 * @sizeOf(usize);
10031007 if (native_arch.isPowerPC64()) break :off 2 * @sizeOf(usize);
10041008 // On s390x, r14 is the link register and we need to grab it from its customary slot in the
10051009 // register save area (ELF ABI s390x Supplement §1.2.2.2).