debugging in vs code on Windows

Jerry hurricane at hereiam.com
Sat Oct 14 13:12:51 UTC 2017


On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote:
> I have windows 10, VS Code with code-d and C/C++ language 
> extensions. I try to debug but it doesn't work. In particular, 
> the debugging doesn't stop on breakpoints. It exits 
> immediately. I recompile with -m64 and -g. I use dub to build 
> the project. I use unit-threaded and I'm trying to debug a 
> unittest build.
>
> Has anyone been able to debug in VS code on Windows? What am I 
> doing wrong?
>
> (Rhetorical) Why is dlang community provide so many options 
> (see https://wiki.dlang.org/Debuggers) and **every single one** 
> of them is faulty in some way? I tried windbg and mago-mi but 
> didn't gen anywhere.

If you use generate a 32-bit binary using DMD, it generates it in 
a format that the C/C++ extension doesn't understand. You need to 
compile -m32mscoff or -m64, and you need to make sure the /DEBUG 
is passed to the linker, as I don't think dmd passes it that. You 
can do that by passing "-L/DEBUG" to DMD (when using -m32mscoff 
or -m64). There should be a .pdb file that gets generated, when 
you start the debugger it should say that symbols were loaded for 
the exe.

I also can't say for certain if debug information is even 
generated for the unittests, so that might be something worth 
looking into to make sure it does.


More information about the Digitalmars-d-learn mailing list