www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.debugger - Running DMD in GUI Debugger: Getting Started?

reply "Nick Sabalausky" <a a.a> writes:
Heh, yea, I guess it's been faaaar too long since I've used C/C++ or 
debuggers (dealing with lots of oddball platforms has gotten me accustomed 
to printf debugging), because this is one hell of a newbie question...

How do I get started with running DMD in a debugger in Windows? I'm thinking 
like Visual Studio, but any GUI debugger will do (hmm, actually, even a GUI 
debugger on Linux would be fine, too).

Normally I would just load up the Visual Studio project and hit "debug". But 
DMD uses a makefile and DMC instead of a Visual Studio project and MS's C 
compiler. There's the "Attach to process", but that won't do me much good 
with a quick cmdline app like DMD if I'm not already in the debugger with a 
breakpoint set.
Dec 01 2011
next sibling parent Gyula Gubacsi <gyula.gubacsi gmail.com> writes:
In the windows DMD package there's a working win32dbg.exe you can use,
but it's not the same experience as under VS. Also, there's a better
options with the VisualD project. http://dsource.org/projects/visuald
with the mago debugger.

On 1 December 2011 22:55, Nick Sabalausky <a a.a> wrote:
 Heh, yea, I guess it's been faaaar too long since I've used C/C++ or
 debuggers (dealing with lots of oddball platforms has gotten me accustomed
 to printf debugging), because this is one hell of a newbie question...

 How do I get started with running DMD in a debugger in Windows? I'm thinking
 like Visual Studio, but any GUI debugger will do (hmm, actually, even a GUI
 debugger on Linux would be fine, too).

 Normally I would just load up the Visual Studio project and hit "debug". But
 DMD uses a makefile and DMC instead of a Visual Studio project and MS's C
 compiler. There's the "Attach to process", but that won't do me much good
 with a quick cmdline app like DMD if I'm not already in the debugger with a
 breakpoint set.
Dec 01 2011
prev sibling next sibling parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
You can use cv2pdb with option -C on the dmc-compiled dmd to generate a 
pdb file and then use the Visual Studio debugger.

I use a VS makefile project for dmd. It allows you to start dmd in the 
debugger. If you add all the sources to the project, you also get 
intellisense on the source this way.

I recently created a pull request for dmd that actually compiles with VS 
and gives you an even better debugging experience: 
https://github.com/D-Programming-Language/dmd/pull/516

On 01.12.2011 23:55, Nick Sabalausky wrote:
 Heh, yea, I guess it's been faaaar too long since I've used C/C++ or
 debuggers (dealing with lots of oddball platforms has gotten me accustomed
 to printf debugging), because this is one hell of a newbie question...

 How do I get started with running DMD in a debugger in Windows? I'm thinking
 like Visual Studio, but any GUI debugger will do (hmm, actually, even a GUI
 debugger on Linux would be fine, too).

 Normally I would just load up the Visual Studio project and hit "debug". But
 DMD uses a makefile and DMC instead of a Visual Studio project and MS's C
 compiler. There's the "Attach to process", but that won't do me much good
 with a quick cmdline app like DMD if I'm not already in the debugger with a
 breakpoint set.
Dec 01 2011
parent "Nick Sabalausky" <a a.a> writes:
"Rainer Schuetze" <r.sagitario gmx.de> wrote in message 
news:jb95tu$2rbp$1 digitalmars.com...
 You can use cv2pdb with option -C on the dmc-compiled dmd to generate a 
 pdb file and then use the Visual Studio debugger.

 I use a VS makefile project for dmd. It allows you to start dmd in the 
 debugger. If you add all the sources to the project, you also get 
 intellisense on the source this way.

 I recently created a pull request for dmd that actually compiles with VS 
 and gives you an even better debugging experience: 
 https://github.com/D-Programming-Language/dmd/pull/516
