From 64005e4c2f633dfb81455f4bf60ecccb1fb048dd Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 15 Aug 2006 20:45:36 +0000 Subject: [PATCH] Prune stacktrace output in case of MT git-svn-id: https://svn.dealii.org/trunk@13709 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/exceptions.cc | 45 ++++++++++++++++++++++--------- deal.II/doc/news/changes.html | 9 +++++++ 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/deal.II/base/source/exceptions.cc b/deal.II/base/source/exceptions.cc index 404b91b50a..073281bf0c 100644 --- a/deal.II/base/source/exceptions.cc +++ b/deal.II/base/source/exceptions.cc @@ -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) diff --git a/deal.II/doc/news/changes.html b/deal.II/doc/news/changes.html index ea11b73ace..af56a8ac37 100644 --- a/deal.II/doc/news/changes.html +++ b/deal.II/doc/news/changes.html @@ -351,6 +351,15 @@ inconvenience this causes.

base

    +
  1. Improved: Stack backtraces in multithreaded mode were often + very long and almost unreadable because the functions in + namespace Threads 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. +
    + (WB 2006/08/15) +

    +
  2. New: The second argument to Utilities::int_to_string can now be omitted, leading to a string that isn't zero padded at all.
    -- 2.39.5