From: Benjamin Kramer Date: Fri, 28 Sep 2012 10:10:46 +0000 (+0000) Subject: Make backtraces work again with both the configure and cmake build. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5651cbdc1368226c8bc9d5f2f0acd67289d7f25c;p=platform%2Fupstream%2Fllvm.git Make backtraces work again with both the configure and cmake build. llvm-svn: 164817 --- diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index df781f5..7999541 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/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/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake index eb20b64..ac760f9 100644 --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/include/llvm/Config/config.h.cmake @@ -17,6 +17,9 @@ /* Default to all compiler invocations for --sysroot=. */ #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/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc index 7d161a6..cf64fa8 100644 --- a/llvm/lib/Support/Unix/Signals.inc +++ b/llvm/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,