#Configure vscode debugger for zig compiled C++

1 messages · Page 1 of 1 (latest)

full topaz
#

I have an (admittedly weird) amalgamation of zig and C++ code building together into one .exe (I made a little C ABI wrapper for the C++ stuff). This all works well. The problem I'm having is trying to debug the C++ with my debugger. Stepping through and seeing stack traces is working fine, but the problem is that C++ std containers do not show their members properly. For example, the image included is what the debugger makes of a vector: I cannot see its contents. Other std containers have similar issues.

My hypothesis is that this because VSCode debugger is on 'intellisense mode' windows-msvc-x64, while zig builds with gcc. I have tried to fix this via my c_cpp_properties.json configuration, but so far no luck. Does anyone know what the right settings are to get the debugger to play nice with my C++ code?

peak tusk
#

whether there's an option to make it work, i don't know. you could try using codelldb instead maybe?

#

alternatively, if you target x86_64-windows-msvc, zig will build c++ code..... uhh, either with your system's msvc, or still using clang but targeting the msvc ABI somehow, i'm not sure

full topaz
#

I'll give codelldb a try too

#

codelldb seems to at least give me the size of the vector, but still looks like I can't see the members...

peak tusk
#

that's unfortunate :(

full topaz
#

I built a C++ test application that does roughly the same stuff so I can debug with msvc, at least that works, but I'd prefer if I would not have to have a parallel application just to be able to debug...

formal sapphire
#

I'm not sure what exactly is "VS Code debugger"? Is it cppvsdbg? This one works noticeably better than CodeLLDB with Zig on Windows, not sure about variable display though. You could also try debugging in Visual Studio instead, that works even a little bit better IIRC, maybe not in the aspects that you need, but could be worth trying.

full topaz
#

The zig debugging works great, it's only the C++ std containers