+
+// ----------------------------------------------------------------------------
+// wxStackWalker
+// ----------------------------------------------------------------------------
+
+// that many frames should be enough for everyone
+#define MAX_FRAMES 200
+
+// we need a char buffer big enough to contain a call to addr2line with
+// up to MAX_FRAMES addresses !
+// NB: %p specifier will print the pointer in hexadecimal form
+// and thus will require 2 chars for each byte + 3 for the
+// " 0x" prefix
+#define CHARS_PER_FRAME (sizeof(void*) * 2 + 3)
+
+// BUFSIZE will be 2250 for 32 bit machines
+#define BUFSIZE (50 + MAX_FRAMES*CHARS_PER_FRAME)
+
+// static data
+void *wxStackWalker::ms_addresses[MAX_FRAMES];
+char **wxStackWalker::ms_symbols = NULL;
+int wxStackWalker::m_depth = 0;
+wxString wxStackWalker::ms_exepath;
+static char g_buf[BUFSIZE];
+
+
+void wxStackWalker::SaveStack(size_t maxDepth)
+{
+ // read all frames required
+ maxDepth = wxMin(WXSIZEOF(ms_addresses)/sizeof(void*), maxDepth);
+ m_depth = backtrace(ms_addresses, maxDepth*sizeof(void*));
+ if ( !m_depth )
+ return;
+
+ ms_symbols = backtrace_symbols(ms_addresses, m_depth);
+}
+
+void wxStackWalker::ProcessFrames(size_t skip)