linux/tools/perf
He Kuang d64ec10ec8 perf unwind: Check the target platform before assigning unwind methods
Currently, 'perf script' uses host unwind methods to parse perf.data
callchain info without taking the target architecture into account, i.e.
assuming the perf.data file was generated on the same machine where the
analysis is being performed. So we get wrong result without any warnings
when unwinding callchains of x86(32-bit) on x86(64-bit) machine.

This patch adds an extra step that checks the target platform before
assigning unwind methods. In later patches in this series, we can use
this info to assign the right unwind methods for supported platforms.

Committer note:

After fixing it to register the local unwinder for live mode tools
('perf trace', 'perf top'), i.e. tools that don't use a perf.data file,
it works as intended and passes the 'perf test unwind' test:

  # perf trace -e nanosleep --call dwarf usleep 1
     0.328 ( 0.058 ms): usleep/11115 nanosleep(rqtp: 0x7fff083fa480) = 0
                                       __nanosleep_nocancel+0x7 (/usr/lib64/libc-2.22.so)
                                       usleep+0x34 (/usr/lib64/libc-2.22.so)
                                       main+0x1eb (/usr/bin/usleep)
                                       __libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
                                       _start+0x29 (/usr/bin/usleep)
  # perf test 48
  48: Test dwarf unwind         : Ok
  #

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-11-git-send-email-hekuang@huawei.com
[ Fixed exit path for 'live' mode tools, where we need to default to local unwinding ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-06-07 15:09:36 -03:00
..
arch perf tools: Export normalize_arch() function 2016-06-07 12:08:53 -03:00
bench perf bench: Remove one more die() call 2016-04-26 13:28:40 -03:00
config perf unwind: Separate local/remote libunwind config 2016-06-07 12:08:52 -03:00
Documentation perf stat: Basic support for TopDown in perf stat 2016-06-06 17:04:15 -03:00
jvmti perf jit: Add support for using TSC as a timestamp 2016-04-01 18:42:55 -03:00
python perf python: Support the PERF_RECORD_SWITCH event 2015-10-07 19:41:50 -03:00
scripts perf script: Update export-to-postgresql to support callchain export 2016-05-06 13:00:55 -03:00
tests perf test: Ignore .scale and other special files 2016-06-06 12:11:14 -03:00
trace perf trace: Move seccomp args beautifiers to tools/perf/trace/beauty/ 2016-05-11 13:06:00 -03:00
ui perf hists: Move sort__has_comm into struct perf_hpp_list 2016-05-05 21:04:02 -03:00
util perf unwind: Check the target platform before assigning unwind methods 2016-06-07 15:09:36 -03:00
.gitignore perf tools: Add arch/*/include/generated/ to .gitignore 2016-05-30 12:41:46 -03:00
Build perf tools: Set and pass DOCDIR to builtin-report.c 2016-01-12 12:42:07 -03:00
builtin-annotate.c perf tools: Set buildid dir under symfs when --symfs is provided 2016-05-20 11:43:58 -03:00
builtin-bench.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-buildid-cache.c perf symbols: Introduce DSO__NAME_KALLSYMS and DSO__NAME_KCORE 2016-05-16 23:11:48 -03:00
builtin-buildid-list.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-config.c perf config: Make show_config() use perf_config_set 2016-04-14 09:15:47 -03:00
builtin-data.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-diff.c perf tools: Set buildid dir under symfs when --symfs is provided 2016-05-20 11:43:58 -03:00
builtin-evlist.c perf evlist: Add --trace-fields option to show trace fields 2016-01-08 14:23:02 -03:00
builtin-help.c perf help: Make check_emacsclient_version to check strbuf APIs 2016-05-10 11:56:14 -03:00
builtin-inject.c perf tools: Add time conversion event 2016-03-31 10:52:24 -03:00
builtin-kmem.c perf callchain: Start moving away from global per thread cursors 2016-04-14 14:48:07 -03:00
builtin-kvm.c perf evsel: Do not use globals in config() 2016-04-11 22:18:20 -03:00
builtin-list.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-lock.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-mem.c perf mem: Add -U/-K (--all-user/--all-kernel) options 2016-03-30 11:14:07 -03:00
builtin-probe.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-record.c perf record: Robustify perf_event__synth_time_conv() 2016-05-30 12:41:44 -03:00
builtin-report.c perf tools: Set buildid dir under symfs when --symfs is provided 2016-05-20 11:43:58 -03:00
builtin-sched.c perf sched map: Display only given cpus 2016-04-13 10:11:52 -03:00
builtin-script.c perf script: Show call graphs when 1st event doesn't have it but some other has 2016-06-03 14:53:46 -03:00
builtin-stat.c perf stat: Add missing aggregation headers for --metric-only CSV 2016-06-06 17:43:12 -03:00
builtin-timechart.c perf tools: Set buildid dir under symfs when --symfs is provided 2016-05-20 11:43:58 -03:00
builtin-top.c perf top: Use machine->kptr_restrict_warned 2016-05-20 11:43:55 -03:00
builtin-trace.c perf trace: Use the ptr->name beautifier as default for "filename" args 2016-05-23 16:41:00 -03:00
builtin-version.c perf tools: Move cmd_version() to builtin-version.c 2015-12-09 13:42:03 -03:00
builtin.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
command-list.txt perf tools: Do not show trace command if it's not compiled in 2016-01-08 12:46:17 -03:00
CREDITS
design.txt
Makefile perf build tests: Do parallell builds with 'build-test' 2016-02-04 15:57:00 -03:00
Makefile.perf perf tools: Build syscall table .c header from kernel's syscall_64.tbl 2016-04-08 09:58:14 -03:00
MANIFEST perf bench: Fix detached tarball building due to missing 'perf bench memcpy' headers 2016-03-24 12:28:57 -03:00
perf-archive.sh
perf-completion.sh perf tools: Avoid confusion with preloaded bash function for perf bash completion 2015-03-19 13:53:27 -03:00
perf-read-vdso.c
perf-sys.h perf tools: Move generic barriers out of perf-sys.h 2015-05-08 16:05:08 -03:00
perf-with-kcore.sh perf tools: Fix perf-with-kcore handling of arguments containing spaces 2015-08-06 16:48:27 -03:00
perf.c perf tools: Separate accounting of contexts and real addresses in a stack trace 2016-05-16 23:11:54 -03:00
perf.h perf tools: Ditch record_opts.callgraph_set 2016-04-18 12:26:27 -03:00