Commit 4ee5a52e authored by Oleg Nesterov's avatar Oleg Nesterov

uprobes/tracing: Change create_trace_uprobe() to support uretprobes

Finally change create_trace_uprobe() to check if argv[0][0] == 'r'
and pass the correct "is_ret" to alloc_trace_uprobe().
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Acked-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
Tested-by: default avatarAnton Arapov <anton@redhat.com>
parent 3ede82dd
...@@ -201,7 +201,7 @@ static int register_trace_uprobe(struct trace_uprobe *tu) ...@@ -201,7 +201,7 @@ static int register_trace_uprobe(struct trace_uprobe *tu)
/* /*
* Argument syntax: * Argument syntax:
* - Add uprobe: p[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS] * - Add uprobe: p|r[:[GRP/]EVENT] PATH:SYMBOL [FETCHARGS]
* *
* - Remove uprobe: -:[GRP/]EVENT * - Remove uprobe: -:[GRP/]EVENT
*/ */
...@@ -213,20 +213,23 @@ static int create_trace_uprobe(int argc, char **argv) ...@@ -213,20 +213,23 @@ static int create_trace_uprobe(int argc, char **argv)
char buf[MAX_EVENT_NAME_LEN]; char buf[MAX_EVENT_NAME_LEN];
struct path path; struct path path;
unsigned long offset; unsigned long offset;
bool is_delete; bool is_delete, is_return;
int i, ret; int i, ret;
inode = NULL; inode = NULL;
ret = 0; ret = 0;
is_delete = false; is_delete = false;
is_return = false;
event = NULL; event = NULL;
group = NULL; group = NULL;
/* argc must be >= 1 */ /* argc must be >= 1 */
if (argv[0][0] == '-') if (argv[0][0] == '-')
is_delete = true; is_delete = true;
else if (argv[0][0] == 'r')
is_return = true;
else if (argv[0][0] != 'p') { else if (argv[0][0] != 'p') {
pr_info("Probe definition must be started with 'p' or '-'.\n"); pr_info("Probe definition must be started with 'p', 'r' or '-'.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -324,7 +327,7 @@ static int create_trace_uprobe(int argc, char **argv) ...@@ -324,7 +327,7 @@ static int create_trace_uprobe(int argc, char **argv)
kfree(tail); kfree(tail);
} }
tu = alloc_trace_uprobe(group, event, argc, false); tu = alloc_trace_uprobe(group, event, argc, is_return);
if (IS_ERR(tu)) { if (IS_ERR(tu)) {
pr_info("Failed to allocate trace_uprobe.(%d)\n", (int)PTR_ERR(tu)); pr_info("Failed to allocate trace_uprobe.(%d)\n", (int)PTR_ERR(tu));
ret = PTR_ERR(tu); ret = PTR_ERR(tu);
......
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