aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-09-08 11:38:25 +0100
committermlugg <mlugg@mlugg.co.uk>2025-09-30 13:44:51 +0100
commit253fdfce7064a6ebf70dbb62b465d6564eac0948 (patch)
tree02bd4ff3c8cc560e94325fdc3ba7383533b78101 /lib/std/debug.zig
parent9859440d83e5ef17d353be39f32f2dc0b9ce0e02 (diff)
downloadzig-253fdfce7064a6ebf70dbb62b465d6564eac0948.tar.gz
zig-253fdfce7064a6ebf70dbb62b465d6564eac0948.zip
SelfInfo: be honest about how general unwinding is
...in that it isn't: it's currently very specialized to DWARF unwinding. Also, make a type unmanaged.
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index f2d15e3fe8..cfc442562f 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -747,7 +747,7 @@ pub fn dumpStackTrace(st: *const std.builtin.StackTrace) void {
const StackIterator = union(enum) {
/// Unwinding using debug info (e.g. DWARF CFI).
- di: if (SelfInfo.supports_unwinding) SelfInfo.UnwindContext else noreturn,
+ di: if (SelfInfo.supports_unwinding) SelfInfo.DwarfUnwindContext else noreturn,
/// Naive frame-pointer-based unwinding. Very simple, but typically unreliable.
fp: usize,
@@ -766,17 +766,17 @@ const StackIterator = union(enum) {
if (context_opt) |context| {
context_buf.* = context.*;
relocateContext(context_buf);
- return .{ .di = .init(getDebugInfoAllocator(), context_buf) };
+ return .{ .di = .init(context_buf) };
}
if (getContext(context_buf)) {
- return .{ .di = .init(getDebugInfoAllocator(), context_buf) };
+ return .{ .di = .init(context_buf) };
}
return .{ .fp = @frameAddress() };
}
fn deinit(si: *StackIterator) void {
switch (si.*) {
.fp => {},
- .di => |*unwind_context| unwind_context.deinit(),
+ .di => |*unwind_context| unwind_context.deinit(getDebugInfoAllocator()),
}
}
@@ -944,6 +944,9 @@ fn printLineInfo(
tty_config.setColor(writer, .reset) catch {};
}
try writer.writeAll("\n");
+ } else |_| {
+ // Ignore all errors; it's a better UX to just print the source location without the
+ // corresponding line number. The user can always open the source file themselves.
}
}
}