]> git.saurik.com Git - wxWidgets.git/blame - include/wx/unix/stackwalk.h
Committed forgotten files
[wxWidgets.git] / include / wx / unix / stackwalk.h
CommitLineData
eaff0f0d
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/unix/stackwalk.h
3// Purpose: declaration of wxStackWalker for Unix
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 2005-01-19
7// RCS-ID: $Id$
8// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_UNIX_STACKWALK_H_
13#define _WX_UNIX_STACKWALK_H_
14
15// ----------------------------------------------------------------------------
16// wxStackFrame
17// ----------------------------------------------------------------------------
18
19class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase
20{
21public:
22 // arguments are the stack depth of this frame, its address and the return
23 // value of backtrace_symbols() for it
24 //
25 // NB: we don't copy syminfo pointer so it should have lifetime at least as
26 // long as ours
27 wxStackFrame(size_t level, void *address, const char *syminfo)
28 : wxStackFrameBase(level, address)
29 {
30 m_hasName =
31 m_hasLocation = false;
32
33 m_syminfo = syminfo;
34 }
35
36protected:
37 virtual void OnGetName();
38 virtual void OnGetLocation();
39
40private:
41 const char *m_syminfo;
42
43 bool m_hasName,
44 m_hasLocation;
45};
46
47// ----------------------------------------------------------------------------
48// wxStackWalker
49// ----------------------------------------------------------------------------
50
51class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase
52{
53public:
54 // we need the full path to the program executable to be able to use
55 // addr2line, normally we can retrieve it from wxTheApp but if wxTheApp
56 // doesn't exist or doesn't have the correct value, the path may be given
57 // explicitly
14bdf093
VZ
58 wxStackWalker(const char *argv0 = NULL)
59 {
60 ms_exepath = wxString::FromAscii(argv0);
61 }
eaff0f0d
VZ
62
63 virtual void Walk(size_t skip = 1);
64 virtual void WalkFromException() { Walk(2); }
65
66 static const wxString& GetExePath() { return ms_exepath; }
67
68private:
69 static wxString ms_exepath;
70};
71
72#endif // _WX_UNIX_STACKWALK_H_