Tested on macOS:
- Install the CodeLLDB VSCode extension. Unlike the debugger in the C/C++ extension, this allows to set breakpoints inside Zig "test" blocks (in the MS C/C++ extension debugger, breakpoints inside test blocks will be disabled once the debugger starts for unknown reasons.
- When compiling the test, tell it to also emit a binary:
zig test -femit-bin=zig-out/bin/my-test src/bla.zig
, otherwise there will be no executable to debug. - The compiled test executable expects the path to the Zig executable as first command line argument, the launch.json file
needs to be setup accordingly (note the
args
item):