diff --git a/lib/std/debug.zig b/lib/std/debug.zig index b7d877bfaf..ae8ec072df 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -355,7 +355,7 @@ pub fn relocateContext(dest: *ThreadContext) void { /// The value which is placed on the stack to make a copy of a `ThreadContext`. const ThreadContextBuf = if (ThreadContext == noreturn) void else ThreadContext; /// The pointer through which a `ThreadContext` is received from callers of stack tracing logic. -const ThreadContextPtr = if (ThreadContext == noreturn) noreturn else *const ThreadContext; +pub const ThreadContextPtr = if (ThreadContext == noreturn) noreturn else *const ThreadContext; /// Capture the current context. The register values in the context will reflect the /// state after the platform `getcontext` function returns. @@ -1297,7 +1297,7 @@ fn handleSegfaultPosix(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopa if (ThreadContext == noreturn) return handleSegfault(addr, name, null); // Some kernels don't align `ctx_ptr` properly, so we'll copy it into a local buffer. - var copied_ctx: ThreadContextBuf = undefined; + var copied_ctx: posix.ucontext_t = undefined; const orig_ctx: *align(1) posix.ucontext_t = @ptrCast(ctx_ptr); copied_ctx = orig_ctx.*; if (builtin.os.tag.isDarwin() and builtin.cpu.arch == .aarch64) { diff --git a/src/crash_report.zig b/src/crash_report.zig index c696c42cfc..8c686459fe 100644 --- a/src/crash_report.zig +++ b/src/crash_report.zig @@ -17,7 +17,7 @@ pub const debug = struct { /// crash earlier than that. pub var zig_argv0: []const u8 = "zig"; -fn handleSegfaultImpl(addr: ?usize, name: []const u8, opt_ctx: ?*std.debug.ThreadContext) noreturn { +fn handleSegfaultImpl(addr: ?usize, name: []const u8, opt_ctx: ?std.debug.ThreadContextPtr) noreturn { @branchHint(.cold); dumpCrashContext() catch {}; std.debug.defaultHandleSegfault(addr, name, opt_ctx); @@ -56,6 +56,7 @@ pub const AnalyzeBody = if (build_options.enable_debug_extensions) struct { current = ab.parent; } } else struct { + const current: ?noreturn = null; // Dummy implementation, with functions marked `inline` to avoid interfering with tail calls. pub inline fn push(_: AnalyzeBody, _: *Sema, _: *Sema.Block, _: []const Zir.Inst.Index) void {} pub inline fn pop(_: AnalyzeBody) void {} @@ -75,6 +76,7 @@ pub const CodegenFunc = if (build_options.enable_debug_extensions) struct { current = null; } } else struct { + const current: ?noreturn = null; // Dummy implementation pub fn start(_: *const Zcu, _: InternPool.Index) void {} pub fn stop(_: InternPool.Index) void {}