aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-09-17 23:30:04 +0100
committermlugg <mlugg@mlugg.co.uk>2025-09-30 13:44:55 +0100
commitabb2b1e2daffdadca7edc26634631215df901950 (patch)
treec7005ecca97db608bba384dbdc43fc56c24eb8a2 /lib/std/debug.zig
parentdd8d59686a069fdb72d9f0753e3482ff99cce98c (diff)
downloadzig-abb2b1e2daffdadca7edc26634631215df901950.tar.gz
zig-abb2b1e2daffdadca7edc26634631215df901950.zip
std.debug: update support checks
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig19
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index 5b7a6bf715..e22f2f7345 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -175,18 +175,12 @@ pub const runtime_safety = switch (builtin.mode) {
.ReleaseFast, .ReleaseSmall => false,
};
+/// Whether we can unwind the stack on this target, allowing capturing and/or printing the current
+/// stack trace. It is still legal to call `captureCurrentStackTrace`, `writeCurrentStackTrace`, and
+/// `dumpCurrentStackTrace` if this is `false`; it will just print an error / capture an empty
+/// trace due to missing functionality. This value is just intended as a heuristic to avoid
+/// pointless work e.g. capturing always-empty stack traces.
pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
- // Observed to go into an infinite loop.
- // TODO: Make this work.
- .loongarch32,
- .loongarch64,
- .mips,
- .mipsel,
- .mips64,
- .mips64el,
- .s390x,
- => false,
-
// `@returnAddress()` in LLVM 10 gives
// "Non-Emscripten WebAssembly hasn't implemented __builtin_return_address".
// On Emscripten, Zig only supports `@returnAddress()` in debug builds
@@ -1178,9 +1172,10 @@ pub const have_segfault_handling_support = switch (native_os) {
.solaris,
.illumos,
.windows,
+ .freebsd,
+ .openbsd,
=> true,
- .freebsd, .openbsd => cpu_context.Native != noreturn,
else => false,
};