// $Id$
//
-// Copyright (C) 2008
+// Copyright (C) 2008
// Fraunhofer Institute for Open Communication Systems (FOKUS)
// Competence Center NETwork research (NET), St. Augustin, GERMANY
// Stefan Bund <g0dil@berlios.de>
//#include "Backtrace.ih"
// Custom includes
-#ifdef SENF_DEBUG
- #include <execinfo.h>
+#include <senf/config.hh>
+#ifdef SENF_BACKTRACE
+ #include <execinfo.h>
#endif
#include <cxxabi.h>
#include <boost/regex.hpp>
//#include "Backtrace.mpp"
#define prefix_
-///////////////////////////////cc.p////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
prefix_ void senf::formatBacktrace(std::ostream & os, void ** backtrace, unsigned numEntries)
{
-#ifdef SENF_DEBUG
+#ifdef SENF_BACKTRACE
char ** symbols (::backtrace_symbols(backtrace, numEntries));
- static boost::regex const backtraceRx
+ static boost::regex const backtraceRx
("(.*)\\((.*)\\+(0x[0-9a-f]+)\\) \\[(0x[0-9a-f]+)\\]");
enum { File = 1,
Symbol = 2,
symbol = std::string(demangled);
free(demangled);
}
- os << " " << symbol << " + " << match[Offset]
+ os << " " << symbol << " + " << match[Offset]
<< "\n in " << match[File] << " [" << match[Address] << "]\n";
}
else if (sym == "[0xffffe410]")
prefix_ void senf::backtrace(std::ostream & os, unsigned numEntries)
{
-#ifdef SENF_DEBUG
+#ifdef SENF_BACKTRACE
SENF_SCOPED_BUFFER( void*, entries, numEntries);
unsigned n ( ::backtrace(entries, numEntries) );
senf::formatBacktrace(os, entries, n);
#endif
}
-///////////////////////////////cc.e////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
#undef prefix_
//#include "Backtrace.mpp"