| ... | @@ -252,6 +252,9 @@ pub fn dumpStackTraceFromBase(context: *const ThreadContext) void { | ... | @@ -252,6 +252,9 @@ pub fn dumpStackTraceFromBase(context: *const ThreadContext) void { |
| 252 | // same behaviour for x86-windows-msvc | 252 | // same behaviour for x86-windows-msvc |
| 253 | const address = if (return_address == 0) return_address else return_address - 1; | 253 | const address = if (return_address == 0) return_address else return_address - 1; |
| 254 | printSourceAtAddress(debug_info, stderr, address, tty_config) catch return; | 254 | printSourceAtAddress(debug_info, stderr, address, tty_config) catch return; |
| | 255 | } else { |
| | 256 | if (it.getLastError()) |unwind_error| |
| | 257 | printUnwindError(debug_info, stderr, unwind_error.address, unwind_error.err, tty_config) catch {}; |
| 255 | } | 258 | } |
| 256 | } | 259 | } |
| 257 | } | 260 | } |
| ... | @@ -741,6 +744,9 @@ pub fn writeCurrentStackTrace( | ... | @@ -741,6 +744,9 @@ pub fn writeCurrentStackTrace( |
| 741 | // same behaviour for x86-windows-msvc | 744 | // same behaviour for x86-windows-msvc |
| 742 | const address = if (return_address == 0) return_address else return_address - 1; | 745 | const address = if (return_address == 0) return_address else return_address - 1; |
| 743 | try printSourceAtAddress(debug_info, out_stream, address, tty_config); | 746 | try printSourceAtAddress(debug_info, out_stream, address, tty_config); |
| | 747 | } else { |
| | 748 | if (it.getLastError()) |unwind_error| |
| | 749 | try printUnwindError(debug_info, out_stream, unwind_error.address, unwind_error.err, tty_config); |
| 744 | } | 750 | } |
| 745 | } | 751 | } |
| 746 | | 752 | |
| ... | @@ -882,7 +888,11 @@ fn printUnknownSource(debug_info: *DebugInfo, out_stream: anytype, address: usiz | ... | @@ -882,7 +888,11 @@ fn printUnknownSource(debug_info: *DebugInfo, out_stream: anytype, address: usiz |
| 882 | pub fn printUnwindError(debug_info: *DebugInfo, out_stream: anytype, address: usize, err: UnwindError, tty_config: io.tty.Config) !void { | 888 | pub fn printUnwindError(debug_info: *DebugInfo, out_stream: anytype, address: usize, err: UnwindError, tty_config: io.tty.Config) !void { |
| 883 | const module_name = debug_info.getModuleNameForAddress(address) orelse "???"; | 889 | const module_name = debug_info.getModuleNameForAddress(address) orelse "???"; |
| 884 | try tty_config.setColor(out_stream, .dim); | 890 | try tty_config.setColor(out_stream, .dim); |
| 885 | try out_stream.print("Unwind information for `{s}:0x{x}` was not available ({}), trace may be incomplete\n\n", .{ module_name, address, err }); | 891 | if (err == error.MissingDebugInfo) { |
| | 892 | try out_stream.print("Unwind information for `{s}:0x{x}` was not available, trace may be incomplete\n\n", .{ module_name, address }); |
| | 893 | } else { |
| | 894 | try out_stream.print("Unwind error at address `{s}:0x{x}` ({}), trace may be incomplete\n\n", .{ module_name, address, err }); |
| | 895 | } |
| 886 | try tty_config.setColor(out_stream, .reset); | 896 | try tty_config.setColor(out_stream, .reset); |
| 887 | } | 897 | } |
| 888 | | 898 | |