[llvm-branch-commits] [llvm-branch] r164506 - in /llvm/branches/R600: autoconf/configure.ac configure include/llvm/Config/config.h.in lib/Support/Unix/Signals.inc

Tom Stellard thomas.stellard at amd.com
Mon Sep 24 08:53:32 PDT 2012


Author: tstellar
Date: Mon Sep 24 10:51:49 2012
New Revision: 164506

URL: http://llvm.org/viewvc/llvm-project?rev=164506&view=rev
Log:
Add an --enable-backtraces option to configure to determine
whether or not we want to print out backtrace information. Useful
for libraries that don't need backtrace information on a crash.

rdar://11844710

Modified:
    llvm/branches/R600/autoconf/configure.ac
    llvm/branches/R600/configure
    llvm/branches/R600/include/llvm/Config/config.h.in
    llvm/branches/R600/lib/Support/Unix/Signals.inc

Modified: llvm/branches/R600/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/autoconf/configure.ac?rev=164506&r1=164505&r2=164506&view=diff
==============================================================================
--- llvm/branches/R600/autoconf/configure.ac (original)
+++ llvm/branches/R600/autoconf/configure.ac Mon Sep 24 10:51:49 2012
@@ -678,6 +678,21 @@
 AC_DEFINE_UNQUOTED([ENABLE_TIMESTAMPS],$ENABLE_TIMESTAMPS,
                    [Define if timestamp information (e.g., __DATE__) is allowed])
 
+dnl Enable embedding timestamp information into build.
+
+AC_ARG_ENABLE(backtraces,
+  AS_HELP_STRING([--enable-backtraces],
+                 [Enable embedding backtraces on crash (default is YES)]),,
+                 enableval=default)
+case "$enableval" in
+  yes) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;;
+  no)  AC_SUBST(ENABLE_TIMESTAMPS,[0]) ;;
+  default) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;;
+  *) AC_MSG_ERROR([Invalid setting for --enable-backtraces. Use "yes" or "no"]) ;;
+esac
+AC_DEFINE_UNQUOTED([ENABLE_BACKTRACES],$ENABLE_BACKTRACES,
+                   [Define if you want backtraces on crash])
+
 dnl Allow specific targets to be specified for building (or not)
 TARGETS_TO_BUILD=""
 AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],

Modified: llvm/branches/R600/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/configure?rev=164506&r1=164505&r2=164506&view=diff
==============================================================================
--- llvm/branches/R600/configure (original)
+++ llvm/branches/R600/configure Mon Sep 24 10:51:49 2012
@@ -1423,6 +1423,8 @@
                           Win32 DLL (default is NO)
   --enable-timestamps     Enable embedding timestamp information in build
                           (default is YES)
+  --enable-backtraces     Enable embedding backtraces on crash (default is
+                          YES)
   --enable-targets        Build specific host targets: all or
                           target1,target2,... Valid targets are: host, x86,
                           x86_64, sparc, powerpc, arm, mips, spu, hexagon,
@@ -5382,6 +5384,31 @@
 _ACEOF
 
 
+
+# Check whether --enable-backtraces was given.
+if test "${enable_backtraces+set}" = set; then
+  enableval=$enable_backtraces;
+else
+  enableval=default
+fi
+
+case "$enableval" in
+  yes) ENABLE_TIMESTAMPS=1
+ ;;
+  no)  ENABLE_TIMESTAMPS=0
+ ;;
+  default) ENABLE_TIMESTAMPS=1
+ ;;
+  *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-backtraces. Use \"yes\" or \"no\"" >&5
+echo "$as_me: error: Invalid setting for --enable-backtraces. Use \"yes\" or \"no\"" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+
+cat >>confdefs.h <<_ACEOF
+#define ENABLE_BACKTRACES $ENABLE_BACKTRACES
+_ACEOF
+
+
 TARGETS_TO_BUILD=""
 # Check whether --enable-targets was given.
 if test "${enable_targets+set}" = set; then
@@ -10289,7 +10316,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10292 "configure"
+#line 10319 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H

Modified: llvm/branches/R600/include/llvm/Config/config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Config/config.h.in?rev=164506&r1=164505&r2=164506&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Config/config.h.in (original)
+++ llvm/branches/R600/include/llvm/Config/config.h.in Mon Sep 24 10:51:49 2012
@@ -18,6 +18,9 @@
 /* Default <path> to all compiler invocations for --sysroot=<path>. */
 #undef DEFAULT_SYSROOT
 
+/* Define if you want backtraces on crash */
+#undef ENABLE_BACKTRACES
+
 /* Define if position independent code is enabled */
 #undef ENABLE_PIC
 

Modified: llvm/branches/R600/lib/Support/Unix/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Support/Unix/Signals.inc?rev=164506&r1=164505&r2=164506&view=diff
==============================================================================
--- llvm/branches/R600/lib/Support/Unix/Signals.inc (original)
+++ llvm/branches/R600/lib/Support/Unix/Signals.inc Mon Sep 24 10:51:49 2012
@@ -243,7 +243,7 @@
 // On glibc systems we have the 'backtrace' function, which works nicely, but
 // doesn't demangle symbols.
 static void PrintStackTrace(void *) {
-#ifdef HAVE_BACKTRACE
+#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACE)
   static void* StackTrace[256];
   // Use backtrace() to output a backtrace on Linux systems with glibc.
   int depth = backtrace(StackTrace,





More information about the llvm-branch-commits mailing list