X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.cc;h=4c74f6cda185694ee17aed1976af5e381748e600;hb=d2459b6c8249291588fd3d0d125ed3d38e003b55;hp=f94be754b992e56b8ee7a70c0dd2aa627f18619d;hpb=034f9bec0a66d26314fb6ebc83dedf1618a2c19d;p=senf.git diff --git a/Utils/Exception.cc b/Utils/Exception.cc index f94be75..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