Thread overview
How to debug in vscode Windows?
Dec 27, 2019
Andre Pany
Jan 01, 2020
WebFreak001
Jan 01, 2020
NaN
Jan 01, 2020
solidstate1991
Jan 01, 2020
NaN
December 27, 2019
Hello.

I spent many time to searching for find a solutions. Many posts not clearly or tell like brief. :(

I tried "Microsoft C/C++(ms-vscode.cpptools)" and "Native Debug (webfreak.debug
)" plugin. And I found this post: https://forum.dlang.org/post/jxnnfzjsytoneqvxefgf@forum.dlang.org
Yeah, "Native Debug" is not work on windows.

I guess, can only use a GDB with "Microsoft C/C++(ms-vscode.cpptools)" for debug on windows. But I can't find setup guide for D clearly.
December 27, 2019
On Friday, 27 December 2019 at 18:48:50 UTC, cfcd14f496326e429ce03c48650b7966 wrote:
> Hello.
>
> I spent many time to searching for find a solutions. Many posts not clearly or tell like brief. :(
>
> I tried "Microsoft C/C++(ms-vscode.cpptools)" and "Native Debug (webfreak.debug
> )" plugin. And I found this post: https://forum.dlang.org/post/jxnnfzjsytoneqvxefgf@forum.dlang.org
> Yeah, "Native Debug" is not work on windows.
>
> I guess, can only use a GDB with "Microsoft C/C++(ms-vscode.cpptools)" for debug on windows. But I can't find setup guide for D clearly.


I use the Microsoft plugin and it was working out of the box. There was no D specific setting to be done but as far as I remember just setting the executable file path in the debug json file.

The only thing you have to take care of: with older versions of Dub, the executable has OMF architecture, recent versions of dub defaults to COFF (64 bit). Out of the box debugging works only for COFF.

Kind regards
Andre
January 01, 2020
On Friday, 27 December 2019 at 18:48:50 UTC, cfcd14f496326e429ce03c48650b7966 wrote:
> Hello.
>
> I spent many time to searching for find a solutions. Many posts not clearly or tell like brief. :(
>
> I tried "Microsoft C/C++(ms-vscode.cpptools)" and "Native Debug (webfreak.debug
> )" plugin. And I found this post: https://forum.dlang.org/post/jxnnfzjsytoneqvxefgf@forum.dlang.org
> Yeah, "Native Debug" is not work on windows.
>
> I guess, can only use a GDB with "Microsoft C/C++(ms-vscode.cpptools)" for debug on windows. But I can't find setup guide for D clearly.

hi, if you have the latest code-d version for vscode (webfreak.code-d) you can check in the User Guide (F1 -> code-d user guide) that it has a section about debugging you can check out which should guide you through all the steps to debug.

In there you should find all information you need.
January 01, 2020
On Friday, 27 December 2019 at 18:48:50 UTC, cfcd14f496326e429ce03c48650b7966 wrote:
> Hello.
>
> I spent many time to searching for find a solutions. Many posts not clearly or tell like brief. :(
>
> I tried "Microsoft C/C++(ms-vscode.cpptools)" and "Native Debug (webfreak.debug
> )" plugin. And I found this post: https://forum.dlang.org/post/jxnnfzjsytoneqvxefgf@forum.dlang.org
> Yeah, "Native Debug" is not work on windows.
>
> I guess, can only use a GDB with "Microsoft C/C++(ms-vscode.cpptools)" for debug on windows. But I can't find setup guide for D clearly.

You can use visual studio (works in 2019, havent tried earlier versions) to debug any exe you want. You do this...

Go to File menu, then Open, then Project/Solution

Make sure "all project files" is selected, then find the exe you want to debug, click Open.

Now you can debug that exe inside Visual Studio (as long as its been compiled with debug info) You can also save the solution so next time you just open the solution and you're ready to debug.

You can drop source files into visual studio and set breakpoints, but it will also automatically pull up the source when it hits an exception. Although you might need adjust VS settings so it breaks on all exceptions IIRC... explains how on this page...

https://docs.microsoft.com/en-us/visualstudio/debugger/managing-exceptions-with-the-debugger?view=vs-2019

Its pretty much all working, except you cant see dynamic array contents and occasionally it steps a line out of sync.

I never managed to get any debugger working in VSCode. But this way you get the Visual Studio debugger which as good as it gets, and its just a couple of clicks away.

Oh I'm using LDC to compile so I'm not sure how well it works with DMD, haven't tried, but should work the same I imagine.




January 01, 2020
On Wednesday, 1 January 2020 at 14:46:01 UTC, NaN wrote:
> You can use visual studio (works in 2019, havent tried earlier versions) to debug any exe you want. You do this...
>
> Go to File menu, then Open, then Project/Solution
>
> Make sure "all project files" is selected, then find the exe you want to debug, click Open.
>
> Now you can debug that exe inside Visual Studio (as long as its been compiled with debug info) You can also save the solution so next time you just open the solution and you're ready to debug.
>
> You can drop source files into visual studio and set breakpoints, but it will also automatically pull up the source when it hits an exception. Although you might need adjust VS settings so it breaks on all exceptions IIRC... explains how on this page...
>
> https://docs.microsoft.com/en-us/visualstudio/debugger/managing-exceptions-with-the-debugger?view=vs-2019
>
> Its pretty much all working, except you cant see dynamic array contents and occasionally it steps a line out of sync.
>
> I never managed to get any debugger working in VSCode. But this way you get the Visual Studio debugger which as good as it gets, and its just a couple of clicks away.
>
> Oh I'm using LDC to compile so I'm not sure how well it works with DMD, haven't tried, but should work the same I imagine.

I usually just make an empty project and set up the exe file to the one that dub creates instead.
January 01, 2020
On Wednesday, 1 January 2020 at 16:21:32 UTC, solidstate1991 wrote:
> On Wednesday, 1 January 2020 at 14:46:01 UTC, NaN wrote:

>> Its pretty much all working, except you cant see dynamic array contents and occasionally it steps a line out of sync.
>>
>> I never managed to get any debugger working in VSCode. But this way you get the Visual Studio debugger which as good as it gets, and its just a couple of clicks away.
>>
>> Oh I'm using LDC to compile so I'm not sure how well it works with DMD, haven't tried, but should work the same I imagine.
>
> I usually just make an empty project and set up the exe file to the one that dub creates instead.

I guess it results in the same thing? Just an empty solution with a single exe in the explorer panel?