authorgravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-04-11 18:20:26-07:00
committergravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-04-12 04:01:30-07:00
log87fb7df25794d12b2316dd41a9111e2206c00152
tree47a897f98b92f7e07a0af13b4dc8e90b1ab53a2f
parentac207073f3426e615e7d4735994f73f67af7ee8e

Updates stack trace vs error return trace in more places


4 files changed, 8 insertions(+), 6 deletions(-)

doc/langref.html.in+1-1
......@@ -3263,7 +3263,7 @@ fn createFoo(param: i32) !Foo {
32633263 <ul>
32643264 <li>Return an error from main</li>
32653265 <li>An error makes its way to {#syntax#}catch unreachable{#endsyntax#} and you have not overridden the default panic handler</li>
3266 <li>Use {#link|errorReturnTrace#} to access the current return trace. You can use {#syntax#}std.debug.dumpStackTrace{#endsyntax#} to print it. This function returns comptime-known {#link|null#} when building without error return tracing support.</li>
3266 <li>Use {#link|errorReturnTrace#} to access the current return trace. You can use {#syntax#}std.debug.dumpErrorReturnTrace{#endsyntax#} to print it. This function returns comptime-known {#link|null#} when building without error return tracing support.</li>
32673267 </ul>
32683268 {#header_open|Implementation Details#}
32693269 <p>
lib/compiler/test_runner.zig+3-3
......@@ -144,7 +144,7 @@ fn mainServer(init: std.process.Init.Minimal) !void {
144144 error.SkipZigTest => .skip,
145145 else => s: {
146146 if (@errorReturnTrace()) |trace| {
147 std.debug.dumpStackTrace(trace);
147 std.debug.dumpErrorReturnTrace(trace);
148148 }
149149 break :s .fail;
150150 },
......@@ -312,7 +312,7 @@ fn mainTerminal(init: std.process.Init.Minimal) void {
312312 std.debug.print("FAIL ({t})\n", .{err});
313313 }
314314 if (@errorReturnTrace()) |trace| {
315 std.debug.dumpStackTrace(trace);
315 std.debug.dumpErrorReturnTrace(trace);
316316 }
317317 test_node.end();
318318 },
......@@ -438,7 +438,7 @@ var fuzz_runner: if (builtin.fuzz) struct {
438438 error.SkipZigTest => return,
439439 else => {
440440 if (@errorReturnTrace()) |trace| {
441 std.debug.dumpStackTrace(trace);
441 std.debug.dumpErrorReturnTrace(trace);
442442 }
443443 std.debug.print("failed with error.{t}\n", .{err});
444444 std.process.exit(1);
lib/std/Thread.zig+2-2
......@@ -442,7 +442,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) {
442442 @call(.auto, f, args) catch |err| {
443443 std.debug.print("error: {s}\n", .{@errorName(err)});
444444 if (@errorReturnTrace()) |trace| {
445 std.debug.dumpStackTrace(trace);
445 std.debug.dumpErrorReturnTrace(trace);
446446 }
447447 };
448448
......@@ -932,7 +932,7 @@ const WasiThreadImpl = struct {
932932 @call(.auto, f, w.args) catch |err| {
933933 std.debug.print("error: {s}\n", .{@errorName(err)});
934934 if (@errorReturnTrace()) |trace| {
935 std.debug.dumpStackTrace(trace);
935 std.debug.dumpErrorReturnTrace(trace);
936936 }
937937 };
938938 },
lib/std/std.zig+2
......@@ -165,6 +165,8 @@ pub const Options = struct {
165165 /// * `debug.dumpCurrentStackTrace`
166166 /// * `debug.writeStackTrace`
167167 /// * `debug.dumpStackTrace`
168 /// * `debug.writeErrorReturnTrace`
169 /// * `debug.dumpErrorReturnTrace`
168170 ///
169171 /// Stack traces can generally be collected and printed when debug info is stripped, but are
170172 /// often less useful since they usually cannot be mapped to source locations and/or have bad