X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7beafee9423f4cfa2fb08c8c5ff579f884314c79..67badd5753e70eb50de5ae43ff454e7c1f311e50:/include/wx/stackwalk.h diff --git a/include/wx/stackwalk.h b/include/wx/stackwalk.h index 5e8beacc91..47805cd738 100644 --- a/include/wx/stackwalk.h +++ b/include/wx/stackwalk.h @@ -16,7 +16,7 @@ #if wxUSE_STACKWALKER -class WXDLLIMPEXP_BASE wxStackFrame; +class WXDLLIMPEXP_FWD_BASE wxStackFrame; // ---------------------------------------------------------------------------- // wxStackFrame: a single stack level @@ -27,7 +27,7 @@ class WXDLLIMPEXP_BASE wxStackFrameBase private: // put this inline function here so that it is defined before use wxStackFrameBase *ConstCast() const - { return wx_const_cast(wxStackFrameBase *, this); } + { return const_cast(this); } public: wxStackFrameBase(size_t level, void *address = NULL) @@ -54,6 +54,9 @@ public: // return the instruction pointer offset from the start of the function size_t GetOffset() const { ConstCast()->OnGetName(); return m_offset; } + // get the module this function belongs to (not always available) + wxString GetModule() const { ConstCast()->OnGetName(); return m_module; } + // return true if we have the filename and line number for this frame bool HasSourceLocation() const { return !GetFileName().empty(); } @@ -101,7 +104,9 @@ protected: size_t m_level; wxString m_name, + m_module, m_filename; + size_t m_line; void *m_address; @@ -118,16 +123,21 @@ public: // ctor does nothing, use Walk() to walk the stack wxStackWalkerBase() { } + // dtor does nothing neither but should be virtual + virtual ~wxStackWalkerBase() { } + // enumerate stack frames from the current location, skipping the initial // number of them (this can be useful when Walk() is called from some known // location and you don't want to see the first few frames anyhow; also // notice that Walk() frame itself is not included if skip >= 1) - virtual void Walk(size_t skip = 1) = 0; + virtual void Walk(size_t skip = 1, size_t maxDepth = 200) = 0; +#if wxUSE_ON_FATAL_EXCEPTION // enumerate stack frames from the location of uncaught exception // // this version can only be called from wxApp::OnFatalException() - virtual void WalkFromException() = 0; + virtual void WalkFromException(size_t maxDepth = 200) = 0; +#endif // wxUSE_ON_FATAL_EXCEPTION protected: // this function must be overrided to process the given frame @@ -136,6 +146,10 @@ protected: #ifdef __WXMSW__ #include "wx/msw/stackwalk.h" +#elif defined(__UNIX__) + #include "wx/unix/stackwalk.h" +#else + #error "wxStackWalker is not supported, set wxUSE_STACKWALKER to 0" #endif #endif // wxUSE_STACKWALKER