www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - WinDbg can't see D variables?

reply Jon L <Jon_member pathlink.com> writes:
I am trying to get WinDbg to work with D on WinXP - and so far, I can get WinDbg
to track the current line in the source - but I can't get WinDbg to see any
variables.  All it seems to see are functions.  Is there some way to get WinDbg
to see D variables?
Dec 05 2005
next sibling parent reply James Dunne <james.jdunne gmail.com> writes:
Jon L wrote:
 I am trying to get WinDbg to work with D on WinXP - and so far, I can get
WinDbg
 to track the current line in the source - but I can't get WinDbg to see any
 variables.  All it seems to see are functions.  Is there some way to get WinDbg
 to see D variables?
 
 
Common problem. I'm experiencing the same. WinDbg uses .PDB (program database AFAIK) files to grab symbol information. This PDB format is a proprietary Microsoft format and obviously is not documented for compiler writers (unless you sell your soul and purchase some sort of license that only big developer corporations can shell out enough cash for). Then again, I could be making up that part in the parens =P. When I ran a simple PDB under WinHex I found the file is extremely bloated, redundant, and padded. This makes it very difficult to figure out what data is real and what is extra useless garbage. Theoretically, one could grab a copy of Visual Studio 6.0 (or newer perhaps) and compile an extremely minimalistic C program and inspect the PDB's contents. I recall many Windows debugging tutorials on WinDBG saying that you can download symbol tables from Microsoft. I wonder if this HTTP-transfered format is different from the regular PDB files? Ah, time to go sniff some packets... =P
Dec 05 2005
parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
James Dunne wrote:
 Jon L wrote:
 
 I am trying to get WinDbg to work with D on WinXP - and so far, I can 
 get WinDbg
 to track the current line in the source - but I can't get WinDbg to 
 see any
 variables.  All it seems to see are functions.  Is there some way to 
 get WinDbg
 to see D variables?
Common problem. I'm experiencing the same. WinDbg uses .PDB (program database AFAIK) files to grab symbol information. This PDB format is a proprietary Microsoft format and obviously is not documented for compiler writers (unless you sell your soul and purchase some sort of license that only big developer corporations can shell out enough cash for). Then again, I could be making up that part in the parens =P. When I ran a simple PDB under WinHex I found the file is extremely bloated, redundant, and padded. This makes it very difficult to figure out what data is real and what is extra useless garbage. Theoretically, one could grab a copy of Visual Studio 6.0 (or newer perhaps) and compile an extremely minimalistic C program and inspect the PDB's contents. I recall many Windows debugging tutorials on WinDBG saying that you can download symbol tables from Microsoft. I wonder if this HTTP-transfered format is different from the regular PDB files? Ah, time to go sniff some packets... =P
Are there any other debuggers for windows which can be used? and of course see D's variables?
Dec 05 2005
next sibling parent reply Chris Lajoie <ctlajoie yahoo.com> writes:
 Are there any other debuggers for windows which can be used? and of
 course see D's variables?
there's one being developed on dsource (http://www.dsource.org/projects/dbug). you can get the svn repository too, but there aren't any official downloads available yet. Not sure how far along it is any more. I haven't checked up on it in a week or so. Until we can use that for general debugging, I'm afraid we have to do it the old fashioned way... Chris
Dec 05 2005
parent reply Sean Kelly <sean f4.ca> writes:
Chris Lajoie wrote:
 Are there any other debuggers for windows which can be used? and of
 course see D's variables?
there's one being developed on dsource (http://www.dsource.org/projects/dbug). you can get the svn repository too, but there aren't any official downloads available yet. Not sure how far along it is any more. I haven't checked up on it in a week or so. Until we can use that for general debugging, I'm afraid we have to do it the old fashioned way...
According to Walter, the version of WinDbg shipped with the DMC CD can see variables. I think what happened is that MS has moved to a new, proprietary, debug file format and they haven't bothered to continue supporting the old version with their tools. Darn shame if you ask me. Sean
Dec 05 2005
parent reply Jon L <Jon_member pathlink.com> writes:
According to Walter, the version of WinDbg shipped with the DMC CD can 
see variables.  I think what happened is that MS has moved to a new, 
proprietary, debug file format and they haven't bothered to continue 
supporting the old version with their tools.  Darn shame if you ask me.
Can someone tell me what version of WinDbg that is? I'm willing to go back to that one and drop the newer one if that older one does indeed support D variables.
Dec 06 2005
parent reply Sean Kelly <sean f4.ca> writes:
Jon L wrote:
 According to Walter, the version of WinDbg shipped with the DMC CD can 
 see variables.  I think what happened is that MS has moved to a new, 
 proprietary, debug file format and they haven't bothered to continue 
 supporting the old version with their tools.  Darn shame if you ask me.
