Thread overview
Running DMD in GUI Debugger: Getting Started?
Dec 01, 2011
Nick Sabalausky
Dec 01, 2011
Gyula Gubacsi
Dec 02, 2011
Rainer Schuetze
Dec 02, 2011
Nick Sabalausky
Dec 08, 2011
torhu
Dec 09, 2011
Nick Sabalausky
Dec 09, 2011
torhu
Dec 09, 2011
torhu
December 01, 2011
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.


December 01, 2011
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.
>
>
December 02, 2011
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.
>
>
December 02, 2011
"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.


December 08, 2011
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.
December 09, 2011
"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?


December 09, 2011
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.
December 09, 2011
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.