aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2022-06-25 21:27:56 -0700
committerRyan Liptak <squeek502@hotmail.com>2022-06-25 21:27:56 -0700
commit22720981ea50b1cee38d8309e0cd32df401b8156 (patch)
treec2fd4b33cdaff492f4e938d2ffa0bf0fd2bcc7e2 /lib/std/debug.zig
parent19d7f4dd8221fcd36b7fb71067bf676bb294ca1c (diff)
downloadzig-22720981ea50b1cee38d8309e0cd32df401b8156.tar.gz
zig-22720981ea50b1cee38d8309e0cd32df401b8156.zip
Move sys_can_stack_trace from GPA to std.debug so that it can be re-used as needed
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index ba1f509e6c..9401bca257 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -26,6 +26,27 @@ pub const runtime_safety = switch (builtin.mode) {
.ReleaseFast, .ReleaseSmall => false,
};
+pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
+ // Observed to go into an infinite loop.
+ // TODO: Make this work.
+ .mips,
+ .mipsel,
+ => false,
+
+ // `@returnAddress()` in LLVM 10 gives
+ // "Non-Emscripten WebAssembly hasn't implemented __builtin_return_address".
+ .wasm32,
+ .wasm64,
+ => builtin.os.tag == .emscripten,
+
+ // `@returnAddress()` is unsupported in LLVM 13.
+ .bpfel,
+ .bpfeb,
+ => false,
+
+ else => true,
+};
+
pub const LineInfo = struct {
line: u64,
column: u64,