diff options
author | Wang Nan <wangnan0@huawei.com> | 2015-08-26 06:57:44 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-08-26 09:40:34 -0400 |
commit | 6c6e024f0a62a6a08c06002fd3caa2307cc54fd0 (patch) | |
tree | 670c5540652aa322d53988ab6ba29a6129d86937 /tools/perf/util | |
parent | be07afe92a09638db9159d2c0794487d66a437a2 (diff) |
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: 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-6-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/probe-event.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 926bcecc4a44..eaacb58b9b36 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -1194,9 +1194,13 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) | |||
1194 | *ptr++ = '\0'; | 1194 | *ptr++ = '\0'; |
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | tmp = strdup(arg); | 1197 | if (arg[0] == '\0') |
1198 | if (tmp == NULL) | 1198 | tmp = NULL; |
1199 | return -ENOMEM; | 1199 | else { |
1200 | tmp = strdup(arg); | ||
1201 | if (tmp == NULL) | ||
1202 | return -ENOMEM; | ||
1203 | } | ||
1200 | 1204 | ||
1201 | if (file_spec) | 1205 | if (file_spec) |
1202 | pp->file = tmp; | 1206 | pp->file = tmp; |