Thread overview | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 13, 2017 debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
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. |
October 13, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to piotrklos | 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. I am using VisualD(https://github.com/dlang/visuald/releases) with vs2015 community version(free) and I can debug. I highly recommend it if you haven't tried yet. Those options like "-g" is presented to you with interfaces. Forexample "-g" is automatically is being added if you are selecting debug builds(like Debug DMD or Debug LDC). |
October 14, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to kerdemdemir | On Friday, 13 October 2017 at 17:04:00 UTC, kerdemdemir wrote:
> On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote:
>> (...)
>
> I am using VisualD(https://github.com/dlang/visuald/releases) with vs2015 community version(free) and I can debug. I highly recommend it if you haven't tried yet. Those options like "-g" is presented to you with interfaces. Forexample "-g" is automatically is being added if you are selecting debug builds(like Debug DMD or Debug LDC).
I will consider that, but I really like VS Code because I often switch between Linux and Windows machine, so I can have the same thing on both.
Does VisualD play well with dub?
|
October 14, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to piotrklos | On Saturday, 14 October 2017 at 07:40:31 UTC, piotrklos wrote:
> On Friday, 13 October 2017 at 17:04:00 UTC, kerdemdemir wrote:
>> On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote:
>>> (...)
>>
>> I am using VisualD(https://github.com/dlang/visuald/releases) with vs2015 community version(free) and I can debug. I highly recommend it if you haven't tried yet. Those options like "-g"
>> is presented to you with interfaces. Forexample "-g" is automatically is being added if you are selecting debug builds(like Debug DMD or Debug LDC).
>
> I will consider that, but I really like VS Code because I often switch between Linux and Windows machine, so I can have the same thing on both.
>
> Does VisualD play well with dub?
Only "dub generate visuald"
As for VS Code you need code-d extension, MS C++ extension in order to debug, and webfreak's NativeDebug extension to be able to click to set breakpoint on lines(only for that). Then under the debug pallette configure MS VS debugger and hit run from there. That's it.
|
October 14, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to piotrklos | 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.
|
October 14, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | On Saturday, 14 October 2017 at 10:15:53 UTC, evilrat wrote: > webfreak's NativeDebug extension to be able to click to set breakpoint on lines(only for that). You can just use VS Code setting, put the following into your settings.json: "debug.allowBreakpointsEverywhere": true |
October 14, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jerry | On Saturday, 14 October 2017 at 13:20:27 UTC, Jerry wrote:
> On Saturday, 14 October 2017 at 10:15:53 UTC, evilrat wrote:
>> webfreak's NativeDebug extension to be able to click to set breakpoint on lines(only for that).
>
>
>
> You can just use VS Code setting, put the following into your settings.json:
>
> "debug.allowBreakpointsEverywhere": true
But I can already click on the edge of editor and red bubble appears. Its just that the execution doesn't stop on those.
|
October 14, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to piotrklos | On Saturday, 14 October 2017 at 14:23:34 UTC, piotrklos wrote:
> On Saturday, 14 October 2017 at 13:20:27 UTC, Jerry wrote:
>> On Saturday, 14 October 2017 at 10:15:53 UTC, evilrat wrote:
>>> webfreak's NativeDebug extension to be able to click to set breakpoint on lines(only for that).
>>
>>
>>
>> You can just use VS Code setting, put the following into your settings.json:
>>
>> "debug.allowBreakpointsEverywhere": true
>
> But I can already click on the edge of editor and red bubble appears. Its just that the execution doesn't stop on those.
That comment wasn't for you, the other one was.
|
October 14, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jerry | 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?
|
October 14, 2017 Re: debugging in vs code on Windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to piotrklos | 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? Are you sure it's not dflags? I don't use dub but a quick search shows there's dflags, but no flags setting. https://code.dlang.org/package-format?lang=json Also using verbose flag with dub should show you the commands that are executed for building. |
Copyright © 1999-2021 by the D Language Foundation