]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/stackwalk.h
use AllocExclusive() instead of duplicating its code in wxFont-specific Unshare(...
[wxWidgets.git] / include / wx / msw / stackwalk.h
CommitLineData
7beafee9
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/msw/stackwalk.h
3// Purpose: wxStackWalker for MSW
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 2005-01-08
7// RCS-ID: $Id$
8// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_MSW_STACKWALK_H_
13#define _WX_MSW_STACKWALK_H_
14
5ff14574
PC
15#include "wx/arrstr.h"
16
7beafee9
VZ
17// these structs are declared in windows headers
18struct _CONTEXT;
19struct _EXCEPTION_POINTERS;
20
21// and these in dbghelp.h
22struct _SYMBOL_INFO;
23
24// ----------------------------------------------------------------------------
25// wxStackFrame
26// ----------------------------------------------------------------------------
27
28class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase
29{
30private:
31 wxStackFrame *ConstCast() const
32 { return wx_const_cast(wxStackFrame *, this); }
33
34 size_t DoGetParamCount() const { return m_paramTypes.GetCount(); }
35
36public:
37 wxStackFrame(size_t level, void *address, size_t addrFrame)
38 : wxStackFrameBase(level, address)
39 {
40 m_hasName =
41 m_hasLocation = false;
42
43 m_addrFrame = addrFrame;
44 }
45
46 virtual size_t GetParamCount() const
47 {
48 ConstCast()->OnGetParam();
49 return DoGetParamCount();
50 }
51
52 virtual bool
53 GetParam(size_t n, wxString *type, wxString *name, wxString *value) const;
54
55 // callback used by OnGetParam(), don't call directly
56 void OnParam(_SYMBOL_INFO *pSymInfo);
57
58protected:
59 virtual void OnGetName();
60 virtual void OnGetLocation();
61
62 void OnGetParam();
63
64
65 // helper for debug API: it wants to have addresses as DWORDs
66 size_t GetSymAddr() const
67 {
68 return wx_reinterpret_cast(size_t, m_address);
69 }
70
71private:
72 bool m_hasName,
73 m_hasLocation;
74
75 size_t m_addrFrame;
76
77 wxArrayString m_paramTypes,
78 m_paramNames,
79 m_paramValues;
80};
81
82// ----------------------------------------------------------------------------
83// wxStackWalker
84// ----------------------------------------------------------------------------
85
86class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase
87{
88public:
eaff0f0d
VZ
89 // we don't use ctor argument, it is for compatibility with Unix version
90 // only
91 wxStackWalker(const char * WXUNUSED(argv0) = NULL) { }
7beafee9 92
a82c2299 93 virtual void Walk(size_t skip = 1, size_t maxDepth = 200);
7beafee9
VZ
94 virtual void WalkFromException();
95
96
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);
100};
101
102#endif // _WX_MSW_STACKWALK_H_
103