Can someone tell me what version of WinDbg that is? I'm willing to go back to that one and drop the newer one if that older one does indeed support D variables.
It's no longer available on the Microsoft website, as I've tried the oldest one they have available. I think the file date is sometime in the mid 90's as people have reported that Visual Studio 6 seems to work as well. But I'm not going to reinstall VC6 just to debug D apps--I'd much rather get my hands on a good copy of WinDbg. Recently, I've been considering just buying a copy of the DMC CD to get it (and the library source code would be a nice perk). Sean
Dec 06 2005
parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Sean Kelly" <sean f4.ca> wrote in message 
news:dn4r8p$1tqh$1 digitaldaemon.com...
 Jon L wrote:
 According to Walter, the version of WinDbg shipped with the DMC CD can 
 see variables.  I think what happened is that MS has moved to a new, 
 proprietary, debug file format and they haven't bothered to continue 
 supporting the old version with their tools.  Darn shame if you ask me.
Can someone tell me what version of WinDbg that is? I'm willing to go back to that one and drop the newer one if that older one does indeed support D variables.
It's no longer available on the Microsoft website, as I've tried the oldest one they have available. I think the file date is sometime in the mid 90's as people have reported that Visual Studio 6 seems to work as well. But I'm not going to reinstall VC6 just to debug D apps--I'd much rather get my hands on a good copy of WinDbg. Recently, I've been considering just buying a copy of the DMC CD to get it (and the library source code would be a nice perk). Sean
The DMC CD is nifty and has lots of small command-line goodies like a disassembler and such (I think...). I don't remember the exact WinDbg version on there but it tends to crash alot and I only use it when I want to see some variables - it feels like it's written for Windows 3.1 or something. As for VC 6 - it's what I use all the time for C/C++ stuff at home. Now that I think about it I don't remember having success using it to debug dmd files but I don't remember trying very hard.
Dec 06 2005
parent reply Sean Kelly <sean f4.ca> writes:
Ben Hinkle wrote:
 
 The DMC CD is nifty and has lots of small command-line goodies like a 
 disassembler and such (I think...). I don't remember the exact WinDbg 
 version on there but it tends to crash alot and I only use it when I want to 
 see some variables - it feels like it's written for Windows 3.1 or 
 something.
I've already got the EUP and so have those nifty tools. DMC itself is quite nice, but I'd only be able to use it for hobby work, and all my hobby work is in D these days. Still, I do like all the language extensions it contains.
 As for VC 6 - it's what I use all the time for C/C++ stuff at home. Now that 
 I think about it I don't remember having success using it to debug dmd files 
 but I don't remember trying very hard. 
The process outlined on the Wiki seems quite awkward. If it were simply a matter of running the app and pointing it at the involved object/source files I'd probably give it a shot, but it seems a bit more involved than that. I suppose I should look at DBug and see if that's sufficient. My requirements are really pretty minimal--I want to be able to step through code, examine variables, and perhaps trap access violations. Oh, and it shouldn't crash :-) VC6 used to drive me crazy because it crashed constantly while debugging. I'm happy to be well rid of that IDE (though VC8 is an absolute dog on my laptop--I think they must have rewritten it in LOGO or something). Sean
Dec 06 2005
parent "Kris" <fu bar.com> writes:
I use MSVC6 all the time for debugging D. In fact, I rarely run things from 
the command-line.

Getting it to debug D is trivial: create an empty workspace/project, and 
point the debug-settings at an executable compiled with -g. I've now 
forgotton how to point it at the source files, but that was straightforward 
also. I recall it asked me once when it couldn't find them, and then never 
asked again.

Haven't had it crash on me once, in almost two years. Knock knock. Better 
luck than Sean, I guess :-)

MSVC6 can see much of the native D types, though arrays are 64bit integers. 
char* shows content just fine. Classes, naturally, do not expand. 
Regardless, it's very usable. StepInto works for nearly everything, though I 
sometimes have to drop into assembler to trace though, for example, a call 
via an interface. Option -O does confuse the display of variable contents 
terribly, so use that only for examining codegen.

Stepping into templates is a known problem, though that bug can be worked 
around by declaring an alias for the template "within the template module", 
and referencing that instead of using Foo!(x) statements at the call site. 
Would be nice if Walter could fix that annoyance.

It also catches exceptions and so forth. I really can't imagine doing 
serious development in D without it, which just goes to show how quickly one 
becomes a softy.

- Kris


"Sean Kelly" <sean f4.ca> wrote in message 
news:dn515s$2d44$1 digitaldaemon.com...
 Ben Hinkle wrote:
 The DMC CD is nifty and has lots of small command-line goodies like a 
 disassembler and such (I think...). I don't remember the exact WinDbg 
 version on there but it tends to crash alot and I only use it when I want 
 to see some variables - it feels like it's written for Windows 3.1 or 
 something.
