Frames to skip now honoured for Unix stackwalking

Limited depth to 10 for assert dialog


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33217 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2005-03-31 16:26:49 +00:00
parent 2f059e30a1
commit 2c9b313119
2 changed files with 16 additions and 3 deletions

View File

@@ -772,7 +772,17 @@ void ShowAssertDialog(const wxChar *szFile,
StackDump dump; StackDump dump;
dump.Walk(5); // don't show OnAssert() call itself dump.Walk(5); // don't show OnAssert() call itself
const wxString& stackTrace = dump.GetStackTrace(); wxString stackTrace = dump.GetStackTrace();
const int maxLines = 10;
// Don't show more than maxLines or we could get an enormous dialog
int count = stackTrace.Freq(wxT('\n'));
if (count > maxLines)
{
int i;
for (i = 0; i < count - maxLines; i++)
stackTrace = stackTrace.BeforeLast(wxT('\n'));
}
if ( !stackTrace.empty() ) if ( !stackTrace.empty() )
{ {
msg << _T("\n\nCall stack:\n") msg << _T("\n\nCall stack:\n")

View File

@@ -221,9 +221,12 @@ void wxStackWalker::Walk(size_t skip)
char **symbols = backtrace_symbols(addresses, depth); char **symbols = backtrace_symbols(addresses, depth);
for ( int n = 0; n < depth; n++ ) if (skip > (size_t) depth)
skip = (size_t) depth;
for ( int n = skip; n < depth; n++ )
{ {
wxStackFrame frame(n, addresses[n], symbols[n]); wxStackFrame frame(n, addresses[n-skip], symbols[n-skip]);
OnStackFrame(frame); OnStackFrame(frame);
} }
} }