Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Constant

sys_can_stack_trace

Public Constant
std.debug.sys_can_stack_trace
pub const sys_can_stack_trace = switch (builtin.cpu.arch)

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.

File

debug.zig:260
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
pub 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,
}