Stack trace output on windows

Regan Heath regan at netmail.co.nz
Tue Oct 16 09:38:42 PDT 2012


I have some C/C++ code which handles windows SEH exceptions and can output  
(in debug mode) a stack trace, for example:

This process has performed an illegal operation and has to close.
Exception code:       0xC0000005
Exception flags:      0x00000000
Exception address:    0x00401CEF
Number of parameters: 2
Exception info [0]:   0x00000001
Exception info [1]:   0x00000000
Call stack:
Address  Frame
00401CEF 0018FF44 main+5F
00401169 0018FF88 __tmainCRTStartup+10F
755833AA 0018FF94 BaseThreadInitThunk+12
77B69EF2 0018FFD4 RtlInitializeExceptionChain+63
77B69EC5 0018FFEC RtlInitializeExceptionChain+36

D binaries (on windows), compiled in debug mode, produce something similar:

object.Error: Access Violation
----------------
0x0040BE00
0x0040BC8B
0x77B8B459 in LdrRemoveLoadAsDataTable
0x77B8B42B in LdrRemoveLoadAsDataTable
0x77B40133 in KiUserExceptionDispatcher
0x0040254E
0x00402170
0x0041369D
0x755833AA in BaseThreadInitThunk
0x77B69EF2 in RtlInitializeExceptionChain
0x77B69EC5 in RtlInitializeExceptionChain
----------------

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

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


More information about the Digitalmars-d-learn mailing list