Discussion:
Running DMD in GUI Debugger: Getting Started?
Nick Sabalausky
2011-12-01 22:55:26 UTC
Permalink
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.
Gyula Gubacsi
2011-12-01 23:12:00 UTC
Permalink
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.
Post by Nick Sabalausky
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.
Rainer Schuetze
2011-12-02 00:24:34 UTC
Permalink
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
Post by Nick Sabalausky
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.
Nick Sabalausky
2011-12-02 06:01:49 UTC
Permalink
"Rainer Schuetze" <r.sagitario at gmx.de> wrote in message
Post by Rainer Schuetze
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
https://github.com/D-Programming-Language/dmd/pull/516
Ahh, great. I grabbed your vsbuild branch and it's working very nicely.
torhu
2011-12-08 07:59:03 UTC
Permalink
Post by Nick Sabalausky
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.
Nick Sabalausky
2011-12-09 02:20:29 UTC
Permalink
"torhu" <no at spam.invalid> wrote in message
Post by Nick Sabalausky
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?
torhu
2011-12-09 03:35:33 UTC
Permalink
"torhu"<no at 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.
torhu
2011-12-09 03:47:35 UTC
Permalink
Post by torhu
"torhu"<no at 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.

Loading...