aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-06-28 14:44:00 -0400
committerGitHub <noreply@github.com>2022-06-28 14:44:00 -0400
commit8974cee5a1f67db42a83a0907d8b9e842b979072 (patch)
tree449a2d43b19eacf1f2535799f085195367adf548 /lib/std/debug.zig
parent9e8298b864e076221ca9c487412209d8a08c43b2 (diff)
parent22720981ea50b1cee38d8309e0cd32df401b8156 (diff)
downloadzig-8974cee5a1f67db42a83a0907d8b9e842b979072.tar.gz
zig-8974cee5a1f67db42a83a0907d8b9e842b979072.zip
Merge pull request #11919 from squeek502/failing-allocator-stacktrace
Add stack trace capturing to `FailingAllocator` and use it to improve `checkAllAllocationFailures`
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 54c614f270..b406fed471 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,