diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-09-28 10:10:46 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-09-28 10:10:46 +0000 |
commit | 53347ed2f8b6a80a36b0450a13eaa44da983ac3d (patch) | |
tree | 6db349cbf408a3158281d196d216715d9df87107 | |
parent | ab16423c912a7baa73f36e9032365925914487a3 (diff) |
Make backtraces work again with both the configure and cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164817 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | include/llvm/Config/config.h.cmake | 3 | ||||
-rw-r--r-- | lib/Support/Unix/Signals.inc | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index df781f52cd..79995418af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index eb20b6470b..ac760f911a 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -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 diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc index 7d161a6a05..cf64fa8f38 100644 --- a/lib/Support/Unix/Signals.inc +++ b/lib/Support/Unix/Signals.inc @@ -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, |