www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Debugging on Windows

reply JN <666total wp.pl> writes:
Hi,

is there any way to debug binaries on Windows? I'd at least like 
to know which line of code made it crash. If it's D code, I get a 
call trace usually, but if it's a call to a C library, I get a 
crash and that's it. I am using VSCode and I'd prefer to debug in 
it if possible, but using other IDEs is a possibility for me if 
that will help.
Feb 08 2018
next sibling parent Rene Zwanenburg <renezwanenburg gmail.com> writes:
On Thursday, 8 February 2018 at 21:09:33 UTC, JN wrote:
 Hi,

 is there any way to debug binaries on Windows? I'd at least 
 like to know which line of code made it crash. If it's D code, 
 I get a call trace usually, but if it's a call to a C library, 
 I get a crash and that's it. I am using VSCode and I'd prefer 
 to debug in it if possible, but using other IDEs is a 
 possibility for me if that will help.
You can debug D programs from VS Code using the C++ plugin: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools It requires some configuring, but from what I remember it was all very straightforward.
Feb 09 2018
prev sibling next sibling parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
On Thursday, 8 February 2018 at 21:09:33 UTC, JN wrote:
 Hi,

 is there any way to debug binaries on Windows? I'd at least 
 like to know which line of code made it crash. If it's D code, 
 I get a call trace usually, but if it's a call to a C library, 
 I get a crash and that's it. I am using VSCode and I'd prefer 
 to debug in it if possible, but using other IDEs is a 
 possibility for me if that will help.
The best option most likely is to get the Visual Studio Community Edition and then Install the VisualD extension for Visual Studio. This will give you a very good debugging experience with a bulitin D expression evaulator and the usual features the very good Visual Studio debugger comes with. Kind Regards Benjamin Thaut
Feb 09 2018
parent JN <666total wp.pl> writes:
On Friday, 9 February 2018 at 19:02:14 UTC, Benjamin Thaut wrote:
 On Thursday, 8 February 2018 at 21:09:33 UTC, JN wrote:
 Hi,

 is there any way to debug binaries on Windows? I'd at least 
 like to know which line of code made it crash. If it's D code, 
 I get a call trace usually, but if it's a call to a C library, 
 I get a crash and that's it. I am using VSCode and I'd prefer 
 to debug in it if possible, but using other IDEs is a 
 possibility for me if that will help.
The best option most likely is to get the Visual Studio Community Edition and then Install the VisualD extension for Visual Studio. This will give you a very good debugging experience with a bulitin D expression evaulator and the usual features the very good Visual Studio debugger comes with. Kind Regards Benjamin Thaut
Thanks. VisualD worked out of the box. I'll still do my coding in VSCode, because I am used to it, but I'll use VisualD for debugging when needed.
Feb 11 2018
prev sibling parent Cauterite <cauterite gmail.com> writes:
On Thursday, 8 February 2018 at 21:09:33 UTC, JN wrote:
 Hi,

 is there any way to debug binaries on Windows? I'd at least 
 like to know which line of code made it crash. If it's D code, 
 I get a call trace usually, but if it's a call to a C library, 
 I get a crash and that's it. I am using VSCode and I'd prefer 
 to debug in it if possible, but using other IDEs is a 
 possibility for me if that will help.
Other options: I use x64dbg, x32dbg and ollydbg with D. When PDB files are loaded you should get symbol names and line-by-line source file mapping. Currently they don't do much memory analysis though — like getting names of variables on the stack or fields of objects on the heap. With -m64 the linker should already be emitting PDB files that x64dbg will find automatically. With 32-bit OPTLINKed code you need to use cv2pdb on the .exe/.dll to get the PDB file, then olly/x32dbg should find it. WinDBG should work too — which is probably your only choice if you're writing a driver.
Feb 11 2018