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