write(1, "): ", 3);
write(1, runningName_.c_str(), runningName_.size());
write(1, " at\n ", 3);
-
+#ifdef SENF_DEBUG
unsigned nEntries( ::backtrace(entries, SENF_DEBUG_BACKTRACE_NUMCALLERS) );
for (unsigned i (0); i < nEntries; ++i) {
write(1, " 0x", 3);
write(1, &(hex[ (v ) & 0x0f ]), 1);
}
}
+#endif
write(1, "\n", 1);
#ifdef SENF_DEBUG
//#include "Backtrace.ih"
// Custom includes
-#include <execinfo.h>
+#ifdef SENF_DEBUG
+ #include <execinfo.h>
+#endif
#include <cxxabi.h>
#include <boost/regex.hpp>
#include "Buffer.hh"
prefix_ void senf::formatBacktrace(std::ostream & os, void ** backtrace, unsigned numEntries)
{
+#ifdef SENF_DEBUG
char ** symbols (::backtrace_symbols(backtrace, numEntries));
static boost::regex const backtraceRx
os << " " << sym << "\n";
}
free(symbols);
+#endif
+#ifndef SENF_DEBUG
+ os << "no backtrace available please compile SENF without final=1\n";
+#endif
+
}
prefix_ void senf::backtrace(std::ostream & os, unsigned numEntries)
{
- SENF_SCOPED_BUFFER( void*, entries, numEntries);
- unsigned n ( ::backtrace(entries, numEntries) );
- senf::formatBacktrace(os, entries, n);
+#ifdef SENF_DEBUG
+ SENF_SCOPED_BUFFER( void*, entries, numEntries);
+ unsigned n ( ::backtrace(entries, numEntries) );
+ senf::formatBacktrace(os, entries, n);
+#endif
}
///////////////////////////////cc.e////////////////////////////////////////