/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta/3rdparty/wxWidgets/include/wx/unix/stackwalk.h
ViewVC logotype

Contents of /branch/r3113_0.9.7_beta/3rdparty/wxWidgets/include/wx/unix/stackwalk.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Tue Sep 7 03:29:01 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 3008 byte(s)
branching from upstream revision (http://pcsx2.googlecode.com/svn/trunk
): r3113 to
https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/r3113_0.9.7_beta
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: stackwalk.h 43346 2006-11-12 14:33:03Z RR $
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 friend class wxStackWalker;
22
23 public:
24 // arguments are the stack depth of this frame, its address and the return
25 // value of backtrace_symbols() for it
26 //
27 // NB: we don't copy syminfo pointer so it should have lifetime at least as
28 // long as ours
29 wxStackFrame(size_t level = 0, void *address = NULL, const char *syminfo = NULL)
30 : wxStackFrameBase(level, address)
31 {
32 m_syminfo = syminfo;
33 }
34
35 protected:
36 virtual void OnGetName();
37
38 // optimized for the 2 step initialization done by wxStackWalker
39 void Set(const wxString &name, const wxString &filename, const char* syminfo,
40 size_t level, size_t numLine, void *address)
41 {
42 m_level = level;
43 m_name = name;
44 m_filename = filename;
45 m_syminfo = syminfo;
46
47 m_line = numLine;
48 m_address = address;
49 }
50
51 private:
52 const char *m_syminfo;
53 };
54
55 // ----------------------------------------------------------------------------
56 // wxStackWalker
57 // ----------------------------------------------------------------------------
58
59 class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase
60 {
61 public:
62 // we need the full path to the program executable to be able to use
63 // addr2line, normally we can retrieve it from wxTheApp but if wxTheApp
64 // doesn't exist or doesn't have the correct value, the path may be given
65 // explicitly
66 wxStackWalker(const char *argv0 = NULL)
67 {
68 ms_exepath = wxString::FromAscii(argv0);
69 }
70
71 ~wxStackWalker()
72 {
73 FreeStack();
74 }
75
76 virtual void Walk(size_t skip = 1, size_t maxDepth = 200);
77 virtual void WalkFromException() { Walk(2); }
78
79 static const wxString& GetExePath() { return ms_exepath; }
80
81
82 // these two may be used to save the stack at some point (fast operation)
83 // and then process it later (slow operation)
84 void SaveStack(size_t maxDepth);
85 void ProcessFrames(size_t skip);
86 void FreeStack();
87
88 private:
89 int InitFrames(wxStackFrame *arr, size_t n, void **addresses, char **syminfo);
90
91 static wxString ms_exepath;
92 static void *ms_addresses[];
93 static char **ms_symbols;
94 static int m_depth;
95 };
96
97 #endif // _WX_UNIX_STACKWALK_H_

  ViewVC Help
Powered by ViewVC 1.1.22