As mentioned, I am using VSCode + CodeLLDB.
My project is Sac-Zig-build.
Now I have a general understanding of the normal compilation process. When linkLibCpp()
is called, it links to the libc++ that comes with Zig. When linkLibC()
is called with -Dtarget=x86_64-windows-msvc
, it links to MSVC.
However, debugging is almost unusable.
The situation when linking with Zig libc is as follows:
Normally,
uparam
as a
String
should be visible at a shallow level.
This looks like the debugger doesnât have ânatvisâ information (thatâs what itâs called in the VStudio world, not sure what its called elsewhere), not sure if the Zig toolchain is supposed to provide that information though (probably not).
When linkLibCpp()
is called, it links to the libc++ that comes with Zig. When linkLibC()
is called with -Dtarget=x86_64-windows-msvc
, it links to MSVC.
(nvm: see my reply below) AFAIK linkLibCpp()
and linkLibC()
are entirely different things (one is for the C++ stdlib, the other for the C stdlib) - e.g. linkLibC()
should be unrelated to the problem youâre seeing.
First thing I would check is whether the combination of using a *-windows-msvc
target and the Microsoft debugger via the VSCode MS C/C++ Extension works (e.g. not using CodeLLDB for debugging).
Thereâs also this ânot-plannedâ ticket which might be related: Add the ability to link Natvis files into PDBs ¡ Issue #19646 ¡ ziglang/zig ¡ GitHub
PS: FWIW on macOS it âjust worksâ with CodeLLDB (e.g. âcmdlineâ is a std::string):
This is using sokol-tools/build.zig at master ¡ floooh/sokol-tools ¡ GitHub which builds a pure C++ project.
âŚah, now I know what you mean with linkLibCpp vs linkLibC, because I have this snippet in the build.zig:
if (exe.rootModuleTarget().abi != .msvc) {
exe.linkLibCpp();
} else {
exe.linkLibC();
}
âŚI guess what this means is that msvc targets donât have a linkable C++ stdlib (since everything is implemented in inline headers).
I havenât tried debugging on Windows with this build.zig though.
Thank you for your reply. After my research, I found that this issue is actually very simple:Discord
1 Like