Dwarf Debug in zig 13

https://andrewkelley.me/post/zig-stack-traces-kernel-panic-bare-bones-os.html
I wanted to do this but using zig 13 does anyone have an idea how?

The useful functions that you can call as-is are:

The functions that have all the printing code for a terminal and you might need to adapt for your display or serial port:

3 Likes

I’ve been trying to look into this for myself…

std.debug.captureStackTrace seems to crash for me on aarch64/freestanding for a raspi3b.

std.debug.getSelfDebugInfo throws compilation error:

/opt/homebrew/Cellar/zig/0.13.0/lib/zig/std/posix.zig:60:21: error: struct 'posix.system__struct_3745' has no member named 'E'
pub const E = system.E;
              ~~~~~~^~
/opt/homebrew/Cellar/zig/0.13.0/lib/zig/std/posix.zig:48:13: note: struct declared here
    else => struct {},
            ^~~~~~~~~

A lot has changed in Zig since Andrew wrote that article… It’s hard to keep up, but I’m slowly trying to re-figure stuff out :smiley: