Function dumpCurrentStackTraceToWriter [src]
Prints the current stack trace to the provided writer.
Prototype
pub fn dumpCurrentStackTraceToWriter(start_addr: ?usize, writer: *Writer) !void
Parameters
start_addr: ?usize
writer: *Writer
Source
pub fn dumpCurrentStackTraceToWriter(start_addr: ?usize, writer: *Writer) !void {
if (builtin.target.cpu.arch.isWasm()) {
if (native_os == .wasi) {
try writer.writeAll("Unable to dump stack trace: not implemented for Wasm\n");
}
return;
}
if (builtin.strip_debug_info) {
try writer.writeAll("Unable to dump stack trace: debug info stripped\n");
return;
}
const debug_info = getSelfDebugInfo() catch |err| {
try writer.print("Unable to dump stack trace: Unable to open debug info: {s}\n", .{@errorName(err)});
return;
};
writeCurrentStackTrace(writer, debug_info, tty.detectConfig(.stderr()), start_addr) catch |err| {
try writer.print("Unable to dump stack trace: {s}\n", .{@errorName(err)});
return;
};
}