Hello, I’ve searched online and found a few posts about setting zig up for debugging on windows with vs code but I cannot get it to work. I’ve been trying on and off for the past 2 months but for some reason I just cannot get it to actually debug any thing.
I’m using windows 11 and visual studio code. I have the c++ modules installed from visual studio. Does anyone have any ideas or suggestions on how to get it to work?
This launch.json works here (sokol-zig examples) with the MS C/C++ Extension and the Zig extension installed (without the Zig extension to identify Zig files as source code VSCode wouldn’t let me set breakpoints).
You just need to build the debuggee manually via zig build so that the executable is placed into zig-out/bin (you should check that it’s there, because just a zig run won’t place an executable into zig-out), and then press F5 to start a debug session.
If you have lldb allready installed and usable in your PATH you can also use the LLDB DAP vscode extension provided by llvm. Their launch.json type is "lldb-dap".
Another option for windows debugging is WinDbg, that support time travel debugging.
Install by running winget install Microsoft.WinDbg
Yeah, but I didn’t even get that far when I just tried the current CodeLLDB version - so I tried the MSVC debugger integration from the MS C/C++ Extension and that also worked Normally VSCode offers to create a launch.json template for all debug extensions (e.g. you get a dropdown with ‘CodeLLDB’ in it), but that just did nothing. It looks like there’s some regression in CodeLLDB or VSCode on Windows.