Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
backtrace: fix various portability issues I just introduced
[simgrid.git] / src / xbt / backtrace.cpp
index 575d2a5..7e1ce1d 100644 (file)
@@ -19,7 +19,7 @@
 #ifdef __GXX_ABI_VERSION
 #include <cxxabi.h>
 #endif
-#ifdef HAVE_EXECINFO_H
+#if HAVE_EXECINFO_H
 #include <execinfo.h>
 #endif
 
@@ -38,10 +38,9 @@ static bool startWith(std::string str, const char* prefix)
 
 void xbt_backtrace_display(xbt_backtrace_location_t* loc, std::size_t count)
 {
-#ifdef HAVE_BACKTRACE
   std::vector<std::string> backtrace = simgrid::xbt::resolve_backtrace(loc, count);
   if (backtrace.empty()) {
-    fprintf(stderr, "(backtrace not set)\n");
+    fprintf(stderr, "(backtrace not set -- maybe unavailable on this architecture?)\n");
     return;
   }
   fprintf(stderr, "Backtrace (displayed in process %s):\n", SIMIX_process_self_get_name());
@@ -54,9 +53,6 @@ void xbt_backtrace_display(xbt_backtrace_location_t* loc, std::size_t count)
         startWith(s, "simgrid::xbt::MainFunction") /* main used with thread factory */)
       break;
   }
-#else
-  XBT_ERROR("Cannot display backtrace when compiled without libunwind.");
-#endif
 }
 
 /** @brief show the backtrace of the current point (lovely while debugging) */