netbsd: add mcontext_t for aarch64

- test `lib/std/std.zig` passes
- stack traces work
This commit is contained in:
Michael Dusan
2023-01-17 18:14:53 -05:00
committed by Andrew Kelley
parent 7f604b6f48
commit c9f7b32fbd
3 changed files with 33 additions and 9 deletions

View File

@@ -1985,11 +1985,13 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
const ip = switch (native_os) {
.macos => @intCast(usize, ctx.mcontext.ss.pc),
.netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG.PC]),
else => @intCast(usize, ctx.mcontext.pc),
};
// x29 is the ABI-designated frame pointer
const bp = switch (native_os) {
.macos => @intCast(usize, ctx.mcontext.ss.fp),
.netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG.FP]),
else => @intCast(usize, ctx.mcontext.regs[29]),
};
dumpStackTraceFromBase(bp, ip);