Uh oh!
There was an error while loading. Please reload this page.
std.debug: fix incorrect FP unwinding on RISC-V and SPARC - #25518
Conversation
I broke this when porting this logic for the `std.debug` rework in ziglang#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.
alexrp
left a comment
There was a problem hiding this comment.
I can confirm that the RISC-V change works, but the SPARC change doesn't seem to make a difference on my end:
❯ zig4 build-exe crash.zig -target sparc64-linux && qemu-sparc64 ./crash
Cannot print stack trace: safe unwind unavailable for target
Segmentation fault at address 0x4
fish: Job 1, 'qemu-sparc64 ./crash' terminated by signal SIGABRT (Abort)
❯ cat crash.zig
const std = @import("std");
pub fn main() void {
foo();
// @panic("oh no");
@as(*u32, @ptrFromInt(4)).* = 42;
}
noinline fn foo() void {
std.debug.dumpCurrentStackTrace(.{});
}
I'll be honest, I didn't test the SPARC one; I was just trying to mirror the old logic on the assumption that it was more correct. Was SPARC tracing working prior to my std.debug PR (i.e. did I regress it)? If so, I'll take a look now, but if not, I think this should be merged as an improvement. |
alexrp
commented
Oct 9, 2025
Actually no, it doesn't seem like it; there's no stack crash stack trace on 0.15.1 either. Could've sworn I managed to make it produce one previously though...? In any case, seems fine. |
mlugg
commented
Oct 9, 2025
Interesting... I might take a look at SPARC in a bit. How hard could it be?! :):):):) |
Uh oh!
There was an error while loading. Please reload this page.
I broke this when porting this logic for the
std.debugrework 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.