From 8601291a2478aac826481c433bb32bf519c7fd77 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 30 Jun 2005 20:28:02 +0000 Subject: [PATCH] Skip all backtrace frames that belong to the exception raising mechanism itself. git-svn-id: https://svn.dealii.org/trunk@11014 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/exceptions.cc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/deal.II/base/source/exceptions.cc b/deal.II/base/source/exceptions.cc index 36a73a9978..c33ef814d0 100644 --- a/deal.II/base/source/exceptions.cc +++ b/deal.II/base/source/exceptions.cc @@ -88,8 +88,27 @@ void ExceptionBase::print_stack_trace (std::ostream &out) const const int n_frames = backtrace(array, 25); char ** symbols = backtrace_symbols(array, n_frames); - for (int i = 0; i < n_frames; i++) - out << symbols[i] << std::endl; + // print the stacktraces. first + // omit all those frames that have + // ExceptionBase or + // deal_II_exceptions in their + // names, as these correspond to + // the exception raising mechanism + // themselves, rather than the + // place where the exception was + // triggered + int frame = 0; + while ((frame < n_frames) + && + ((std::string(symbols[frame]).find ("ExceptionBase") != std::string::npos) + || + (std::string(symbols[frame]).find ("deal_II_exceptions") != std::string::npos))) + ++frame; + + // output the rest + for (; frame < n_frames; ++frame) + out << symbols[frame] + << std::endl; free(symbols); #endif -- 2.39.5