Debugging Zig (with a debugger)

if you’re wondering why debug info with the custom backends doesn’t work; it’s 2 things, it uses DWARF 5 format which majority of debuggers have yet to update to.
It also has zig specific extensions to make debug info for incremental builds much easier to manage.

Even with dwarf 5, zig isn’t officially supported, though it is in the draft for dwarf 6. So debuggers won’t necessarily support zig.
Only the zig lldb fork supports zig afaik, there are some wip debuggers in zig that will likely support zig’s extensions but i dont think any of them currently do.

The reason debug info works with llvm is cause zig uses c++ debug info, which is less than accurate but works well enough for simple debugging.

8 Likes