perf callchain: Introduce HAVE_DWARF_UNWIND_SUPPORT macro
Introducing global macro HAVE_DWARF_UNWIND_SUPPORT to indicate we have dwarf unwind support. Any library providing the dwarf post unwind support will enable this macro. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Jean Pihet <jean.pihet@linaro.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jean Pihet <jean.pihet@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1389098853-14466-12-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
ea3da69df9
commit
9ff125d132
5 changed files with 13 additions and 10 deletions
|
@ -649,7 +649,7 @@ parse_branch_stack(const struct option *opt, const char *str, int unset)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBUNWIND_SUPPORT
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
||||||
static int get_stack_size(char *str, unsigned long *_size)
|
static int get_stack_size(char *str, unsigned long *_size)
|
||||||
{
|
{
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
@ -675,7 +675,7 @@ static int get_stack_size(char *str, unsigned long *_size)
|
||||||
max_size, str);
|
max_size, str);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LIBUNWIND_SUPPORT */
|
#endif /* HAVE_DWARF_UNWIND_SUPPORT */
|
||||||
|
|
||||||
int record_parse_callchain(const char *arg, struct record_opts *opts)
|
int record_parse_callchain(const char *arg, struct record_opts *opts)
|
||||||
{
|
{
|
||||||
|
@ -704,7 +704,7 @@ int record_parse_callchain(const char *arg, struct record_opts *opts)
|
||||||
"needed for -g fp\n");
|
"needed for -g fp\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_LIBUNWIND_SUPPORT
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
||||||
/* Dwarf style */
|
/* Dwarf style */
|
||||||
} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
|
} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
|
||||||
const unsigned long default_stack_dump_size = 8192;
|
const unsigned long default_stack_dump_size = 8192;
|
||||||
|
@ -720,7 +720,7 @@ int record_parse_callchain(const char *arg, struct record_opts *opts)
|
||||||
ret = get_stack_size(tok, &size);
|
ret = get_stack_size(tok, &size);
|
||||||
opts->stack_dump_size = size;
|
opts->stack_dump_size = size;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LIBUNWIND_SUPPORT */
|
#endif /* HAVE_DWARF_UNWIND_SUPPORT */
|
||||||
} else {
|
} else {
|
||||||
pr_err("callchain: Unknown --call-graph option "
|
pr_err("callchain: Unknown --call-graph option "
|
||||||
"value: %s\n", arg);
|
"value: %s\n", arg);
|
||||||
|
@ -823,7 +823,7 @@ static struct record record = {
|
||||||
|
|
||||||
#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: "
|
#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: "
|
||||||
|
|
||||||
#ifdef HAVE_LIBUNWIND_SUPPORT
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
||||||
const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf";
|
const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf";
|
||||||
#else
|
#else
|
||||||
const char record_callchain_help[] = CALLCHAIN_HELP "fp";
|
const char record_callchain_help[] = CALLCHAIN_HELP "fp";
|
||||||
|
|
|
@ -338,7 +338,7 @@ ifndef NO_LIBUNWIND
|
||||||
CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
|
CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
|
CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT -DHAVE_LIBUNWIND_SUPPORT
|
||||||
EXTLIBS += $(LIBUNWIND_LIBS)
|
EXTLIBS += $(LIBUNWIND_LIBS)
|
||||||
CFLAGS += $(LIBUNWIND_CFLAGS)
|
CFLAGS += $(LIBUNWIND_CFLAGS)
|
||||||
LDFLAGS += $(LIBUNWIND_LDFLAGS)
|
LDFLAGS += $(LIBUNWIND_LDFLAGS)
|
||||||
|
|
|
@ -116,7 +116,7 @@ static struct test {
|
||||||
.func = test__parse_no_sample_id_all,
|
.func = test__parse_no_sample_id_all,
|
||||||
},
|
},
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
#ifdef HAVE_LIBUNWIND_SUPPORT
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
||||||
{
|
{
|
||||||
.desc = "Test dwarf unwind",
|
.desc = "Test dwarf unwind",
|
||||||
.func = test__dwarf_unwind,
|
.func = test__dwarf_unwind,
|
||||||
|
|
|
@ -43,7 +43,7 @@ int test__parse_no_sample_id_all(void);
|
||||||
int test__dwarf_unwind(void);
|
int test__dwarf_unwind(void);
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__i386__)
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
#ifdef HAVE_LIBUNWIND_SUPPORT
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
||||||
struct thread;
|
struct thread;
|
||||||
struct perf_sample;
|
struct perf_sample;
|
||||||
int test__arch_unwind_sample(struct perf_sample *sample,
|
int test__arch_unwind_sample(struct perf_sample *sample,
|
||||||
|
|
|
@ -13,12 +13,15 @@ struct unwind_entry {
|
||||||
|
|
||||||
typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
|
typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
|
||||||
|
|
||||||
#ifdef HAVE_LIBUNWIND_SUPPORT
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
||||||
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
|
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
|
||||||
struct machine *machine,
|
struct machine *machine,
|
||||||
struct thread *thread,
|
struct thread *thread,
|
||||||
struct perf_sample *data, int max_stack);
|
struct perf_sample *data, int max_stack);
|
||||||
|
/* libunwind specific */
|
||||||
|
#ifdef HAVE_LIBUNWIND_SUPPORT
|
||||||
int libunwind__arch_reg_id(int regnum);
|
int libunwind__arch_reg_id(int regnum);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
static inline int
|
static inline int
|
||||||
unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
|
unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
|
||||||
|
@ -30,5 +33,5 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LIBUNWIND_SUPPORT */
|
#endif /* HAVE_DWARF_UNWIND_SUPPORT */
|
||||||
#endif /* __UNWIND_H */
|
#endif /* __UNWIND_H */
|
||||||
|
|
Loading…
Reference in a new issue