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;
44const os = std.os;
55const io = std.io;
66const print_zir = @import("print_zir.zig");
7const native_os = builtin.os.tag;
78
89const Module = @import("Module.zig");
910const Sema = @import("Sema.zig");
......@@ -233,9 +234,15 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
233234 },
234235 .aarch64 => ctx: {
235236 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 };
237241 // 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 };
239246 break :ctx StackContext{ .exception = .{ .bp = bp, .ip = ip } };
240247 },
241248 else => .not_supported,