Commit 4e34d958 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf tools: Convert to BACKTRACE_SUPPORT

For building perf without stack backtrace debug, we can set
NO_BACKTRACE=1 as a argument of make.  It then defines NO_BACKTRACE
macro for C code to do the proper handling.  However it usually used in
a negative semantics - e.g. #ifndef - so we saw double negations which
can be misleading.  Convert it to a positive form to make it more
readable and add _SUPPORT suffix for consistency.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Irina Tirdea <irina.tirdea@gmail.com>
Cc: Irina Tirdea <irina.tirdea@intel.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349109171-1942-1-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 4d8061fa
...@@ -45,6 +45,8 @@ include config/utilities.mak ...@@ -45,6 +45,8 @@ include config/utilities.mak
# #
# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf # Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
# backtrace post unwind. # backtrace post unwind.
#
# Define NO_BACKTRACE if you do not want stack backtrace debug feature
$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
...@@ -749,11 +751,9 @@ ifndef NO_STRLCPY ...@@ -749,11 +751,9 @@ ifndef NO_STRLCPY
endif endif
endif endif
ifdef NO_BACKTRACE ifndef NO_BACKTRACE
BASIC_CFLAGS += -DNO_BACKTRACE ifeq ($(call try-cc,$(SOURCE_BACKTRACE),),y)
else BASIC_CFLAGS += -DBACKTRACE_SUPPORT
ifneq ($(call try-cc,$(SOURCE_BACKTRACE),),y)
BASIC_CFLAGS += -DNO_BACKTRACE
endif endif
endif endif
......
#include "../perf.h" #include "../perf.h"
#include "util.h" #include "util.h"
#include <sys/mman.h> #include <sys/mman.h>
#ifndef NO_BACKTRACE #ifdef BACKTRACE_SUPPORT
#include <execinfo.h> #include <execinfo.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
...@@ -165,7 +165,7 @@ size_t hex_width(u64 v) ...@@ -165,7 +165,7 @@ size_t hex_width(u64 v)
} }
/* Obtain a backtrace and print it to stdout. */ /* Obtain a backtrace and print it to stdout. */
#ifndef NO_BACKTRACE #ifdef BACKTRACE_SUPPORT
void dump_stack(void) void dump_stack(void)
{ {
void *array[16]; void *array[16];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment