From: Vadim Zeitlin Date: Sat, 28 Jul 2007 00:14:53 +0000 (+0000) Subject: added maxDepth parameter to WalkFromException() (patch 1759239) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ef81fe8b3f49914196ea77d9b7625ceee2776b47?ds=sidebyside added maxDepth parameter to WalkFromException() (patch 1759239) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/stackwalker.tex b/docs/latex/wx/stackwalker.tex index 562e80eb76..efce907157 100644 --- a/docs/latex/wx/stackwalker.tex +++ b/docs/latex/wx/stackwalker.tex @@ -94,9 +94,11 @@ Up to \arg{maxDepth} frames are walked from the innermost to the outermost one. \membersection{wxStackWalker::WalkFromException}\label{wxstackwalkerwalkfromexception} -\func{void}{WalkFromException}{\void} +\func{void}{WalkFromException}{\param{size\_t }{maxDepth = 200}} Enumerate stack frames from the location of uncaught exception. This method can only be called from \helpref{wxApp::OnFatalException()}{wxapponfatalexception}. +Up to \arg{maxDepth} frames are walked from the innermost to the outermost one. + diff --git a/include/wx/msw/stackwalk.h b/include/wx/msw/stackwalk.h index 2d99a132b6..a5f7e322ac 100644 --- a/include/wx/msw/stackwalk.h +++ b/include/wx/msw/stackwalk.h @@ -91,12 +91,12 @@ public: wxStackWalker(const char * WXUNUSED(argv0) = NULL) { } virtual void Walk(size_t skip = 1, size_t maxDepth = 200); - virtual void WalkFromException(); + virtual void WalkFromException(size_t maxDepth = 200); // enumerate stack frames from the given context - void WalkFrom(const _CONTEXT *ctx, size_t skip = 1); - void WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip = 1); + void WalkFrom(const _CONTEXT *ctx, size_t skip = 1, size_t maxDepth = 200); + void WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip = 1, size_t maxDepth = 200); }; #endif // _WX_MSW_STACKWALK_H_ diff --git a/include/wx/stackwalk.h b/include/wx/stackwalk.h index 144dbd8e6d..8bb2371498 100644 --- a/include/wx/stackwalk.h +++ b/include/wx/stackwalk.h @@ -135,7 +135,7 @@ public: // 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; protected: // this function must be overrided to process the given frame diff --git a/include/wx/unix/stackwalk.h b/include/wx/unix/stackwalk.h index f58e17db98..96dc1ed702 100644 --- a/include/wx/unix/stackwalk.h +++ b/include/wx/unix/stackwalk.h @@ -74,7 +74,7 @@ public: } virtual void Walk(size_t skip = 1, size_t maxDepth = 200); - virtual void WalkFromException() { Walk(2); } + virtual void WalkFromException(size_t maxDepth = 200) { Walk(2, maxDepth); } static const wxString& GetExePath() { return ms_exepath; } diff --git a/src/msw/stackwalk.cpp b/src/msw/stackwalk.cpp index d0f9e59749..669e788817 100644 --- a/src/msw/stackwalk.cpp +++ b/src/msw/stackwalk.cpp @@ -214,7 +214,7 @@ void wxStackFrame::OnGetParam() // wxStackWalker // ---------------------------------------------------------------------------- -void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip) +void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip, size_t maxDepth) { if ( !wxDbgHelpDLL::Init() ) { @@ -267,7 +267,7 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip) #endif // _M_IX86 // iterate over all stack frames - for ( size_t nLevel = 0; ; nLevel++ ) + for ( size_t nLevel = 0; nLevel < maxDepth; nLevel++ ) { // get the next stack frame if ( !wxDbgHelpDLL::StackWalk @@ -310,12 +310,12 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip) #endif } -void wxStackWalker::WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip) +void wxStackWalker::WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip, size_t maxDepth) { - WalkFrom(ep->ContextRecord, skip); + WalkFrom(ep->ContextRecord, skip, maxDepth); } -void wxStackWalker::WalkFromException() +void wxStackWalker::WalkFromException(size_t maxDepth) { extern EXCEPTION_POINTERS *wxGlobalSEInformation; @@ -323,7 +323,7 @@ void wxStackWalker::WalkFromException() _T("wxStackWalker::WalkFromException() can only be called from wxApp::OnFatalException()") ); // don't skip any frames, the first one is where we crashed - WalkFrom(wxGlobalSEInformation, 0); + WalkFrom(wxGlobalSEInformation, 0, maxDepth); } void wxStackWalker::Walk(size_t skip, size_t WXUNUSED(maxDepth)) @@ -396,7 +396,7 @@ wxStackWalker::WalkFrom(const _EXCEPTION_POINTERS * WXUNUSED(ep), { } -void wxStackWalker::WalkFromException() +void wxStackWalker::WalkFromException(size_t WXUNUSED(maxDepth)) { }