1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/stackwalk.h
3 // Purpose: wxStackWalker for MSW
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MSW_STACKWALK_H_
13 #define _WX_MSW_STACKWALK_H_
15 #include "wx/arrstr.h"
17 // these structs are declared in windows headers
19 struct _EXCEPTION_POINTERS
;
21 // and these in dbghelp.h
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
28 class WXDLLIMPEXP_BASE wxStackFrame
: public wxStackFrameBase
31 wxStackFrame
*ConstCast() const
32 { return wx_const_cast(wxStackFrame
*, this); }
34 size_t DoGetParamCount() const { return m_paramTypes
.GetCount(); }
37 wxStackFrame(size_t level
, void *address
, size_t addrFrame
)
38 : wxStackFrameBase(level
, address
)
41 m_hasLocation
= false;
43 m_addrFrame
= addrFrame
;
46 virtual size_t GetParamCount() const
48 ConstCast()->OnGetParam();
49 return DoGetParamCount();
53 GetParam(size_t n
, wxString
*type
, wxString
*name
, wxString
*value
) const;
55 // callback used by OnGetParam(), don't call directly
56 void OnParam(_SYMBOL_INFO
*pSymInfo
);
59 virtual void OnGetName();
60 virtual void OnGetLocation();
65 // helper for debug API: it wants to have addresses as DWORDs
66 size_t GetSymAddr() const
68 return wx_reinterpret_cast(size_t, m_address
);
77 wxArrayString m_paramTypes
,
82 // ----------------------------------------------------------------------------
84 // ----------------------------------------------------------------------------
86 class WXDLLIMPEXP_BASE wxStackWalker
: public wxStackWalkerBase
89 // we don't use ctor argument, it is for compatibility with Unix version
91 wxStackWalker(const char * WXUNUSED(argv0
) = NULL
) { }
93 virtual void Walk(size_t skip
= 1, size_t maxDepth
= 200);
94 virtual void WalkFromException();
97 // enumerate stack frames from the given context
98 void WalkFrom(const _CONTEXT
*ctx
, size_t skip
= 1);
99 void WalkFrom(const _EXCEPTION_POINTERS
*ep
, size_t skip
= 1);
102 #endif // _WX_MSW_STACKWALK_H_