]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Prune stacktrace output in case of MT
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 15 Aug 2006 20:45:36 +0000 (20:45 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 15 Aug 2006 20:45:36 +0000 (20:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@13709 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/exceptions.cc
deal.II/doc/news/changes.html

index 404b91b50a38cd49cd29022eeaf440658d7ac6fc..073281bf0c4e250a2267d27709f995d534aa5af7 100644 (file)
@@ -186,16 +186,37 @@ void ExceptionBase::print_stack_trace (std::ostream &out) const
                                        // if we can, demangle the
                                        // function name
 #ifdef HAVE_LIBSTDCXX_DEMANGLER
-       int     status;
-       char   *realname;
-
-       realname = abi::__cxa_demangle(functionname.c_str(), 0, 0, &status);
+       int         status;
+       char *p = abi::__cxa_demangle(functionname.c_str(), 0, 0, &status);
+       
        if ((status == 0) && (functionname != "main"))
-        stacktrace_entry = stacktrace_entry.substr(0, pos_start)
-                           +
-                           ": "
-                           +
-                           realname;
+        {
+          std::string realname(p);
+                                           // in MT mode, one often
+                                           // gets backtraces
+                                           // spanning several lines
+                                           // because we have so many
+                                           // boost::tuple arguments
+                                           // in the MT calling
+                                           // functions. most of the
+                                           // trailing arguments of
+                                           // these tuples are
+                                           // actually unused
+                                           // boost::tuples::null_type,
+                                           // so we should split them
+                                           // off if they are
+                                           // trailing a template
+                                           // argument list
+          while (realname.find (", boost::tuples::null_type>") != std::string::npos)
+            realname.erase (realname.find (", boost::tuples::null_type>"),
+                            std::string (", boost::tuples::null_type").size());
+          
+          stacktrace_entry = stacktrace_entry.substr(0, pos_start)
+                             +
+                             ": "
+                             +
+                             realname;
+        }
        else
         stacktrace_entry = stacktrace_entry.substr(0, pos_start)
                            +
@@ -203,10 +224,8 @@ void ExceptionBase::print_stack_trace (std::ostream &out) const
                            +
                            functionname;
 
-                                       // free memory allocated by
-                                       // the demangler
-       free (realname);
-
+       free (p);
+       
 #else   
 
        stacktrace_entry = stacktrace_entry.substr(0, pos_start)
index ea11b73ace7d875b6000c449aeba1aef12267c2d..af56a8ac37eb8808b46721f46c44ca466163f4c4 100644 (file)
@@ -351,6 +351,15 @@ inconvenience this causes.
 <h3>base</h3>
 
 <ol>
+  <li> <p> Improved: Stack backtraces in multithreaded mode were often
+       very long and almost unreadable because the functions in
+       namespace <code>Threads</code> that are used to set up new
+       threads have long and awkward signatures. The output is now
+       filtered to make these backtraces easier to read.
+       <br>
+       (WB 2006/08/15)
+       </p>
+
   <li> <p> New: The second argument to <code>Utilities::int_to_string</code>
        can now be omitted, leading to a string that isn't zero padded at all.
        <br>

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.