From: David Ahern <dsahern@gmail.com>
To: acme@ghostprotocols.net, linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, peterz@infradead.org, fweisbec@gmail.com,
eranian@google.com, namhyung@kernel.org, jolsa@redhat.com,
David Ahern <dsahern@gmail.com>
Subject: [RFC PATCH 6/7] perf: make dwarf unwind support based on CONFIG_LIBUNWIND
Date: Sun, 19 Aug 2012 22:44:50 -0600 [thread overview]
Message-ID: <1345437891-78830-7-git-send-email-dsahern@gmail.com> (raw)
In-Reply-To: <1345437891-78830-1-git-send-email-dsahern@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
---
tools/perf/Makefile | 43 +++++++++++++++--------------------
tools/perf/arch/x86/Makefile | 2 +-
tools/perf/builtin-record.c | 15 ++++++------
tools/perf/config/feature-tests.mak | 2 +-
tools/perf/util/unwind.h | 5 ++--
5 files changed, 31 insertions(+), 36 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 012434d..b481d77 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -37,9 +37,6 @@ include config/utilities.mak
# Define NO_DEMANGLE if you do not want C++ symbol demangling.
#
# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
-#
-# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
-# backtrace post unwind.
$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -480,20 +477,25 @@ ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)
endif
endif # NO_LIBELF
-ifndef NO_LIBUNWIND
-# for linking with debug library, run like:
-# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
-ifdef LIBUNWIND_DIR
- LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include
- LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
-endif
+ifdef CONFIG_LIBUNWIND
+ # for linking with debug library, run like:
+ # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
+ ifdef LIBUNWIND_DIR
+ LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include
+ LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
+ endif
-FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
-ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND)),y)
- msg := $(warning No libunwind found. Please install libunwind >= 0.99);
- NO_LIBUNWIND := 1
-endif # Libunwind support
-endif # NO_LIBUNWIND
+ FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
+ ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND)),y)
+ $(warning No libunwind found. Please install libunwind >= 0.99)
+ $(error )
+ endif # Libunwind support
+
+ EXTLIBS += $(LIBUNWIND_LIBS)
+ BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
+ BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
+ LIB_OBJS += $(OUTPUT)util/unwind.o
+endif # CONFIG_LIBUNWIND
-include arch/$(ARCH)/Makefile
@@ -541,15 +543,6 @@ endif # PERF_HAVE_DWARF_REGS
endif # NO_DWARF
endif # NO_LIBELF
-ifdef NO_LIBUNWIND
- BASIC_CFLAGS += -DNO_LIBUNWIND_SUPPORT
-else
- EXTLIBS += $(LIBUNWIND_LIBS)
- BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
- BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
- LIB_OBJS += $(OUTPUT)util/unwind.o
-endif
-
ifdef CONFIG_NEWT
FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y)
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 815841c..3a6dc3d 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -2,7 +2,7 @@ ifndef NO_DWARF
PERF_HAVE_DWARF_REGS := 1
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
endif
-ifndef NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o
endif
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 479ff2a..3f0c5f5 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -26,6 +26,7 @@
#include "util/symbol.h"
#include "util/cpumap.h"
#include "util/thread_map.h"
+#include "generated/autoconf.h"
#include <unistd.h>
#include <sched.h>
@@ -33,11 +34,11 @@
#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
-#ifdef NO_LIBUNWIND_SUPPORT
-static char callchain_help[] = CALLCHAIN_HELP "[fp]";
-#else
+#ifdef CONFIG_LIBUNWIND
static unsigned long default_stack_dump_size = 8192;
static char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
+#else
+static char callchain_help[] = CALLCHAIN_HELP "[fp]";
#endif
enum write_mode_t {
@@ -738,7 +739,7 @@ error:
return ret;
}
-#ifndef NO_LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
static int get_stack_size(char *str, unsigned long *_size)
{
char *endptr;
@@ -764,7 +765,7 @@ static int get_stack_size(char *str, unsigned long *_size)
max_size, str);
return -1;
}
-#endif /* !NO_LIBUNWIND_SUPPORT */
+#endif /* CONFIG_LIBUNWIND */
static int
parse_callchain_opt(const struct option *opt __used, const char *arg,
@@ -803,7 +804,7 @@ parse_callchain_opt(const struct option *opt __used, const char *arg,
"needed for -g fp\n");
break;
-#ifndef NO_LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
/* Dwarf style */
} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
ret = 0;
@@ -821,7 +822,7 @@ parse_callchain_opt(const struct option *opt __used, const char *arg,
if (!ret)
pr_debug("callchain: stack dump size %d\n",
rec->opts.stack_dump_size);
-#endif /* !NO_LIBUNWIND_SUPPORT */
+#endif /* CONFIG_LIBUNWIND */
} else {
pr_err("callchain: Unknown -g option "
"value: %s\n", arg);
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index aabe4e4..dbda9b5 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -155,7 +155,7 @@ int main(void)
}
endef
-ifndef NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
define SOURCE_LIBUNWIND
#include <libunwind.h>
#include <stdlib.h>
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index 919bd6a..8dd9e03 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -4,6 +4,7 @@
#include "types.h"
#include "event.h"
#include "symbol.h"
+#include "generated/autoconf.h"
struct unwind_entry {
struct map *map;
@@ -13,7 +14,7 @@ struct unwind_entry {
typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
-#ifndef NO_LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct machine *machine,
struct thread *thread,
@@ -30,5 +31,5 @@ unwind__get_entries(unwind_entry_cb_t cb __used, void *arg __used,
{
return 0;
}
-#endif /* NO_LIBUNWIND_SUPPORT */
+#endif /* CONFIG_LIBUNWIND */
#endif /* __UNWIND_H */
--
1.7.10.1
next prev parent reply other threads:[~2012-08-20 4:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1345437891-78830-1-git-send-email-dsahern@gmail.com>
2012-08-20 4:44 ` [RFC PATCH 1/7] perf: initial infrasructure for kbuild/kconfig David Ahern
2012-08-20 4:44 ` [RFC PATCH 2/7] perf: make perl support based on CONFIG_LIBPERL David Ahern
2012-08-20 4:44 ` [RFC PATCH 3/7] perf: make python support based on CONFIG_LIBPYTHON David Ahern
2012-08-20 4:44 ` [RFC PATCH 4/7] perf: make gtk2 support based on CONFIG_GTK2 David Ahern
2012-08-20 4:44 ` [RFC PATCH 5/7] perf: make newt support based on CONFIG_NEWT David Ahern
2012-08-20 4:44 ` David Ahern [this message]
2012-08-20 4:44 ` [RFC PATCH 7/7] perf: make demangle support based on CONFIG_DEMANGLE David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1345437891-78830-7-git-send-email-dsahern@gmail.com \
--to=dsahern@gmail.com \
--cc=acme@ghostprotocols.net \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome