mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
debug: print unwind errors if they occur on the first iteration, and differentiate between missing info and an actual unwind error in the message
This commit is contained in:
parent
1aacfa7186
commit
a84826115f
@ -252,6 +252,9 @@ pub fn dumpStackTraceFromBase(context: *const ThreadContext) void {
|
||||
// same behaviour for x86-windows-msvc
|
||||
const address = if (return_address == 0) return_address else return_address - 1;
|
||||
printSourceAtAddress(debug_info, stderr, address, tty_config) catch return;
|
||||
} else {
|
||||
if (it.getLastError()) |unwind_error|
|
||||
printUnwindError(debug_info, stderr, unwind_error.address, unwind_error.err, tty_config) catch {};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -741,6 +744,9 @@ pub fn writeCurrentStackTrace(
|
||||
// same behaviour for x86-windows-msvc
|
||||
const address = if (return_address == 0) return_address else return_address - 1;
|
||||
try printSourceAtAddress(debug_info, out_stream, address, tty_config);
|
||||
} else {
|
||||
if (it.getLastError()) |unwind_error|
|
||||
try printUnwindError(debug_info, out_stream, unwind_error.address, unwind_error.err, tty_config);
|
||||
}
|
||||
}
|
||||
|
||||
@ -882,7 +888,11 @@ fn printUnknownSource(debug_info: *DebugInfo, out_stream: anytype, address: usiz
|
||||
pub fn printUnwindError(debug_info: *DebugInfo, out_stream: anytype, address: usize, err: UnwindError, tty_config: io.tty.Config) !void {
|
||||
const module_name = debug_info.getModuleNameForAddress(address) orelse "???";
|
||||
try tty_config.setColor(out_stream, .dim);
|
||||
try out_stream.print("Unwind information for `{s}:0x{x}` was not available ({}), trace may be incomplete\n\n", .{ module_name, address, err });
|
||||
if (err == error.MissingDebugInfo) {
|
||||
try out_stream.print("Unwind information for `{s}:0x{x}` was not available, trace may be incomplete\n\n", .{ module_name, address });
|
||||
} else {
|
||||
try out_stream.print("Unwind error at address `{s}:0x{x}` ({}), trace may be incomplete\n\n", .{ module_name, address, err });
|
||||
}
|
||||
try tty_config.setColor(out_stream, .reset);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user