Ahh, great. I grabbed your vsbuild branch and it's working very nicely.
Dec 01 2011
prev sibling parent reply torhu <no spam.invalid> writes:
On 01.12.2011 23:55, Nick Sabalausky wrote:
 Heh, yea, I guess it's been faaaar too long since I've used C/C++ or
 debuggers (dealing with lots of oddball platforms has gotten me accustomed
 to printf debugging), because this is one hell of a newbie question...

 How do I get started with running DMD in a debugger in Windows? I'm thinking
 like Visual Studio, but any GUI debugger will do (hmm, actually, even a GUI
 debugger on Linux would be fine, too).

 Normally I would just load up the Visual Studio project and hit "debug". But
 DMD uses a makefile and DMC instead of a Visual Studio project and MS's C
 compiler. There's the "Attach to process", but that won't do me much good
 with a quick cmdline app like DMD if I'm not already in the debugger with a
 breakpoint set.
There's actually an easy way of doing this, but AFAIK it's not accessible from within the IDE itself. Just give the name of the executable as a command line parameter to msvc. Like "vcexpress dmd.exe", replace vcexpress with msdev or whatever the name of the full version IDE executable is. This opens msvc in a special mode where you can actually start debugging that executable without creating a project or anything.
Dec 07 2011
parent reply "Nick Sabalausky" <a a.a> writes:
"torhu" <no spam.invalid> wrote in message 
news:jbpqo9$gci$1 digitalmars.com...
 On 01.12.2011 23:55, Nick Sabalausky wrote:
 Heh, yea, I guess it's been faaaar too long since I've used C/C++ or
 debuggers (dealing with lots of oddball platforms has gotten me 
 accustomed
 to printf debugging), because this is one hell of a newbie question...

 How do I get started with running DMD in a debugger in Windows? I'm 
 thinking
 like Visual Studio, but any GUI debugger will do (hmm, actually, even a 
 GUI
 debugger on Linux would be fine, too).

 Normally I would just load up the Visual Studio project and hit "debug". 
 But
 DMD uses a makefile and DMC instead of a Visual Studio project and MS's C
 compiler. There's the "Attach to process", but that won't do me much good
 with a quick cmdline app like DMD if I'm not already in the debugger with 
 a
 breakpoint set.
There's actually an easy way of doing this, but AFAIK it's not accessible from within the IDE itself. Just give the name of the executable as a command line parameter to msvc. Like "vcexpress dmd.exe", replace vcexpress with msdev or whatever the name of the full version IDE executable is. This opens msvc in a special mode where you can actually start debugging that executable without creating a project or anything.
Ahh, cool! Is it still able to somehow know which source files to use?
Dec 08 2011
parent reply torhu <no spam.invalid> writes:
On 09.12.2011 03:20, Nick Sabalausky wrote:
 "torhu"<no spam.invalid>  wrote in message
  There's actually an easy way of doing this, but AFAIK it's not accessible
  from within the IDE itself.  Just give the name of the executable as a
  command line parameter to msvc.  Like "vcexpress dmd.exe", replace
  vcexpress with msdev or whatever the name of the full version IDE
  executable is.  This opens msvc in a special mode where you can actually
  start debugging that executable without creating a project or anything.
Ahh, cool! Is it still able to somehow know which source files to use?
It'll use the file names from the debug info, like it always does. I don't know if it'll open the files by itself, but you can just find the files manually and drag and drop them into the editor part of the IDE. The debugger will assume it's the right file if the name matches.
Dec 08 2011
parent torhu <no spam.invalid> writes:
On 09.12.2011 04:35, torhu wrote:
 On 09.12.2011 03:20, Nick Sabalausky wrote:
  "torhu"<no spam.invalid>   wrote in message
   There's actually an easy way of doing this, but AFAIK it's not accessible
   from within the IDE itself.  Just give the name of the executable as a
   command line parameter to msvc.  Like "vcexpress dmd.exe", replace
   vcexpress with msdev or whatever the name of the full version IDE
   executable is.  This opens msvc in a special mode where you can actually
   start debugging that executable without creating a project or anything.
Ahh, cool! Is it still able to somehow know which source files to use?
It'll use the file names from the debug info, like it always does. I don't know if it'll open the files by itself, but you can just find the files manually and drag and drop them into the editor part of the IDE. The debugger will assume it's the right file if the name matches.
I just tried this again. You can also enter this mode by dropping the executable on the msvc desktop icon. And it will actually load source files automatically if the paths in the debug info are correct. Sometimes you have to right click on the assembly view and select "Show source", though.
Dec 08 2011