Thread overview
Integrated Debugger
Jul 08, 2004
David Barrett
Jul 08, 2004
Regan Heath
Jul 08, 2004
David Barrett
Jul 08, 2004
David Barrett
Jul 08, 2004
Regan Heath
Jul 08, 2004
David Barrett
Jul 08, 2004
Arcane Jill
Jul 08, 2004
David Barrett
Jul 08, 2004
Alex Besogonov
July 08, 2004
I see there are a bunch of IDEs that give syntax highlighting, intellisense, and so on.  However, I can't find any that offer integrated debugging.

Does any IDE offer integrated debugging, including:
- Breakpoints
- Watches
- Run/Break/Step In/Step Over/Step Out
- ... etc ...

In my dream world I could install some Visual Studio plug-in, and it'd allow me to develop in C++ and D, compile both into a single executable, and debug all together.

Next best would be using Visual Studio for just D programming, even if I can't seamlessly switch between C++ and D.

Next best would be some IDE that that lets me code, compile, and debug all in one.

Basically, I'm not a fan of command-line debuggers, nor am I fan of *no* debugger.

Any suggestions for a Visual Studio C++ programmer like me who wants to switch to D?

-david



July 08, 2004
On Wed, 7 Jul 2004 20:49:19 -0600, David Barrett <dbarrett@quinthar.com> wrote:
> I see there are a bunch of IDEs that give syntax highlighting,
> intellisense,
> and so on.  However, I can't find any that offer integrated debugging.
>
> Does any IDE offer integrated debugging, including:
> - Breakpoints
> - Watches
> - Run/Break/Step In/Step Over/Step Out
> - ... etc ...
>
> In my dream world I could install some Visual Studio plug-in, and it'd
> allow
> me to develop in C++ and D, compile both into a single executable, and
> debug
> all together.
>
> Next best would be using Visual Studio for just D programming, even if I can't seamlessly switch between C++ and D.
>
> Next best would be some IDE that that lets me code, compile, and debug
> all
> in one.
>
> Basically, I'm not a fan of command-line debuggers, nor am I fan of *no* debugger.
>
> Any suggestions for a Visual Studio C++ programmer like me who wants to switch to D?

You can use Visual Studio to debug D binaries. It does not know about the inbuilt D arrays but with some knowledge of how they work you can get it to look at them.

Attached are 2 files.

