]> git.saurik.com Git - wxWidgets.git/blob - include/wx/unix/stackwalk.h
implemented wxBitmap::GetSubBitmap()
[wxWidgets.git] / include / wx / unix / stackwalk.h
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
19 class WXDLLIMPEXP_BASE wxStackFrame : public wxStackFrameBase
20 {
21 public:
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
36 protected:
37 virtual void OnGetName();
38 virtual void OnGetLocation();
39
40 private:
41 const char *m_syminfo;
42
43 bool m_hasName,
44 m_hasLocation;
45 };
46
47 // ----------------------------------------------------------------------------
48 // wxStackWalker
49 // ----------------------------------------------------------------------------
50
51 class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase
52 {
53 public:
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
58 wxStackWalker(const char *argv0 = NULL)
59 {
60 ms_exepath = wxString::FromAscii(argv0);
61 }
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
68 private:
69 static wxString ms_exepath;
70 };
71
72 #endif // _WX_UNIX_STACKWALK_H_