diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 3671f0ee0e..57e0912e2e 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -953,7 +953,7 @@ wxString wxAppTraitsBase::GetAssertStackTrace() static const int maxLines = 20; StackDump dump; - dump.Walk(2, maxLines); // don't show OnAssert() call itself + dump.Walk(8, maxLines); // 8 is chosen to hide all OnAssert() calls stackTrace = dump.GetStackTrace(); const int count = stackTrace.Freq(wxT('\n')); diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index c075851073..5ba11b4e02 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -335,7 +335,7 @@ static void get_stackframe_callback(void* p) { StackDump* dump = static_cast(p); // skip over frames up to including wxOnAssert() - dump->ProcessFrames(3); + dump->ProcessFrames(7); } #endif // wxDEBUG_LEVEL && wxUSE_STACKWALKER diff --git a/src/unix/stackwalk.cpp b/src/unix/stackwalk.cpp index 28c4fa89c3..d082dfd22f 100644 --- a/src/unix/stackwalk.cpp +++ b/src/unix/stackwalk.cpp @@ -182,17 +182,18 @@ void wxStackWalker::ProcessFrames(size_t skip) if (!ms_symbols || !m_depth) return; - // we have 3 more "intermediate" frames which the calling code doesn't know - // about, account for them + // we are another level down from Walk(), so adjust the number of stack + // frames to skip accordingly skip += 1; // call addr2line only once since this call may be very slow // (it has to load in memory the entire EXE of this app which may be quite // big, especially if it contains debug info and is compiled statically!) - int towalk = InitFrames(frames, m_depth - skip, &ms_addresses[skip], &ms_symbols[skip]); + int numFrames = InitFrames(frames, m_depth - skip, + &ms_addresses[skip], &ms_symbols[skip]); // now do user-defined operations on each frame - for ( int n = 0; n < towalk - (int)skip; n++ ) + for ( int n = 0; n < numFrames; n++ ) OnStackFrame(frames[n]); }