From 22720981ea50b1cee38d8309e0cd32df401b8156 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sat, 25 Jun 2022 21:27:56 -0700 Subject: Move sys_can_stack_trace from GPA to std.debug so that it can be re-used as needed --- lib/std/debug.zig | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/std/debug.zig') 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, -- cgit v1.2.3