| ... | @@ -1696,7 +1696,7 @@ fn getDebugInfoAllocator() *mem.Allocator { | ... | @@ -1696,7 +1696,7 @@ fn getDebugInfoAllocator() *mem.Allocator { |
| 1696 | pub const have_segfault_handling_support = switch (builtin.os.tag) { | 1696 | pub const have_segfault_handling_support = switch (builtin.os.tag) { |
| 1697 | .linux, .netbsd => true, | 1697 | .linux, .netbsd => true, |
| 1698 | .windows => true, | 1698 | .windows => true, |
| 1699 | .freebsd => @hasDecl(os, "ucontext_t"), | 1699 | .freebsd, .openbsd => @hasDecl(os, "ucontext_t"), |
| 1700 | else => false, | 1700 | else => false, |
| 1701 | }; | 1701 | }; |
| 1702 | pub const enable_segfault_handler: bool = if (@hasDecl(root, "enable_segfault_handler")) | 1702 | pub const enable_segfault_handler: bool = if (@hasDecl(root, "enable_segfault_handler")) |
| ... | @@ -1760,6 +1760,7 @@ fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const c_v | ... | @@ -1760,6 +1760,7 @@ fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const c_v |
| 1760 | .linux => @ptrToInt(info.fields.sigfault.addr), | 1760 | .linux => @ptrToInt(info.fields.sigfault.addr), |
| 1761 | .freebsd => @ptrToInt(info.addr), | 1761 | .freebsd => @ptrToInt(info.addr), |
| 1762 | .netbsd => @ptrToInt(info.info.reason.fault.addr), | 1762 | .netbsd => @ptrToInt(info.info.reason.fault.addr), |
| | 1763 | .openbsd => @ptrToInt(info.data.fault.addr), |
| 1763 | else => unreachable, | 1764 | else => unreachable, |
| 1764 | }; | 1765 | }; |
| 1765 | | 1766 | |
| ... | @@ -1786,10 +1787,12 @@ fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const c_v | ... | @@ -1786,10 +1787,12 @@ fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const c_v |
| 1786 | const ip = switch (builtin.os.tag) { | 1787 | const ip = switch (builtin.os.tag) { |
| 1787 | .linux, .netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG_RIP]), | 1788 | .linux, .netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG_RIP]), |
| 1788 | .freebsd => @intCast(usize, ctx.mcontext.rip), | 1789 | .freebsd => @intCast(usize, ctx.mcontext.rip), |
| | 1790 | .openbsd => @intCast(usize, ctx.sc_rip), |
| 1789 | else => unreachable, | 1791 | else => unreachable, |
| 1790 | }; | 1792 | }; |
| 1791 | const bp = switch (builtin.os.tag) { | 1793 | const bp = switch (builtin.os.tag) { |
| 1792 | .linux, .netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG_RBP]), | 1794 | .linux, .netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG_RBP]), |
| | 1795 | .openbsd => @intCast(usize, ctx.sc_rbp), |
| 1793 | .freebsd => @intCast(usize, ctx.mcontext.rbp), | 1796 | .freebsd => @intCast(usize, ctx.mcontext.rbp), |
| 1794 | else => unreachable, | 1797 | else => unreachable, |
| 1795 | }; | 1798 | }; |