Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix the detection of backtrace: not all linuxes have it
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 27 Apr 2016 17:20:31 +0000 (19:20 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 27 Apr 2016 17:20:34 +0000 (19:20 +0200)
In particular, this is not implemented on armhf.

CMakeLists.txt
src/xbt/ex.c
src/xbt/xbt_log_layout_format.c
tools/cmake/MakeLib.cmake
tools/cmake/src/internal_config.h.in

index 4ac8d05..0afc695 100644 (file)
@@ -275,7 +275,7 @@ endif()
 #endif()
 
 # Checks for header libraries functions.
-CHECK_LIBRARY_EXISTS(execinfo backtrace              "" HAVE_BACKTRACE_IN_LIBEXECINFO)
+CHECK_LIBRARY_EXISTS(execinfo backtrace              "" HAVE_BACKTRACE)
 CHECK_LIBRARY_EXISTS(rt      clock_gettime           "" HAVE_POSIX_GETTIME)
 
 CHECK_LIBRARY_EXISTS(pthread pthread_create          "" HAVE_PTHREAD)
@@ -632,7 +632,7 @@ endif()
 # So we include only where needed, and compile with -Wundef to notice the missing includes.
 # But cmake sometimes defines to the empty definition (#define HAVE_VALGRIND_H).
 # So we have to make sure that everything got a decent value before generating the files.
-foreach(var HAVE_EXECINFO_H HAVE_FUTEX_H HAVE_GETDTABLESIZE HAVE_GETTIMEOFDAY HAVE_MMAP HAVE_NANOSLEEP HAVE_POPEN
+foreach(var HAVE_BACKTRACE HAVE_EXECINFO_H HAVE_FUTEX_H HAVE_GETDTABLESIZE HAVE_GETTIMEOFDAY HAVE_MMAP HAVE_NANOSLEEP HAVE_POPEN
             HAVE_POSIX_GETTIME HAVE_PROCESS_VM_READV HAVE_SIGNAL_H HAVE_SYS_PARAM_H HAVE_SYS_SYSCTL_H HAVE_SYSCONF 
             HAVE_UCONTEXT_H HAVE_UNISTD_H HAVE_VALGRIND_H HAVE_VASPRINTF)
   if(${var})
index 313f5f3..0ae1968 100644 (file)
 
 #include "simgrid/simix.h" /* SIMIX_process_self_get_name() */
 
-#undef HAVE_BACKTRACE
-#if HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
-# define HAVE_BACKTRACE 1       /* Hello linux box */
-#endif
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ex, xbt, "Exception mecanism");
 
 XBT_EXPORT_NO_IMPORT(const xbt_running_ctx_t) __xbt_ex_ctx_initializer = XBT_RUNNING_CTX_INITIALIZER;
@@ -115,7 +110,7 @@ void xbt_backtrace_display_current(void)
   xbt_backtrace_display(&e);
 }
 
-#if HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
+#if HAVE_BACKTRACE && HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
 # include "src/xbt/backtrace_linux.c"
 #else
 # include "src/xbt/backtrace_dummy.c"
index 64162da..7e2c468 100644 (file)
@@ -157,7 +157,7 @@ static int xbt_log_layout_format_doit(xbt_log_layout_t l, xbt_log_event_t ev, co
         break;
       case 'b':                 /* backtrace; called %throwable in LOG4J */
       case 'B':         /* short backtrace; called %throwable{short} in LOG4J */
-#if HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
+#if HAVE_BACKTRACE && HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
         {
           xbt_ex_t e;
 
index 6b825b2..496c935 100644 (file)
@@ -95,9 +95,9 @@ if(HAVE_POSIX_GETTIME)
   SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
 endif()
 
-if(HAVE_BACKTRACE_IN_LIBEXECINFO)
+if(HAVE_BACKTRACE)
   SET(SIMGRID_DEP "${SIMGRID_DEP} -lexecinfo")
-endif(HAVE_BACKTRACE_IN_LIBEXECINFO)
+endif()
 
 # Compute the dependencies of SMPI
 ##################################
index e632714..0b8d91b 100644 (file)
@@ -57,6 +57,7 @@
 #define HAVE_PRIVATIZATION @HAVE_PRIVATIZATION@ /* We have mmap and objdump to handle privatization */
 
 /* Other function checks */
+#define HAVE_BACKTRACE @HAVE_BACKTRACE@ /* Function backtrace */
 #define HAVE_MMAP      @HAVE_MMAP@ /* Function mmap */
 #define HAVE_SEM_INIT  @HAVE_SEM_INIT@ /* Function sem_init (part of XPG6 standard only) */
 #define HAVE_POPEN     @HAVE_POPEN@ /* Function popen */