1. Instructions for using VC with D. (compiled from various sources: Arcane Jill, Myself, and Alan De Smet - http://www.highprogrammer.com/alan/windev/visualstudio.html)

2. Syntax highlighting data file.

Use #1 it will tell you where to put #2. Let me know what you think.

Regan.

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

July 08, 2004
Thanks for the fast response; this is a huge help.

You list one way to get at the array by manually casting the high DWORD to a (char*) pointer.  That works great, thanks for the tip.  However, that sounds painful to do while seriously debugging.  Have you found any nifty macros or tips to streamline the process?

Likewise, any tricks on how to manually dereference structs/classes?  Or even better, any ideas on how to make it understand them automatically?

Thank again, this is a *huge* help.

-david

"Regan Heath" <regan@netwin.co.nz> wrote in message news:opsasuxieh5a2sq9@digitalmars.com...
> On Wed, 7 Jul 2004 20:49:19 -0600, David Barrett <dbarrett@quinthar.com> wrote:
> > I see there are a bunch of IDEs that give syntax highlighting,
> > intellisense,
> > and so on.  However, I can't find any that offer integrated debugging.
> >
> > Does any IDE offer integrated debugging, including:
> > - Breakpoints
> > - Watches
> > - Run/Break/Step In/Step Over/Step Out
> > - ... etc ...
> >
> > In my dream world I could install some Visual Studio plug-in, and it'd
> > allow
> > me to develop in C++ and D, compile both into a single executable, and
> > debug
> > all together.
> >
> > Next best would be using Visual Studio for just D programming, even if I can't seamlessly switch between C++ and D.
> >
> > Next best would be some IDE that that lets me code, compile, and debug
> > all
> > in one.
> >
> > Basically, I'm not a fan of command-line debuggers, nor am I fan of *no* debugger.
> >
> > Any suggestions for a Visual Studio C++ programmer like me who wants to switch to D?
>
> You can use Visual Studio to debug D binaries. It does not know about the inbuilt D arrays but with some knowledge of how they work you can get it to look at them.
>
> Attached are 2 files.
>
> 1. Instructions for using VC with D. (compiled from various sources: Arcane Jill, Myself, and Alan De Smet - http://www.highprogrammer.com/alan/windev/visualstudio.html)
>
> 2. Syntax highlighting data file.
>
> Use #1 it will tell you where to put #2. Let me know what you think.
>
> Regan.
>
> --
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


July 08, 2004
Ok, I've answered the manual part of my class/struct dereferencing question. In the D spec on the "D Application Binary Interface" page (http://www.digitalmars.com/d/abi.html) it shows the layout of classes in memory:

# Classes
# An object consists of:
#	offset	contents
#	------  --------
#	0:	pointer to vtable
#	4:	monitor
#	8...	non-static members

So you can manually offset the D pointer to get to the attribute you want. Same thing for structs (without the vtable or monitor).

Unfortunately, that's still a big pain.  It'd be great to somehow convince the Visual Studio debugger to at least dereference D structs (which are laid out in memory exactly like C), or even D classes.

Any ideas how to automate the dereferencing for painless debugging?

-david

"David Barrett" <dbarrett@quinthar.com> wrote in message news:ccifjm$a6$1@digitaldaemon.com...
> Thanks for the fast response; this is a huge help.
>
> You list one way to get at the array by manually casting the high DWORD to
a
> (char*) pointer.  That works great, thanks for the tip.  However, that sounds painful to do while seriously debugging.  Have you found any nifty macros or tips to streamline the process?
>
> Likewise, any tricks on how to manually dereference structs/classes?  Or even better, any ideas on how to make it understand them automatically?
>
> Thank again, this is a *huge* help.
>
> -david
>
> "Regan Heath" <regan@netwin.co.nz> wrote in message news:opsasuxieh5a2sq9@digitalmars.com...
> > On Wed, 7 Jul 2004 20:49:19 -0600, David Barrett <dbarrett@quinthar.com> wrote:
> > > I see there are a bunch of IDEs that give syntax highlighting,
> > > intellisense,
> > > and so on.  However, I can't find any that offer integrated debugging.
> > >
> > > Does any IDE offer integrated debugging, including:
> > > - Breakpoints
> > > - Watches
> > > - Run/Break/Step In/Step Over/Step Out
> > > - ... etc ...
> > >
> > > In my dream world I could install some Visual Studio plug-in, and it'd
> > > allow
> > > me to develop in C++ and D, compile both into a single executable, and
> > > debug
> > > all together.
> > >
> > > Next best would be using Visual Studio for just D programming, even if
I
> > > can't seamlessly switch between C++ and D.
> > >
> > > Next best would be some IDE that that lets me code, compile, and debug
> > > all
> > > in one.
> > >
> > > Basically, I'm not a fan of command-line debuggers, nor am I fan of
*no*
> > > debugger.
> > >
> > > Any suggestions for a Visual Studio C++ programmer like me who wants
to
> > > switch to D?
> >
> > You can use Visual Studio to debug D binaries. It does not know about
the
> > inbuilt D arrays but with some knowledge of how they work you can get it to look at them.
> >
> > Attached are 2 files.
> >
> > 1. Instructions for using VC with D. (compiled from various sources: Arcane Jill, Myself, and Alan De Smet - http://www.highprogrammer.com/alan/windev/visualstudio.html)
> >
> > 2. Syntax highlighting data file.
> >
> > Use #1 it will tell you where to put #2. Let me know what you think.
> >
> > Regan.
> >
> > --
> > Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
>
>


July 08, 2004
On Wed, 7 Jul 2004 21:48:57 -0600, David Barrett <dbarrett@quinthar.com> wrote:
> Ok, I've answered the manual part of my class/struct dereferencing question.
> In the D spec on the "D Application Binary Interface" page
> (http://www.digitalmars.com/d/abi.html) it shows the layout of classes in
> memory:
>
> # Classes
> # An object consists of:
> #	offset	contents
> #	------  --------
> #	0:	pointer to vtable
> #	4:	monitor
> #	8...	non-static members
>
> So you can manually offset the D pointer to get to the attribute you want.
> Same thing for structs (without the vtable or monitor).
>
> Unfortunately, that's still a big pain.  It'd be great to somehow convince
> the Visual Studio debugger to at least dereference D structs (which are laid
> out in memory exactly like C), or even D classes.
>
> Any ideas how to automate the dereferencing for painless debugging?

Sorry, no, Arcane Jill might have some ideas I believe she uses this more than I do.

I gave up due to the above problems and I simply use printf now, so far I have not had to debug a large application, otherwise I'm sure I'd be at my wits end using printf all the time.

Regan.

> -david
>
> "David Barrett" <dbarrett@quinthar.com> wrote in message
> news:ccifjm$a6$1@digitaldaemon.com...
>> Thanks for the fast response; this is a huge help.
>>
>> You list one way to get at the array by manually casting the high DWORD to
> a
>> (char*) pointer.  That works great, thanks for the tip.  However, that
>> sounds painful to do while seriously debugging.  Have you found any nifty
>> macros or tips to streamline the process?
>>
>> Likewise, any tricks on how to manually dereference structs/classes?  Or
>> even better, any ideas on how to make it understand them automatically?
>>
>> Thank again, this is a *huge* help.
>>
>> -david
>>
>> "Regan Heath" <regan@netwin.co.nz> wrote in message
>> news:opsasuxieh5a2sq9@digitalmars.com...
>> > On Wed, 7 Jul 2004 20:49:19 -0600, David Barrett 
>> <dbarrett@quinthar.com>
>> > wrote:
>> > > I see there are a bunch of IDEs that give syntax highlighting,
>> > > intellisense,
>> > > and so on.  However, I can't find any that offer integrated 
>> debugging.
>> > >
>> > > Does any IDE offer integrated debugging, including:
>> > > - Breakpoints
>> > > - Watches
>> > > - Run/Break/Step In/Step Over/Step Out
>> > > - ... etc ...
>> > >
>> > > In my dream world I could install some Visual Studio plug-in, and 
>> it'd
>> > > allow
>> > > me to develop in C++ and D, compile both into a single executable, 
>> and
>> > > debug
>> > > all together.
>> > >
>> > > Next best would be using Visual Studio for just D programming, even 
>> if
> I
>> > > can't seamlessly switch between C++ and D.
>> > >
>> > > Next best would be some IDE that that lets me code, compile, and 
>> debug
>> > > all
>> > > in one.
>> > >
>> > > Basically, I'm not a fan of command-line debuggers, nor am I fan of
> *no*
>> > > debugger.
>> > >
>> > > Any suggestions for a Visual Studio C++ programmer like me who wants
> to
>> > > switch to D?
>> >
>> > You can use Visual Studio to debug D binaries. It does not know about
> the
>> > inbuilt D arrays but with some knowledge of how they work you can get 
>> it
>> > to look at them.
>> >
>> > Attached are 2 files.
>> >
>> > 1. Instructions for using VC with D. (compiled from various sources:
>> > Arcane Jill, Myself, and Alan De Smet -
>> > http://www.highprogrammer.com/alan/windev/visualstudio.html)
>> >
>> > 2. Syntax highlighting data file.
>> >
>> > Use #1 it will tell you where to put #2. Let me know what you think.
>> >
>> > Regan.
>> >
>> > --
>> > Using M2, Opera's revolutionary e-mail client: 
>> http://www.opera.com/m2/
>>
>>
>
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
July 08, 2004
"Regan Heath" <regan@netwin.co.nz> wrote in message news:opsaszk3it5a2sq9@digitalmars.com...
> On Wed, 7 Jul 2004 21:48:57 -0600, David Barrett <dbarrett@quinthar.com> wrote:
> > Any ideas how to automate the dereferencing for painless debugging?
>
> Sorry, no, Arcane Jill might have some ideas I believe she uses this more than I do.
>
> I gave up due to the above problems and I simply use printf now, so far I have not had to debug a large application, otherwise I'm sure I'd be at my wits end using printf all the time.

Heh, thanks.

I'm not sure how the debugger "learns" what's inside of a class -- if it does it somehow through debug data embedded in the EXE, or if it gleans it from Intellisense of the source code.

If it's the former, maybe there's some way to generate some sort of stub C++ structs/classes that are compiled into the app just so the debugger can figure out what to do with the D symbols.

If it's the latter, maybe those same stub files could be compiled and picked up by Intellisense, again fooling the debugger to think that the D classes compiled into the EXE are actually C++ classes that it understands.

Regardless, thanks for the great start.

-david


July 08, 2004
In article <ccifjm$a6$1@digitaldaemon.com>, David Barrett says...
>
>Likewise, any tricks on how to manually dereference structs/classes?  Or

Two methods. They're both nasty kludges, but they do the job.

Method 1. Make it explicit. Add some extra lines to your source code. That is, to see inside class c or struct s, just make some extra local variables:

#    debug int dbg_x = c.x;
#    debug char[] dbg_y = s.y;

etc. Okay, it's nasty and hacky, but if your code's going wrong somewhere inside a given function, this method WILL allow you to find out where and how.

Method 2. Study the D ABI. Understand how structs and classes are laid out in memory, and then use the VS memory window for manual inspection. Once you've found the address of the thing for which you are looking, you can write a fiercely complicated expression in the expressions pane to let you see the value (though that's not really necessary for ints of course, unless you want to see the value in decimal).

This is not guaranteed to work, in general, because the D compiler is allowed to re-order the elements of a class. But after you've done it a few times, you get to know the "habits" of the compiler and the GC allocator, and things do become relatively easy.

Jill


July 08, 2004
"Arcane Jill" <Arcane_member@pathlink.com> wrote in message news:ccit1v$l2g$1@digitaldaemon.com...
> In article <ccifjm$a6$1@digitaldaemon.com>, David Barrett says...
> >
> >Likewise, any tricks on how to manually dereference structs/classes?  Or
>
> Two methods. They're both nasty kludges, but they do the job.

Ya, that's what I was afraid of.  I'm wondering if there's some way to leverage Visual Studio's automatic debugger dereferencing.  For example, maybe have a pre-compile step that generates C header files for all D classes/structs, such that I can manually cast each D pointer to a corresponding C struct for easy debugging.

Basically, I *really* want to use D as I think it'll be a faster way to write high-quality code.  But even if C++ is a "worse" language than D, C++ has much better tools.

Do you find yourself using D because it's really cool, or because it actually improves productivity?  The lack of a truly integrated debugger still, unfortunately, puts it into the "really cool" camp for me.

-david


July 08, 2004
Good <time-of-day>!

"Arcane Jill" <Arcane_member@pathlink.com> wrote in message news:ccit1v$l2g$1@digitaldaemon.com...
> Two methods. They're both nasty kludges, but they do the job.
> Method 1. Make it explicit.
> Method 2. Study the D ABI.
There's also "Method 3" (as usual...) :)

There's a file "VISUAL_STUDIO_DIR\Common7\Packages\ Debugger\autoexp.dat" where you can write custom type expansion macroses. I use it to make VS debugger understand std::string&Co from STLPort. Maybe it can be used to help debugging D applications?

BTW, has anybody started ANTLR grammar of D?
--
With respect,
          Alex Besogonov (alexy@izh.com)