summaryrefslogtreecommitdiff
path: root/tools/perf/util/unwind-libunwind.c
diff options
context:
space:
mode:
authorHe Kuang <hekuang@huawei.com>2016-06-03 06:33:22 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-06-07 21:13:27 +0300
commit52ffe0ff02fc053a025c381d5808e9ecd3206dfe (patch)
tree9b89d84dc668b112c7cf581be7eee13cd1dd656c /tools/perf/util/unwind-libunwind.c
parent19473e7ba8f8f443f09d4187791de9d6f95fdc1d (diff)
downloadlinux-52ffe0ff02fc053a025c381d5808e9ecd3206dfe.tar.xz
perf callchain: Support x86 target platform
Support x86(32-bit) cross platform callchain unwind. Signed-off-by: He Kuang <hekuang@huawei.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Kan Liang <kan.liang@intel.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1464924803-22214-14-git-send-email-hekuang@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/unwind-libunwind.c')
-rw-r--r--tools/perf/util/unwind-libunwind.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index 0086726e00e0..e65515aa61d9 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -5,6 +5,7 @@
#include "arch/common.h"
struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops;
+struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops;
static void unwind__register_ops(struct thread *thread,
struct unwind_libunwind_ops *ops)
@@ -16,6 +17,7 @@ int unwind__prepare_access(struct thread *thread, struct map *map)
{
const char *arch;
enum dso_type dso_type;
+ struct unwind_libunwind_ops *ops = local_unwind_libunwind_ops;
if (thread->addr_space) {
pr_debug("unwind: thread map already set, dso=%s\n",
@@ -32,9 +34,18 @@ int unwind__prepare_access(struct thread *thread, struct map *map)
return 0;
arch = normalize_arch(thread->mg->machine->env->arch);
- pr_debug("unwind: target platform=%s\n", arch);
+
+ if (!strcmp(arch, "x86")) {
+ if (dso_type != DSO__TYPE_64BIT)
+ ops = x86_32_unwind_libunwind_ops;
+ }
+
+ if (!ops) {
+ pr_err("unwind: target platform=%s is not supported\n", arch);
+ return -1;
+ }
out_register:
- unwind__register_ops(thread, local_unwind_libunwind_ops);
+ unwind__register_ops(thread, ops);
return thread->unwind_libunwind_ops->prepare_access(thread);
}