How to debug in vscode Windows?

NaN divide at
Wed Jan 1 14:46:01 UTC 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: 
> 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...

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.

More information about the Digitalmars-d-learn mailing list