added maxDepth parameter to WalkFromException() (patch 1759239)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-07-28 00:14:53 +00:00
parent b2f0b9342a
commit ef81fe8b3f
5 changed files with 15 additions and 13 deletions

View File

@@ -94,9 +94,11 @@ Up to \arg{maxDepth} frames are walked from the innermost to the outermost one.
\membersection{wxStackWalker::WalkFromException}\label{wxstackwalkerwalkfromexception} \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. Enumerate stack frames from the location of uncaught exception.
This method can only be called from This method can only be called from
\helpref{wxApp::OnFatalException()}{wxapponfatalexception}. \helpref{wxApp::OnFatalException()}{wxapponfatalexception}.
Up to \arg{maxDepth} frames are walked from the innermost to the outermost one.

View File

@@ -91,12 +91,12 @@ public:
wxStackWalker(const char * WXUNUSED(argv0) = NULL) { } wxStackWalker(const char * WXUNUSED(argv0) = NULL) { }
virtual void Walk(size_t skip = 1, size_t maxDepth = 200); 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 // enumerate stack frames from the given context
void WalkFrom(const _CONTEXT *ctx, 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); void WalkFrom(const _EXCEPTION_POINTERS *ep, size_t skip = 1, size_t maxDepth = 200);
}; };
#endif // _WX_MSW_STACKWALK_H_ #endif // _WX_MSW_STACKWALK_H_

View File

@@ -135,7 +135,7 @@ public:
// enumerate stack frames from the location of uncaught exception // enumerate stack frames from the location of uncaught exception
// //
// this version can only be called from wxApp::OnFatalException() // this version can only be called from wxApp::OnFatalException()
virtual void WalkFromException() = 0; virtual void WalkFromException(size_t maxDepth = 200) = 0;
protected: protected:
// this function must be overrided to process the given frame // this function must be overrided to process the given frame

View File

@@ -74,7 +74,7 @@ public:
} }
virtual void Walk(size_t skip = 1, size_t maxDepth = 200); 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; } static const wxString& GetExePath() { return ms_exepath; }

View File

@@ -214,7 +214,7 @@ void wxStackFrame::OnGetParam()
// wxStackWalker // 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() ) if ( !wxDbgHelpDLL::Init() )
{ {
@@ -267,7 +267,7 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip)
#endif // _M_IX86 #endif // _M_IX86
// iterate over all stack frames // iterate over all stack frames
for ( size_t nLevel = 0; ; nLevel++ ) for ( size_t nLevel = 0; nLevel < maxDepth; nLevel++ )
{ {
// get the next stack frame // get the next stack frame
if ( !wxDbgHelpDLL::StackWalk if ( !wxDbgHelpDLL::StackWalk
@@ -310,12 +310,12 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip)
#endif #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; extern EXCEPTION_POINTERS *wxGlobalSEInformation;
@@ -323,7 +323,7 @@ void wxStackWalker::WalkFromException()
_T("wxStackWalker::WalkFromException() can only be called from wxApp::OnFatalException()") ); _T("wxStackWalker::WalkFromException() can only be called from wxApp::OnFatalException()") );
// don't skip any frames, the first one is where we crashed // 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)) 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))
{ {
} }