linux/tools
Masami Hiramatsu 9b239a12bc perf probe: Show correct source lines of probes on kmodules
Perf probe always failed to find appropriate line numbers because of
failing to find .text start address offset from debuginfo.

e.g.
  ----
  # ./perf probe -m pcspkr pcspkr_event:5
  Added new events:
    probe:pcspkr_event   (on pcspkr_event:5 in pcspkr)
    probe:pcspkr_event_1 (on pcspkr_event:5 in pcspkr)

  You can now use it in all perf tools, such as:

          perf record -e probe:pcspkr_event_1 -aR sleep 1

  # ./perf probe -l
  Failed to find debug information for address ffffffffa031f006
  Failed to find debug information for address ffffffffa031f016
    probe:pcspkr_event   (on pcspkr_event+6 in pcspkr)
    probe:pcspkr_event_1 (on pcspkr_event+22 in pcspkr)
  ----

This fixes the above issue as below.
1. Get the relative address of the symbol in .text by using
   map->start.
2. Adjust the address by adding the offset of .text section
   in the kernel module binary.

With this fix, perf probe -l shows lines correctly.
  ----
  # ./perf probe -l
    probe:pcspkr_event   (on pcspkr_event:5@drivers/input/misc/pcspkr.c in pcspkr)
    probe:pcspkr_event_1 (on pcspkr_event:5@drivers/input/misc/pcspkr.c in pcspkr)
  ----

Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20150930164132.3733.24643.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-09-30 18:34:35 -03:00
..
arch tools include: Add basic atomic.h implementation from the kernel sources 2015-05-08 16:11:05 -03:00
build tools build: Build fixdep helper from perf and basic libs 2015-09-28 15:50:55 -03:00
cgroup
firewire
hv tools: hv: add a python script lsvmbus to list VMBus devices 2015-08-05 11:44:29 -07:00
iio iio: lsiio: fix error code handling error 2015-08-12 19:26:22 +01:00
include tools: Fix shadowed declaration in err.h 2015-09-30 18:34:22 -03:00
laptop/freefall Move freefall program from Documentation/ to tools/ 2015-06-08 16:42:07 -06:00
lguest tools/lguest: Clean up include dir 2015-08-26 06:12:35 +02:00
lib tools lib symbol: Introduce kallsyms2elf_type 2015-09-30 18:34:31 -03:00
net bpf_jit_disasm: also support reading jit dump from file 2015-07-31 15:13:14 -07:00
nfsd
perf perf probe: Show correct source lines of probes on kmodules 2015-09-30 18:34:35 -03:00
power Power management and ACPI material for v4.3-rc1 2015-09-01 19:45:46 -07:00
scripts tools lib traceevent: Add global QUIET_CC_FPIC build output 2013-12-19 16:18:10 -03:00
testing membarrier: clean up selftest 2015-09-22 15:09:53 -07:00
thermal/tmon tools/thermal: tmon: fixed the 'make install' command 2015-05-09 13:36:58 +08:00
time tools: add script to test udelay 2014-07-23 10:16:38 -07:00
usb tools: ffs-aio-example: use endpoint addresses from descriptors 2015-01-15 09:41:49 -06:00
virtio tools/virtio: propagate V=X to kernel build 2015-09-16 12:48:07 +03:00
vm tools vm: Fix build due to removal of tools/lib/api/fs/debugfs.h 2015-09-22 22:42:39 -03:00
Makefile Staging driver patches for 4.2-rc1 2015-06-26 15:46:08 -07:00