added some ifdef to make senf compile against ulibc if its build final
derpeter [Thu, 22 Apr 2010 09:51:51 +0000 (09:51 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1600 270642c3-0616-0410-b53a-bc976706d245

senf/Scheduler/FIFORunner.cc
senf/Utils/Backtrace.cc
senf/Utils/Exception.cc

index 0e2935a..51c0032 100644 (file)
@@ -257,7 +257,7 @@ prefix_ void senf::scheduler::detail::FIFORunner::watchdogError()
     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);
@@ -267,6 +267,7 @@ prefix_ void senf::scheduler::detail::FIFORunner::watchdogError()
             write(1, &(hex[ (v     ) & 0x0f ]), 1);
         }
     }
+#endif
     write(1, "\n", 1);
         
 #ifdef SENF_DEBUG
index 9ae708d..3bd09c0 100644 (file)
@@ -27,7 +27,9 @@
 //#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"
@@ -38,6 +40,7 @@
 
 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 
@@ -71,13 +74,20 @@ prefix_ void senf::formatBacktrace(std::ostream & os, void ** backtrace, unsigne
             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////////////////////////////////////////
index caa13c4..1b3763c 100644 (file)
@@ -27,7 +27,9 @@
 //#include "Exception.ih"
 
 // Custom includes
-#include <execinfo.h>
+#ifdef SENF_DEBUG
+   #include <execinfo.h>
+#endif
 #include <sstream>
 #include <senf/config.hh>
 #include "Backtrace.hh"