authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-20 03:45:20+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-23 19:34:02+02:00
logd8cb8b7baec1ed3e3457486b35d64bdae9904ab4
tree2ec80c5925bc9f30f218925710a1cc0c38637c07
parentc13355abda21e90443ae9ea59706e491111a8bcb
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.debug: fix FP unwinding for hppa/hppa64


1 files changed, 10 insertions(+), 0 deletions(-)

lib/std/debug.zig+10
...@@ -994,6 +994,11 @@ const StackIterator = union(enum) {...@@ -994,6 +994,11 @@ const StackIterator = union(enum) {
994994
995 /// Offset of the saved base pointer (previous frame pointer) wrt the frame pointer.995 /// Offset of the saved base pointer (previous frame pointer) wrt the frame pointer.
996 const fp_to_bp_offset = off: {996 const fp_to_bp_offset = off: {
997 // On 32-bit PA-RISC, the base pointer is the final word of the frame marker.
998 if (native_arch == .hppa) break :off -1 * @sizeOf(usize);
999 // On 64-bit PA-RISC, the frame marker was shrunk significantly; now there's just the return
1000 // address followed by the base pointer.
1001 if (native_arch == .hppa64) break :off -1 * @sizeOf(usize);
997 // On LoongArch and RISC-V, the frame pointer points to the top of the saved register area,1002 // On LoongArch and RISC-V, the frame pointer points to the top of the saved register area,
998 // in which the base pointer is the first word.1003 // in which the base pointer is the first word.
999 if (native_arch.isLoongArch() or native_arch.isRISCV()) break :off -2 * @sizeOf(usize);1004 if (native_arch.isLoongArch() or native_arch.isRISCV()) break :off -2 * @sizeOf(usize);
...@@ -1008,6 +1013,11 @@ const StackIterator = union(enum) {...@@ -1008,6 +1013,11 @@ const StackIterator = union(enum) {
10081013
1009 /// Offset of the saved return address wrt the frame pointer.1014 /// Offset of the saved return address wrt the frame pointer.
1010 const fp_to_ra_offset = off: {1015 const fp_to_ra_offset = off: {
1016 // On 32-bit PA-RISC, the return address sits in the middle-ish of the frame marker.
1017 if (native_arch == .hppa) break :off -5 * @sizeOf(usize);
1018 // On 64-bit PA-RISC, the frame marker was shrunk significantly; now there's just the return
1019 // address followed by the base pointer.
1020 if (native_arch == .hppa64) break :off -2 * @sizeOf(usize);
1011 // On LoongArch and RISC-V, the frame pointer points to the top of the saved register area,1021 // On LoongArch and RISC-V, the frame pointer points to the top of the saved register area,
1012 // in which the return address is the second word.1022 // in which the return address is the second word.
1013 if (native_arch.isLoongArch() or native_arch.isRISCV()) break :off -1 * @sizeOf(usize);1023 if (native_arch.isLoongArch() or native_arch.isRISCV()) break :off -1 * @sizeOf(usize);