I've already got the EUP and so have those nifty tools. DMC itself is quite nice, but I'd only be able to use it for hobby work, and all my hobby work is in D these days. Still, I do like all the language extensions it contains.
 As for VC 6 - it's what I use all the time for C/C++ stuff at home. Now 
 that I think about it I don't remember having success using it to debug 
 dmd files but I don't remember trying very hard.
The process outlined on the Wiki seems quite awkward. If it were simply a matter of running the app and pointing it at the involved object/source files I'd probably give it a shot, but it seems a bit more involved than that. I suppose I should look at DBug and see if that's sufficient. My requirements are really pretty minimal--I want to be able to step through code, examine variables, and perhaps trap access violations. Oh, and it shouldn't crash :-) VC6 used to drive me crazy because it crashed constantly while debugging. I'm happy to be well rid of that IDE (though VC8 is an absolute dog on my laptop--I think they must have rewritten it in LOGO or something). Sean
Dec 06 2005
prev sibling parent reply "Lionello Lunesu" <lio remove.lunesu.com> writes:
 Are there any other debuggers for windows which can be used? and of
 course see D's variables?
I've used the debugger from MSVC 6 for a while. It works great, including variables. Arrays show up as 64-bit ints though, so you'll have to cast a little to get the length / ptr. Check the wiki for more info (EditorSupport if I remember correctly). L.
Dec 06 2005
parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Lionello Lunesu wrote:
Are there any other debuggers for windows which can be used? and of
course see D's variables?
I've used the debugger from MSVC 6 for a while. It works great, including variables. Arrays show up as 64-bit ints though, so you'll have to cast a little to get the length / ptr. Check the wiki for more info (EditorSupport if I remember correctly). L.
But I think MSVC uses windbg (or cdb) internally. It must be like what Sean said, the older versions of windbg can see D's variables!
Dec 06 2005
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"Hasan Aljudy" <hasan.aljudy gmail.com> wrote in message
news:dn4rp1$1vnu$1 digitaldaemon.com...
 But I think MSVC uses windbg (or cdb) internally.
 It must be like what Sean said, the older versions of windbg can see D's
 variables!
Sean is right. You can get the older windbg.exe as part of the Digital Mars CD. That version is 08/08/96.
Dec 06 2005
parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Walter Bright wrote:
 "Hasan Aljudy" <hasan.aljudy gmail.com> wrote in message
 news:dn4rp1$1vnu$1 digitaldaemon.com...
 
But I think MSVC uses windbg (or cdb) internally.
It must be like what Sean said, the older versions of windbg can see D's
variables!
Sean is right. You can get the older windbg.exe as part of the Digital Mars CD. That version is 08/08/96.
hmm .. I found this on google: http://upload.mg34.vc-graz.ac.at/zid/10.0.0.2/microsoft/ntsp3us.wks/
  windbg.exe              01-May-1997 02:00   561k 
the date indicated 1997, but when I try to run it and check the "about" dialoge, it says windows xp SP2 :/
Dec 07 2005
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"Hasan Aljudy" <hasan.aljudy gmail.com> wrote in message
news:dn7j02$2c0p$1 digitaldaemon.com...
 Walter Bright wrote:
 Sean is right. You can get the older windbg.exe as part of the Digital
Mars
 CD. That version is 08/08/96.
hmm .. I found this on google: http://upload.mg34.vc-graz.ac.at/zid/10.0.0.2/microsoft/ntsp3us.wks/
  windbg.exe              01-May-1997 02:00   561k
the date indicated 1997, but when I try to run it and check the "about" dialoge, it says windows xp SP2 :/
I know, mine does the same thing. Weird.
Dec 09 2005
parent "Chris Miller" <chris dprogramming.com> writes:
On Sat, 10 Dec 2005 01:58:57 -0500, Walter Bright  
<newshound digitalmars.com> wrote:

 the date indicated 1997, but when I try to run it and check the "about"
 dialoge, it says windows xp SP2 :/
I know, mine does the same thing. Weird.
ShellAbout() always shows the running Windows version, http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shellabout.asp
Dec 10 2005
prev sibling parent Hasan Aljudy <hasan.aljudy gmail.com> writes:
Jon L wrote:
 I am trying to get WinDbg to work with D on WinXP - and so far, I can get
WinDbg
 to track the current line in the source - but I can't get WinDbg to see any
 variables.  All it seems to see are functions.  Is there some way to get WinDbg
 to see D variables?
 
 
As the others have said, we need a somewhat older version, I had success seeing variables using the windbg here: http://www.cs.nmt.edu/~cs221/jbpub/Detmer/Software/ (I downloaded it using the DownThemAll firefox extension!) BUT, it showed the hexadecimal values of the variables! I was able to make it show the decimal values by going options->debugger->Radix and choose the "decimal" radio button. (this was a result of googling: intitle:index.of "windbg.exe")
Dec 07 2005