linux/tools/perf
Wang Nan da15bd9df4 perf probe: Support probing at absolute address
It should be useful to allow 'perf probe' probe at absolute offset of a
target. For example, when (u)probing at a instruction of a shared object
in a embedded system where debuginfo is not avaliable but we know the
offset of that instruction by manually digging.

This patch enables following perf probe command syntax:

  # perf probe 0xffffffff811e6615

And

  # perf probe /lib/x86_64-linux-gnu/libc-2.19.so 0xeb860

In the above example, we don't need a anchor symbol, so it is possible
to compute absolute addresses using other methods and then use 'perf
probe' to create the probing points.

v1 -> v2:
  Drop the leading '+' in cmdline;
  Allow uprobing at offset 0x0;
  Improve 'perf probe -l' result when uprobe at area without debuginfo.

v2 -> v3:
  Split bugfix to a separated patch.

Test result:

  # perf probe 0xffffffff8119d175 %ax
  # perf probe sys_write %ax
  # perf probe /lib64/libc-2.18.so 0x0 %ax
  # perf probe /lib64/libc-2.18.so 0x5 %ax
  # perf probe /lib64/libc-2.18.so 0xd8e40 %ax
  # perf probe /lib64/libc-2.18.so __write %ax
  # perf probe /lib64/libc-2.18.so 0xd8e49 %ax
  # cat /sys/kernel/debug/tracing/uprobe_events

  p:probe_libc/abs_0 /lib64/libc-2.18.so:0x          (null) arg1=%ax
  p:probe_libc/abs_5 /lib64/libc-2.18.so:0x0000000000000005 arg1=%ax
  p:probe_libc/abs_d8e40 /lib64/libc-2.18.so:0x00000000000d8e40 arg1=%ax
  p:probe_libc/__write /lib64/libc-2.18.so:0x00000000000d8e40 arg1=%ax
  p:probe_libc/abs_d8e49 /lib64/libc-2.18.so:0x00000000000d8e49 arg1=%ax

  # cat /sys/kernel/debug/tracing/kprobe_events

  p:probe/abs_ffffffff8119d175 0xffffffff8119d175 arg1=%ax
  p:probe/sys_write _text+1692016 arg1=%ax

  # perf probe -l

  Failed to find debug information for address 5
    probe:abs_ffffffff8119d175 (on sys_write+5 with arg1)
    probe:sys_write      (on sys_write with arg1)
    probe_libc:__write   (on @unix/syscall-template.S:81 in /lib64/libc-2.18.so with arg1)
    probe_libc:abs_0     (on 0x0 in /lib64/libc-2.18.so with arg1)
    probe_libc:abs_5     (on 0x5 in /lib64/libc-2.18.so with arg1)
    probe_libc:abs_d8e40 (on @unix/syscall-template.S:81 in /lib64/libc-2.18.so with arg1)
    probe_libc:abs_d8e49 (on __GI___libc_write+9 in /lib64/libc-2.18.so with arg1)

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1440586666-235233-7-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-08-26 10:41:12 -03:00
..
arch perf tools: Add Intel PT support for using CYC packets 2015-08-24 17:49:43 -03:00
bench perf bench futex: Add lock_pi stresser 2015-07-20 17:49:51 -03:00
config perf tools: Support static linking with libdw 2015-08-13 14:49:11 -03:00
Documentation perf tools: Update Intel PT documentation 2015-08-24 17:51:09 -03:00
python perf python: Make twatch.py use soft dummy event, freq=0 2015-07-29 10:51:45 -03:00
scripts perf tools: Add example call-graph script 2015-08-21 12:32:40 -03:00
tests perf tests: Add tests to callgraph and time parse 2015-08-12 13:20:29 -03:00
trace/strace/groups perf trace: Support 'strace' syscall event groups 2015-07-20 15:16:32 -03:00
ui perf ui tui progress: Implement the ui_progress_ops->finish() method 2015-08-24 16:18:26 -03:00
util perf probe: Support probing at absolute address 2015-08-26 10:41:12 -03:00
.gitignore perf tools: Add Intel PT instruction decoder 2015-08-17 11:11:36 -03:00
Build perf trace: Support 'strace' syscall event groups 2015-07-20 15:16:32 -03:00
builtin-annotate.c perf annotate: Reset the dso find_symbol cache when removing symbols 2015-08-24 13:33:14 -03:00
builtin-bench.c perf bench futex: Add lock_pi stresser 2015-07-20 17:49:51 -03:00
builtin-buildid-cache.c perf buildid: Use SBUILD_ID_SIZE macro 2015-07-20 17:49:50 -03:00
builtin-buildid-list.c perf buildid: Use SBUILD_ID_SIZE macro 2015-07-20 17:49:50 -03:00
builtin-data.c perf data: Support using -f to override perf.data file ownership for 'convert' 2015-04-02 13:18:52 -03:00
builtin-diff.c perf callchain: Allow disabling call graphs per event 2015-08-12 13:20:28 -03:00
builtin-evlist.c perf evlist: Support using -f to override perf.data file ownership 2015-04-02 13:18:45 -03:00
builtin-help.c perf tools: Add the bash completion for listing subsubcommands of perf help 2015-03-19 13:49:39 -03:00
builtin-inject.c perf tools: Add new PERF_RECORD_SWITCH event 2015-07-23 22:51:13 -03:00
builtin-kmem.c perf kmem: Fill in the missing session freeing after an error occurs 2015-07-01 17:53:49 -03:00
builtin-kvm.c perf kvm: Fill in the missing session freeing after an error occurs 2015-07-01 17:53:49 -03:00
builtin-list.c perf list: Extend raw-dump to certain kind of events 2015-02-27 15:52:24 -03:00
builtin-lock.c perf machine: Protect the machine->threads with a rwlock 2015-05-08 16:19:27 -03:00
builtin-mem.c perf mem: Fill in the missing session freeing after an error occurs 2015-07-01 17:53:49 -03:00
builtin-probe.c perf probe: Delete an unnecessary check before the function call "strfilter__delete" 2015-07-06 08:58:36 -03:00
builtin-record.c Merge branch 'perf/urgent' into perf/core, to pick up fixes before adding more changes 2015-08-20 11:48:56 +02:00
builtin-report.c perf report: Show call graph from reference events 2015-08-12 13:20:28 -03:00
builtin-sched.c perf sched: Add option to merge like comms to lat output 2015-05-27 12:21:45 -03:00
builtin-script.c perf script: Initialize callchain_param.record_mode 2015-08-17 10:48:39 -03:00
builtin-stat.c perf stat: Move perf_counts struct and functions into separate object 2015-08-08 14:16:49 -03:00
builtin-timechart.c perf tools: Elliminate alignment holes 2015-05-18 10:17:33 -03:00
builtin-top.c Merge branch 'perf/urgent' into perf/core, to pick up fixes before adding more changes 2015-08-20 11:48:56 +02:00
builtin-trace.c perf trace: Move vfs_getname storage to per thread area 2015-08-14 13:16:27 -03:00
builtin.h perf tools: Add new 'perf data' command 2015-02-25 12:42:25 -03:00
command-list.txt perf tools: Add new 'perf data' command 2015-02-25 12:42:25 -03:00
CREDITS
design.txt
Makefile perf build: Fix single target build dependency check 2015-06-22 11:27:09 -03:00
Makefile.perf perf tools: Add Intel PT instruction decoder 2015-08-17 11:11:36 -03:00
MANIFEST perf tools: Remove export.h from MANIFEST 2015-08-26 10:34: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 tools: Build programs to copy 32-bit compatibility 2014-10-29 10:32:48 -02:00
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: Fix the bash completion problem of 'perf --*' 2015-02-27 15:52:28 -03:00
perf.h perf tools: Introduce callgraph_set for callgraph option 2015-07-29 16:18:45 -03:00