added wxStackWalker class
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
99
include/wx/msw/stackwalk.h
Normal file
99
include/wx/msw/stackwalk.h
Normal file
@@ -0,0 +1,99 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/stackwalk.h
|
||||
// Purpose: wxStackWalker for MSW
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 2005-01-08
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MSW_STACKWALK_H_
|
||||
#define _WX_MSW_STACKWALK_H_
|
||||
|
||||
// these structs are declared in windows headers
|
||||
struct _CONTEXT;
|
||||
struct _EXCEPTION_POINTERS;
|
||||
|
||||
// and these in dbghelp.h
|
||||
struct _SYMBOL_INFO;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStackFrame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase
|
||||
{
|
||||
private:
|
||||
wxStackFrame *ConstCast() const
|
||||
{ return wx_const_cast(wxStackFrame *, this); }
|
||||
|
||||
size_t DoGetParamCount() const { return m_paramTypes.GetCount(); }
|
||||
|
||||
public:
|
||||
wxStackFrame(size_t level, void *address, size_t addrFrame)
|
||||
: wxStackFrameBase(level, address)
|
||||
{
|
||||
m_hasName =
|
||||
m_hasLocation = false;
|
||||
|
||||
m_addrFrame = addrFrame;
|
||||
}
|
||||
|
||||
virtual size_t GetParamCount() const
|
||||
{
|
||||
ConstCast()->OnGetParam();
|
||||
return DoGetParamCount();
|
||||
}
|
||||
|
||||
virtual bool
|
||||
GetParam(size_t n, wxString *type, wxString *name, wxString *value) const;
|
||||
|
||||
// callback used by OnGetParam(), don't call directly
|
||||
void OnParam(_SYMBOL_INFO *pSymInfo);
|
||||
|
||||
protected:
|
||||
virtual void OnGetName();
|
||||
virtual void OnGetLocation();
|
||||
|
||||
void OnGetParam();
|
||||
|
||||
|
||||
// helper for debug API: it wants to have addresses as DWORDs
|
||||
size_t GetSymAddr() const
|
||||
{
|
||||
return wx_reinterpret_cast(size_t, m_address);
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_hasName,
|
||||
m_hasLocation;
|
||||
|
||||
size_t m_addrFrame;
|
||||
|
||||
wxArrayString m_paramTypes,
|
||||
m_paramNames,
|
||||
m_paramValues;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStackWalker
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase
|
||||
{
|
||||
public:
|
||||
wxStackWalker() { }
|
||||
|
||||
virtual void Walk(size_t skip = 1);
|
||||
virtual void WalkFromException();
|
||||
|
||||
|
||||
// enumerate stack frames from the given context
|
||||
void WalkFrom(const _CONTEXT *ctx, size_t skip = 1);
|
||||
void WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip = 1);
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_STACKWALK_H_
|
||||
|
Reference in New Issue
Block a user