digitalmars.D - Integrated Debugger
- David Barrett (19/19) Jul 07 2004 I see there are a bunch of IDEs that give syntax highlighting, intellise...
- Regan Heath (14/36) Jul 07 2004 You can use Visual Studio to debug D binaries. It does not know about th...
- David Barrett (11/53) Jul 07 2004 Thanks for the fast response; this is a huge help.
- David Barrett (25/85) Jul 07 2004 Ok, I've answered the manual part of my class/struct dereferencing quest...
- Regan Heath (10/116) Jul 07 2004 Sorry, no, Arcane Jill might have some ideas I believe she uses this mor...
- David Barrett (14/22) Jul 07 2004 Heh, thanks.
- Arcane Jill (19/20) Jul 08 2004 Two methods. They're both nasty kludges, but they do the job.
- David Barrett (14/18) Jul 08 2004 Ya, that's what I was afraid of. I'm wondering if there's some way to
-
Alex Besogonov
(13/16)
Jul 08 2004
Good
! - David Barrett (29/48) Jul 07 2004 Aha, I found the following advice in a 5/1 post:
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
Jul 07 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. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jul 07 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. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jul 07 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: 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 toa(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...IOn 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*no*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 oftodebugger. Any suggestions for a Visual Studio C++ programmer like me who wantstheswitch to D?You can use Visual Studio to debug D binaries. It does not know aboutinbuilt 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. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jul 07 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: 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...-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/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 toa(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...IOn Wed, 7 Jul 2004 20:49:19 -0600, David Barrett<dbarrett quinthar.com>wrote:debugging.I see there are a bunch of IDEs that give syntax highlighting, intellisense, and so on. However, I can't find any that offer integratedit'dDoes 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, andandallow me to develop in C++ and D, compile both into a single executable,ifdebug all together. Next best would be using Visual Studio for just D programming, even*no*debugcan't seamlessly switch between C++ and D. Next best would be some IDE that that lets me code, compile, andall in one. Basically, I'm not a fan of command-line debuggers, nor am I fan oftodebugger. Any suggestions for a Visual Studio C++ programmer like me who wantstheswitch to D?You can use Visual Studio to debug D binaries. It does not know aboutinbuilt D arrays but with some knowledge of how they work you can getitto 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. Regan. -- Using M2, Opera's revolutionary e-mail client:http://www.opera.com/m2/
Jul 07 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: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. -davidAny 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.
Jul 07 2004
In article <ccifjm$a6$1 digitaldaemon.com>, David Barrett says...Likewise, any tricks on how to manually dereference structs/classes? OrTwo 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: 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
Jul 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...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. -davidLikewise, any tricks on how to manually dereference structs/classes? OrTwo methods. They're both nasty kludges, but they do the job.
Jul 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)
Jul 08 2004
Aha, I found the following advice in a 5/1 post: Then to it. This is pretty cool -- I can compile with the -g option (to add debug info), run the D EXE from within Visual Studio 6.0, hit Break on the VS toolbar, and it'll bring up the original D source. I can set breakpoints within the editor and it'll break when it gets there. I can even hover over variable names (or add to the Watch window), and it'll show me the the current value. Awesome. Unforutnately (but understandably), it only understands C/C++ atomic types. Thus I can see int and float values, but I can't dereference class/structure pointers to get at their attributes. So, this is a pretty great first step -- I'm really happy I can get this far. But it's pretty sucky to be stuck with only debugging C atomic types. I guess I could cast everything into a C type (such as casting "char[] blah" into "char* debug_blah" in order to see "blah" in the debugger), but that's a bit of a pain. Any suggestions on how to get around this? -david "David Barrett" <dbarrett quinthar.com> wrote in message news:...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'dallowme to develop in C++ and D, compile both into a single executable, anddebugall 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
Jul 07 2004