Commit 3dd3aae3 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Steven Rostedt (VMware)

tracing/uprobes: Support perf-style return probe

Support perf-style return probe ("SYMBOL%return") for uprobe events
as same as kprobe events does.

Link: https://lkml.kernel.org/r/159972814601.428528.7641183316212425445.stgit@devnote2Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 4725cd89
...@@ -5125,7 +5125,7 @@ static const char readme_msg[] = ...@@ -5125,7 +5125,7 @@ static const char readme_msg[] =
"place (kretprobe): [<module>:]<symbol>[+<offset>]%return|<memaddr>\n" "place (kretprobe): [<module>:]<symbol>[+<offset>]%return|<memaddr>\n"
#endif #endif
#ifdef CONFIG_UPROBE_EVENTS #ifdef CONFIG_UPROBE_EVENTS
" place (uprobe): <path>:<offset>[(ref_ctr_offset)]\n" " place (uprobe): <path>:<offset>[%return][(ref_ctr_offset)]\n"
#endif #endif
"\t args: <name>=fetcharg[:type]\n" "\t args: <name>=fetcharg[:type]\n"
"\t fetcharg: %<register>, @<address>, @<symbol>[+|-<offset>],\n" "\t fetcharg: %<register>, @<address>, @<symbol>[+|-<offset>],\n"
......
...@@ -528,7 +528,7 @@ static int register_trace_uprobe(struct trace_uprobe *tu) ...@@ -528,7 +528,7 @@ static int register_trace_uprobe(struct trace_uprobe *tu)
/* /*
* Argument syntax: * Argument syntax:
* - Add uprobe: p|r[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] * - Add uprobe: p|r[:[GRP/]EVENT] PATH:OFFSET[%return][(REF)] [FETCHARGS]
*/ */
static int trace_uprobe_create(int argc, const char **argv) static int trace_uprobe_create(int argc, const char **argv)
{ {
...@@ -617,6 +617,19 @@ static int trace_uprobe_create(int argc, const char **argv) ...@@ -617,6 +617,19 @@ static int trace_uprobe_create(int argc, const char **argv)
} }
} }
/* Check if there is %return suffix */
tmp = strchr(arg, '%');
if (tmp) {
if (!strcmp(tmp, "%return")) {
*tmp = '\0';
is_return = true;
} else {
trace_probe_log_err(tmp - filename, BAD_ADDR_SUFFIX);
ret = -EINVAL;
goto fail_address_parse;
}
}
/* Parse uprobe offset. */ /* Parse uprobe offset. */
ret = kstrtoul(arg, 0, &offset); ret = kstrtoul(arg, 0, &offset);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment