authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-02-07 17:11:26-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-02-11 12:13:03-07:00
log46c3d9c5716ce7b6c9f77b07df5fc7456bc18a29
treea0514bf406936729360ebc0422cbecb284f321d1
parentc4458e1b455d493efd39fa4cf8a5b2b7a2565618

stage2: fix crash_report segfault compile error

Regressed in 05cf69209e44c59f838f94ab355485d2d3a0432a.

1 files changed, 9 insertions(+), 2 deletions(-)

src/crash_report.zig+9-2
...@@ -4,6 +4,7 @@ const debug = std.debug;...@@ -4,6 +4,7 @@ const debug = std.debug;
4const os = std.os;4const os = std.os;
5const io = std.io;5const io = std.io;
6const print_zir = @import("print_zir.zig");6const print_zir = @import("print_zir.zig");
7const native_os = builtin.os.tag;
78
8const Module = @import("Module.zig");9const Module = @import("Module.zig");
9const Sema = @import("Sema.zig");10const Sema = @import("Sema.zig");
...@@ -233,9 +234,15 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any...@@ -233,9 +234,15 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
233 },234 },
234 .aarch64 => ctx: {235 .aarch64 => ctx: {
235 const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));236 const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
236 const ip = @intCast(usize, ctx.mcontext.pc);237 const ip = switch (native_os) {
238 .macos => @intCast(usize, ctx.mcontext.ss.pc),
239 else => @intCast(usize, ctx.mcontext.pc),
240 };
237 // x29 is the ABI-designated frame pointer241 // x29 is the ABI-designated frame pointer
238 const bp = @intCast(usize, ctx.mcontext.regs[29]);242 const bp = switch (native_os) {
243 .macos => @intCast(usize, ctx.mcontext.ss.fp),
244 else => @intCast(usize, ctx.mcontext.regs[29]),
245 };
239 break :ctx StackContext{ .exception = .{ .bp = bp, .ip = ip } };246 break :ctx StackContext{ .exception = .{ .bp = bp, .ip = ip } };
240 },247 },
241 else => .not_supported,248 else => .not_supported,