提交 6c6e024f 编写于 作者: W Wang Nan 提交者: Arnaldo Carvalho de Melo

perf probe: Fix error reported when offset without function

This patch fixes a bug that, when offset is provided but function is
lost, parse_perf_probe_point() will give a "" string as function name,
so the checking code at the end of parse_perf_probe_point() become
useless.  For example:

  # perf probe +0x1234
  Failed to find symbol  in kernel
    Error: Failed to add events.

After this patch:

  # perf probe +0x1234
  Semantic error :Offset requires an entry function.
    Error: Command Parse Error.
Signed-off-by: NWang Nan <wangnan0@huawei.com>
Acked-by: NMasami 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-6-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 be07afe9
...@@ -1194,9 +1194,13 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) ...@@ -1194,9 +1194,13 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
*ptr++ = '\0'; *ptr++ = '\0';
} }
tmp = strdup(arg); if (arg[0] == '\0')
if (tmp == NULL) tmp = NULL;
return -ENOMEM; else {
tmp = strdup(arg);
if (tmp == NULL)
return -ENOMEM;
}
if (file_spec) if (file_spec)
pp->file = tmp; pp->file = tmp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册