perf probe: Fix module probe issue if no dwarf support
authorRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Tue, 26 Apr 2016 14:25:40 +0000 (19:55 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 26 Apr 2016 16:15:01 +0000 (13:15 -0300)
commitc61fb959df898b994382d586046d7704476ff503
tree3f160494f84c3facbc315eb77193f16302f04466
parent63a29613d7c69f17b6a3266bfc338986698b2546
perf probe: Fix module probe issue if no dwarf support

Perf is not able to register probe in kernel module when dwarf supprt
is not there(and so it goes for symtab). Perf passes full path of
module where only module name is required which is causing the problem.
This patch fixes this issue.

Before applying patch:

  $ dpkg -s libdw-dev
  dpkg-query: package 'libdw-dev' is not installed and no information is...

  $ sudo ./perf probe -m /linux/samples/kprobes/kprobe_example.ko kprobe_init
  Added new event:
    probe:kprobe_init (on kprobe_init in /linux/samples/kprobes/kprobe_example.ko)

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

  perf record -e probe:kprobe_init -aR sleep 1

  $ sudo cat /sys/kernel/debug/tracing/kprobe_events
  p:probe/kprobe_init /linux/samples/kprobes/kprobe_example.ko:kprobe_init

  $ sudo ./perf record -a -e probe:kprobe_init
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.105 MB perf.data ]

  $ sudo ./perf script  # No output here

After applying patch:

  $ sudo ./perf probe -m /linux/samples/kprobes/kprobe_example.ko kprobe_init
  Added new event:
    probe:kprobe_init    (on kprobe_init in kprobe_example)

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

  perf record -e probe:kprobe_init -aR sleep 1

  $ sudo cat /sys/kernel/debug/tracing/kprobe_events
  p:probe/kprobe_init kprobe_example:kprobe_init

  $ sudo ./perf record -a -e probe:kprobe_init
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.105 MB perf.data (2 samples) ]

  $ sudo ./perf script
  insmod 13990 [002]  5961.216833: probe:kprobe_init: ...
  insmod 13995 [002]  5962.889384: probe:kprobe_init: ...

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1461680741-12517-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/probe-event.c
This page took 0.041039 seconds and 5 git commands to generate.