[PATCH 14/23] perf: make backtrace support based on CONFIG_BACKTRACE

From: David Ahern
Date: Mon Apr 01 2013 - 23:58:16 EST


Signed-off-by: David Ahern <dsahern@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
---
tools/perf/Makefile | 10 ++++------
tools/perf/Pconfig | 3 +++
tools/perf/config/feature-tests.mak | 2 +-
tools/perf/util/util.c | 5 +++--
4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3ada6e7..0baa19b 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -31,8 +31,6 @@ include config/utilities.mak
# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
#
# Define WERROR=0 to disable treating any warnings as errors.
-#
-# Define NO_BACKTRACE if you do not want stack backtrace debug feature

$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -829,10 +827,10 @@ ifndef NO_ON_EXIT
endif
endif

-ifndef NO_BACKTRACE
- ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
- BASIC_CFLAGS += -DBACKTRACE_SUPPORT
- endif
+ifdef CONFIG_BACKTRACE
+ ifneq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
+ $(error backtrace not supported. Unset CONFIG_BACKTRACE)
+ endif
endif

ifdef CONFIG_LIBNUMA
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index c4e20cc..b03881c 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -49,3 +49,6 @@ config LIBNUMA
bool "Enable support for libnuma"
help
Used for 'perf bench numa mem' benchmark
+
+config BACKTRACE
+ bool "Enable support for stack backtrace debugging"
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index 7873e6d..1d16481 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -192,7 +192,7 @@ int main(void)
endef
endif

-ifndef NO_BACKTRACE
+ifdef CONFIG_BACKTRACE
define SOURCE_BACKTRACE
#include <execinfo.h>
#include <stdio.h>
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 805d1f5..fa2916d 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -1,7 +1,8 @@
#include "../perf.h"
#include "util.h"
#include <sys/mman.h>
-#ifdef BACKTRACE_SUPPORT
+#include <linux/kconfig.h>
+#ifdef CONFIG_BACKTRACE
#include <execinfo.h>
#endif
#include <stdio.h>
@@ -202,7 +203,7 @@ int hex2u64(const char *ptr, u64 *long_val)
}

/* Obtain a backtrace and print it to stdout. */
-#ifdef BACKTRACE_SUPPORT
+#ifdef CONFIG_BACKTRACE
void dump_stack(void)
{
void *array[16];
--
1.7.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/