diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-10-21 04:40:44 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-10-29 06:20:50 -0700 |
| commit | aadd8d4a3efd8912c47b8ea1bbd4c3a6649c3e5d (patch) | |
| tree | 9b6e2b59f28bd736c70a103fb063a55e3ddafef9 /lib/std | |
| parent | 4ed74a9f8ab97f3358fc881d0e2f6359e22186d6 (diff) | |
| download | zig-aadd8d4a3efd8912c47b8ea1bbd4c3a6649c3e5d.tar.gz zig-aadd8d4a3efd8912c47b8ea1bbd4c3a6649c3e5d.zip | |
std: back out the StackTrace byval changes
Let's keep passing this thing by pointer
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/Build/Step.zig | 2 | ||||
| -rw-r--r-- | lib/std/Thread.zig | 4 | ||||
| -rw-r--r-- | lib/std/debug.zig | 10 | ||||
| -rw-r--r-- | lib/std/start.zig | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig index d1985739bd..aa922ff37b 100644 --- a/lib/std/Build/Step.zig +++ b/lib/std/Build/Step.zig @@ -332,7 +332,7 @@ pub fn cast(step: *Step, comptime T: type) ?*T { pub fn dump(step: *Step, w: *Io.Writer, tty_config: Io.tty.Config) void { if (step.debug_stack_trace.instruction_addresses.len > 0) { w.print("name: '{s}'. creation stack trace:\n", .{step.name}) catch {}; - std.debug.writeStackTrace(step.debug_stack_trace, w, tty_config) catch {}; + std.debug.writeStackTrace(&step.debug_stack_trace, w, tty_config) catch {}; } else { const field = "debug_stack_frames_count"; comptime assert(@hasField(Build, field)); diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index 891c4f220e..7e1ce45a46 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -577,7 +577,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { @call(.auto, f, args) catch |err| { std.debug.print("error: {s}\n", .{@errorName(err)}); if (@errorReturnTrace()) |trace| { - std.debug.dumpStackTrace(trace.*); + std.debug.dumpStackTrace(trace); } }; @@ -1010,7 +1010,7 @@ const WasiThreadImpl = struct { @call(.auto, f, w.args) catch |err| { std.debug.print("error: {s}\n", .{@errorName(err)}); if (@errorReturnTrace()) |trace| { - std.debug.dumpStackTrace(trace.*); + std.debug.dumpStackTrace(trace); } }; }, diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 3d88123c64..a92a4b360f 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -553,7 +553,7 @@ pub fn defaultPanic( if (@errorReturnTrace()) |t| if (t.index > 0) { stderr.writeAll("error return context:\n") catch break :trace; - writeStackTrace(t.*, stderr, tty_config) catch break :trace; + writeStackTrace(t, stderr, tty_config) catch break :trace; stderr.writeAll("\nstack trace:\n") catch break :trace; }; writeCurrentStackTrace(.{ @@ -765,12 +765,12 @@ pub const FormatStackTrace = struct { pub fn format(context: @This(), writer: *Io.Writer) Io.Writer.Error!void { try writer.writeAll("\n"); - try writeStackTrace(context.stack_trace, writer, context.tty_config); + try writeStackTrace(&context.stack_trace, writer, context.tty_config); } }; /// Write a previously captured stack trace to `writer`, annotated with source locations. -pub fn writeStackTrace(st: StackTrace, writer: *Writer, tty_config: tty.Config) Writer.Error!void { +pub fn writeStackTrace(st: *const StackTrace, writer: *Writer, tty_config: tty.Config) Writer.Error!void { if (!std.options.allow_stack_tracing) { tty_config.setColor(writer, .dim) catch {}; try writer.print("Cannot print stack trace: stack tracing is disabled\n", .{}); @@ -808,7 +808,7 @@ pub fn writeStackTrace(st: StackTrace, writer: *Writer, tty_config: tty.Config) } } /// A thin wrapper around `writeStackTrace` which writes to stderr and ignores write errors. -pub fn dumpStackTrace(st: StackTrace) void { +pub fn dumpStackTrace(st: *const StackTrace) void { const tty_config = tty.detectConfig(.stderr()); const stderr = lockStderrWriter(&.{}); defer unlockStderrWriter(); @@ -1686,7 +1686,7 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize .index = frames.len, .instruction_addresses = frames, }; - writeStackTrace(stack_trace, stderr, tty_config) catch return; + writeStackTrace(&stack_trace, stderr, tty_config) catch return; } if (t.index > end) { stderr.print("{d} more traces not shown; consider increasing trace size\n", .{ diff --git a/lib/std/start.zig b/lib/std/start.zig index 4063b2027b..09c1f3b5c4 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -708,7 +708,7 @@ pub inline fn callMain() u8 { switch (native_os) { .freestanding, .other => {}, else => if (@errorReturnTrace()) |trace| { - std.debug.dumpStackTrace(trace.*); + std.debug.dumpStackTrace(trace); }, } return 1; |
