1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/stackwalk.h
3 // Purpose: wxStackWalker for MSW
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_STACKWALK_H_
12 #define _WX_MSW_STACKWALK_H_
14 #include "wx/arrstr.h"
16 // these structs are declared in windows headers
18 struct _EXCEPTION_POINTERS
;
20 // and these in dbghelp.h
23 // ----------------------------------------------------------------------------
25 // ----------------------------------------------------------------------------
27 class WXDLLIMPEXP_BASE wxStackFrame
: public wxStackFrameBase
30 wxStackFrame
*ConstCast() const
31 { return const_cast<wxStackFrame
*>(this); }
33 size_t DoGetParamCount() const { return m_paramTypes
.GetCount(); }
36 wxStackFrame(size_t level
, void *address
, size_t addrFrame
)
37 : wxStackFrameBase(level
, address
)
40 m_hasLocation
= false;
42 m_addrFrame
= addrFrame
;
45 virtual size_t GetParamCount() const
47 ConstCast()->OnGetParam();
48 return DoGetParamCount();
52 GetParam(size_t n
, wxString
*type
, wxString
*name
, wxString
*value
) const;
54 // callback used by OnGetParam(), don't call directly
55 void OnParam(_SYMBOL_INFO
*pSymInfo
);
58 virtual void OnGetName();
59 virtual void OnGetLocation();
64 // helper for debug API: it wants to have addresses as DWORDs
65 size_t GetSymAddr() const
67 return reinterpret_cast<size_t>(m_address
);
76 wxArrayString m_paramTypes
,
81 // ----------------------------------------------------------------------------
83 // ----------------------------------------------------------------------------
85 class WXDLLIMPEXP_BASE wxStackWalker
: public wxStackWalkerBase
88 // we don't use ctor argument, it is for compatibility with Unix version
90 wxStackWalker(const char * WXUNUSED(argv0
) = NULL
) { }
92 virtual void Walk(size_t skip
= 1, size_t maxDepth
= wxSTACKWALKER_MAX_DEPTH
);
93 #if wxUSE_ON_FATAL_EXCEPTION
94 virtual void WalkFromException(size_t maxDepth
= wxSTACKWALKER_MAX_DEPTH
);
95 #endif // wxUSE_ON_FATAL_EXCEPTION
98 // enumerate stack frames from the given context
99 void WalkFrom(const _CONTEXT
*ctx
, size_t skip
= 1, size_t maxDepth
= wxSTACKWALKER_MAX_DEPTH
);
100 void WalkFrom(const _EXCEPTION_POINTERS
*ep
, size_t skip
= 1, size_t maxDepth
= wxSTACKWALKER_MAX_DEPTH
);
103 #endif // _WX_MSW_STACKWALK_H_