]> git.karo-electronics.de Git - karo-tx-linux.git/commit
perf probe: Fix to get correct modname from elf header
authorMasami Hiramatsu <mhiramat@kernel.org>
Mon, 2 Jan 2017 15:20:49 +0000 (00:20 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 2 Jan 2017 17:09:17 +0000 (14:09 -0300)
commit1f2ed153b916c95a49a1ca9d7107738664224b7f
treece166577010cd469d79483384a42ab746e19c71f
parentb6f4c66704b875aba9b8c912532323e3cc89824c
perf probe: Fix to get correct modname from elf header

Since 'perf probe' supports cross-arch probes, it is possible to analyze
different arch kernel image which has different bits-per-long.

In that case, it fails to get the module name because it uses the
MOD_NAME_OFFSET macro based on the host machine bits-per-long, instead
of the target arch bits-per-long.

This fixes above issue by changing modname-offset based on the target
archs bit width. This is ok because linux kernel uses LP64 model on
64bit arch.

E.g. without this (on x86_64, and target module is arm32):

  $ perf probe -m build-arm/fs/configfs/configfs.ko -D configfs_lookup
  p:probe/configfs_lookup :configfs_lookup+0
                          ^-Here is an empty module name.

With this fix, you can see correct module name:

  $ perf probe -m build-arm/fs/configfs/configfs.ko -D configfs_lookup
  p:probe/configfs_lookup configfs:configfs_lookup+0

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/148337043836.6752.383495516397005695.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/probe-event.c