commit 46c3d9c5716ce7b6c9f77b07df5fc7456bc18a29 (tree)
parent c4458e1b455d493efd39fa4cf8a5b2b7a2565618
Author: Andrew Kelley <andrew@ziglang.org>
Date: Mon, 7 Feb 2022 17:11:26 -0800
stage2: fix crash_report segfault compile error
Regressed in 05cf69209e44c59f838f94ab355485d2d3a0432a.
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/crash_report.zig b/src/crash_report.zig
@@ -4,6 +4,7 @@ const debug = std.debug;
const os = std.os;
const io = std.io;
const print_zir = @import("print_zir.zig");
+const native_os = builtin.os.tag;
const Module = @import("Module.zig");
const Sema = @import("Sema.zig");
@@ -233,9 +234,15 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
},
.aarch64 => ctx: {
const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
- const ip = @intCast(usize, ctx.mcontext.pc);
+ const ip = switch (native_os) {
+ .macos => @intCast(usize, ctx.mcontext.ss.pc),
+ else => @intCast(usize, ctx.mcontext.pc),
+ };
// x29 is the ABI-designated frame pointer
- const bp = @intCast(usize, ctx.mcontext.regs[29]);
+ const bp = switch (native_os) {
+ .macos => @intCast(usize, ctx.mcontext.ss.fp),
+ else => @intCast(usize, ctx.mcontext.regs[29]),
+ };
break :ctx StackContext{ .exception = .{ .bp = bp, .ip = ip } };
},
else => .not_supported,