pub const sys_can_stack_trace = switch (builtin.cpu.arch) 260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
// `@returnAddress()` in LLVM 10 gives
// "Non-Emscripten WebAssembly hasn't implemented __builtin_return_address".
// On Emscripten, Zig only supports `@returnAddress()` in debug builds
// because Emscripten's implementation is very slow.
.wasm32,
.wasm64,
=> native_os == .emscripten and builtin.mode == .debug,
// `@returnAddress()` is unsupported in LLVM 21.
.bpfel,
.bpfeb,
=> false,
// https://codeberg.org/ziglang/zig/issues/31127
.avr => false,
else => true,
}
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, anddumpCurrentStackTraceif this isfalse; 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.