diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-02-07 17:11:26 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-02-07 17:11:26 -0800 |
| commit | a15d2d582b4015af0f72caa2b5f09b7e665e2c1e (patch) | |
| tree | ad3883f4923399e24b5e00817ad39e04def1703d /src | |
| parent | 9bbfbacae0707cf0712e4d6b227b17d097708c7e (diff) | |
| download | zig-a15d2d582b4015af0f72caa2b5f09b7e665e2c1e.tar.gz zig-a15d2d582b4015af0f72caa2b5f09b7e665e2c1e.zip | |
stage2: fix crash_report segfault compile error
Regressed in 05cf69209e44c59f838f94ab355485d2d3a0432a.
Diffstat (limited to 'src')
| -rw-r--r-- | src/crash_report.zig | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/crash_report.zig b/src/crash_report.zig index 724269556b..7e72c64800 100644 --- 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, |
