debugging in vs code on Windows
Heromyth
bitworld at qq.com
Sun Oct 15 00:00:22 UTC 2017
On Saturday, 14 October 2017 at 19:01:52 UTC, piotrklos wrote:
> On Saturday, 14 October 2017 at 13:12:51 UTC, Jerry wrote:
>> On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote:
>>> (...)
>>
>> 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.
>
> I have added this to dub.json:
> "dmd-flags":[
> "-g", "-m64", "-L/DEBUG"
> ]
> but I don't see a pdb file generated when I build. What am I
> doing wrong?
It's not necessary to set "dmd-flags". You need to run dub with
"--arch=x86_64 --build=debug". Then, the .pdb file is under the
folder .dub.
To start a debug session, you would add a config file called
launch.json, set the "program" and press F5.
By the way, don't foret to add a breakpoint.
More information about the Digitalmars-d-learn
mailing list