]> git.saurik.com Git - wxWidgets.git/commitdiff
Frames to skip now honoured for Unix stackwalking
authorJulian Smart <julian@anthemion.co.uk>
Thu, 31 Mar 2005 16:26:49 +0000 (16:26 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 31 Mar 2005 16:26:49 +0000 (16:26 +0000)
Limited depth to 10 for assert dialog

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33217 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/appbase.cpp
src/unix/stackwalk.cpp

index ef32e59f1d8000dc3d1351a7b021412280a12de3..0f2c5edd343fa362941961bfa76a62423d8aa7dc 100644 (file)
@@ -772,7 +772,17 @@ void ShowAssertDialog(const wxChar *szFile,
 
     StackDump dump;
     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() )
     {
         msg << _T("\n\nCall stack:\n")
index 9ad52db9e6a253dd8733afa415552bad40638097..b8b92ef92470ab822cf3223d2890d54fed4eec63 100644 (file)
@@ -221,9 +221,12 @@ void wxStackWalker::Walk(size_t skip)
 
     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);
     }
 }