diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 87af0eefb9..2b6028ca82 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -732,7 +732,15 @@ pub fn dumpCurrentStackTrace(options: StackUnwindOptions) void { const tty_config = tty.detectConfig(.stderr()); const stderr = lockStderrWriter(&.{}); defer unlockStderrWriter(); - writeCurrentStackTrace(options, stderr, tty_config) catch |err| switch (err) { + writeCurrentStackTrace(.{ + .first_address = a: { + if (options.first_address) |a| break :a a; + if (options.context != null) break :a null; + break :a @returnAddress(); // don't include this frame in the trace + }, + .context = options.context, + .allow_unsafe_unwind = options.allow_unsafe_unwind, + }, stderr, tty_config) catch |err| switch (err) { error.WriteFailed => {}, }; }