X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.cc;h=4c74f6cda185694ee17aed1976af5e381748e600;hb=d2459b6c8249291588fd3d0d125ed3d38e003b55;hp=61d5860d8b624c3a4666c17738d9b86fcf6f9894;hpb=a66bffcc77f006b22190e1c27cbe0cd75fc4501c;p=senf.git diff --git a/Utils/Exception.cc b/Utils/Exception.cc index 61d5860..4c74f6c 100644 --- a/Utils/Exception.cc +++ b/Utils/Exception.cc @@ -27,6 +27,10 @@ //#include "Exception.ih" // Custom includes +#include +#include +#include "../config.hh" +#include "impl/demangle.h" #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// @@ -34,6 +38,41 @@ /////////////////////////////////////////////////////////////////////////// // senf::Exception +#ifdef SENF_DEBUG +prefix_ void senf::ExceptionMixin::addBacktrace() +{ + void * entries[SENF_DEBUG_BACKTRACE_NUMCALLERS]; + unsigned nEntries( ::backtrace(entries, SENF_DEBUG_BACKTRACE_NUMCALLERS) ); + char ** symbols = ::backtrace_symbols(entries, nEntries); + + std::stringstream ss; + ss << "\nException at\n"; + for (unsigned i=0; i