Zig's Self-Hosted x86 Backend Requires a Fork of LLDB for debugging
There has been a change this summer in Zig: Self-Hosted x86 Backend is Now Default in Debug Mode
I was not aware of this when I started looking into Zig on my ageing Intel Mac: using Visual Studio Code and the CodeLLDB extension, I could not figure out why my breakpoints were not hit, despite being able to manually add some breakpoints with the function names using LLDB on the terminal.
Long story short, the self-hosted x86 backend requires a fork of LLDB. You can find instructions on how to build it on this wiki page, and you can specify it to CodeLLDB with the lldb.library setting.
If you'd rather not, you can revert to the LLVM backend for building x86 targets by specifying .use_llvm = true in your LibraryOptions/ExecutableOptions/TestOptions, inside your build.zig file. For the zig test command, you can also pass -fllvm to force the LLVM backend for codegen.
Wished that was mentioned more prominently somewhere, so here's a blog post to pass on the knowledge.
I was not aware of this when I started looking into Zig on my ageing Intel Mac: using Visual Studio Code and the CodeLLDB extension, I could not figure out why my breakpoints were not hit, despite being able to manually add some breakpoints with the function names using LLDB on the terminal.
Long story short, the self-hosted x86 backend requires a fork of LLDB. You can find instructions on how to build it on this wiki page, and you can specify it to CodeLLDB with the lldb.library setting.
If you'd rather not, you can revert to the LLVM backend for building x86 targets by specifying .use_llvm = true in your LibraryOptions/ExecutableOptions/TestOptions, inside your build.zig file. For the zig test command, you can also pass -fllvm to force the LLVM backend for codegen.
Wished that was mentioned more prominently somewhere, so here's a blog post to pass on the knowledge.

Comments
Post a Comment