Stack trace output on windows

Benjamin Thaut code at benjamin-thaut.de
Tue Oct 16 09:52:38 PDT 2012


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.

Also it helps when you compile with -gs (Always emmit stackframe) 
although that should only make a difference in release mode.

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.

Kind Regards
Benjamin Thaut


More information about the Digitalmars-d-learn mailing list