diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-11-24 23:42:47 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-01-02 20:57:05 -0500 |
commit | b7e0bf341f6cfa92ae0a0e3d0c3496729595e1e9 (patch) | |
tree | 0831ae7ab363f3789c5cb14bbf4973bfe17287bc /kernel/trace/trace_probe.c | |
parent | 72fd293aa9ae8f4f48d6042be43fe81551c639f2 (diff) |
tracing/uprobes: Add @+file_offset fetch method
Enable to fetch data from a file offset. Currently it only supports
fetching from same binary uprobe set. It'll translate the file offset
to a proper virtual address in the process.
The syntax is "@+OFFSET" as it does similar to normal memory fetching
(@ADDR) which does no address translation.
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'kernel/trace/trace_probe.c')
-rw-r--r-- | kernel/trace/trace_probe.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index a130d612e705..8364a421b4df 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c | |||
@@ -374,7 +374,7 @@ static int parse_probe_arg(char *arg, const struct fetch_type *t, | |||
374 | } | 374 | } |
375 | break; | 375 | break; |
376 | 376 | ||
377 | case '@': /* memory or symbol */ | 377 | case '@': /* memory, file-offset or symbol */ |
378 | if (isdigit(arg[1])) { | 378 | if (isdigit(arg[1])) { |
379 | ret = kstrtoul(arg + 1, 0, ¶m); | 379 | ret = kstrtoul(arg + 1, 0, ¶m); |
380 | if (ret) | 380 | if (ret) |
@@ -382,6 +382,17 @@ static int parse_probe_arg(char *arg, const struct fetch_type *t, | |||
382 | 382 | ||
383 | f->fn = t->fetch[FETCH_MTD_memory]; | 383 | f->fn = t->fetch[FETCH_MTD_memory]; |
384 | f->data = (void *)param; | 384 | f->data = (void *)param; |
385 | } else if (arg[1] == '+') { | ||
386 | /* kprobes don't support file offsets */ | ||
387 | if (is_kprobe) | ||
388 | return -EINVAL; | ||
389 | |||
390 | ret = kstrtol(arg + 2, 0, &offset); | ||
391 | if (ret) | ||
392 | break; | ||
393 | |||
394 | f->fn = t->fetch[FETCH_MTD_file_offset]; | ||
395 | f->data = (void *)offset; | ||
385 | } else { | 396 | } else { |
386 | /* uprobes don't support symbols */ | 397 | /* uprobes don't support symbols */ |
387 | if (!is_kprobe) | 398 | if (!is_kprobe) |