Stack trace output on windows

Regan Heath regan at netmail.co.nz
Wed Oct 17 03:51:45 PDT 2012


On Tue, 16 Oct 2012 17:52:38 +0100, Benjamin Thaut  
<code at benjamin-thaut.de> wrote:

> Am 16.10.2012 18:38, schrieb Regan Heath:> I have some C/C++ code which  
> handles windows SEH exceptions and can
>  > output (in debug mode) a stack trace, for example:
>  >
>  > But, it doesn't output symbol names for the D functions.  Does anyone
>  > know why not?  Is there some reason it cannot?  Perhaps the debug
>  > information in the binary is incomplete.. IIRC that was an issue in  
> the
>  > past and may still be.
>  >
>  > I managed to wind my way through the code and find the stacktrace.d
>  > module with the StackTrace class which appears to be producing the  
> stack
>  > trace.  Comparing it to my own, the major difference is on the  
> StackWalk
>  > call I pass FunctionTableAccessRoutine and GetModuleBaseRoutine  
> routines
>  > (3rd and 2nd to last parameters) .. I'm guessing there is some reason
>  > this wont work in D, can anyone enlighten me?
>  >
>  > R
>  >
>
> You could use cv2pdb to convert the debugging symbols into the pdb  
> format, then the stackwaler will always be able to resolve the stack.

So, the problem in my case is that dbghelp.dll doesn't understand the DMD  
CodeView (CV) debug information?

Ahh.. I think I've figured out where I've been going wrong.  It's been a  
while since I worked with any D and I was not passing the -g or -gc  
compile flags, only -debug, duh!

I figured this out when cv2pdb complained .. "no codeview debug entries  
found"

But, now I cannot compile.. (DMD32 D Compiler v2.060)

C:\>dmd -g -debug crash.d

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Error 118: Filename Expected
Path=..etc..

Adding -v shows a linker command of:
C:\Development\D\dmd2\windows\bin\link.exe  
crash,,nul,user32+kernel32/co/noi;

The input file crash.obj is present, and a quick test removing the /co  
(debug information)
C:\Development\D\dmd2\windows\bin\link.exe  
crash,,nul,user32+kernel32/co/noi;

works fine.. any ideas where this is going wrong?

> Depending on your version of the dbghelp.dll, which comes with the  
> windows sdk, or visual studio, it will also correctlry resolve cv  
> smybols. I have windows 7 64 bit service pack 1 with visual studio 2010  
> installed and the D stacktracking correctly resolves cv symbols for me.

Interesting.  I searched and found 13 different versions of dbghelp.dll  
installed on my system.  I have windows 7 64 bit SP1 with VS2010 installed  
and it's not working for me.  I suspect in my case it's using one of the  
other 12 dlls.

In my VS2010 folder(s) I found 3 dbghelp.dll's all version 6.12.2.633,  
does that match yours?

In c:\Windows\System32 SysWOW64 and the winsxs folders the version is  
6.1.7601.17514, which looks older but has a newer date on it.

I also found version 6.1.7600.16385 in the winsxs folders.

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d-learn mailing list