Make backtraces work again with both the configure and cmake build.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 28 Sep 2012 10:10:46 +0000 (10:10 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 28 Sep 2012 10:10:46 +0000 (10:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164817 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt
include/llvm/Config/config.h.cmake
lib/Support/Unix/Signals.inc

index df781f52cdd289ae41b9390ae1babf04e940cb80..79995418afc3e134ba87c12682d7400fa776eb91 100644 (file)
@@ -115,6 +115,11 @@ if(LLVM_ENABLE_TIMESTAMPS)
   set(ENABLE_TIMESTAMPS 1)
 endif()
 
+option(LLVM_ENABLE_BACKTRACES "Enable embedding backtraces on crash." ON)
+if(LLVM_ENABLE_BACKTRACES)
+  set(ENABLE_BACKTRACES 1)
+endif()
+
 option(LLVM_ENABLE_FFI "Use libffi to call external functions from the interpreter" OFF)
 set(FFI_LIBRARY_DIR "" CACHE PATH "Additional directory, where CMake should search for libffi.so")
 set(FFI_INCLUDE_DIR "" CACHE PATH "Additional directory, where CMake should search for ffi.h or ffi/ffi.h")
index eb20b6470b32511019dc394bbb8fa888bcda0f9f..ac760f911a0634372247e605ea7f756e5af2e654 100644 (file)
@@ -17,6 +17,9 @@
 /* Default <path> to all compiler invocations for --sysroot=<path>. */
 #undef DEFAULT_SYSROOT
 
+/* Define if you want backtraces on crash */
+#cmakedefine ENABLE_BACKTRACES
+
 /* Define if position independent code is enabled */
 #cmakedefine ENABLE_PIC
 
index 7d161a6a056069d3f9cd5b4510d4204dadd0caf9..cf64fa8f38537bd925b1098992e7fb63f238f469 100644 (file)
@@ -243,7 +243,7 @@ void llvm::sys::AddSignalHandler(void (*FnPtr)(void *), void *Cookie) {
 // On glibc systems we have the 'backtrace' function, which works nicely, but
 // doesn't demangle symbols.
 static void PrintStackTrace(void *) {
-#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACE)
+#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)
   static void* StackTrace[256];
   // Use backtrace() to output a backtrace on Linux systems with glibc.
   int depth = backtrace(StackTrace,