diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-04-01 00:47:57 -0400 |
---|---|---|
committer | Jiri Olsa <jolsa@redhat.com> | 2014-04-14 06:55:39 -0400 |
commit | 202c7c123c96a1c193149b7fa2718d7fb143efb2 (patch) | |
tree | cb851ce23ae95871a5f3601f80cf1bd67cae7dfe | |
parent | 2c529e4e6aab405aa52e8627cbd691ed28b56a0b (diff) |
perf probe: Fix --line option behavior
The commit 5a62257a3ddd1 ("perf probe: Replace line_list with
intlist") replaced line_list to intlist but it has a problem that if a
same line was added again, it'd return -EEXIST rather than 1.
Since line_range_walk_cb() only checks the result being negative, it
resulted in failure or segfault sometimes.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Link: http://lkml.kernel.org/r/1396327677-3657-1-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
-rw-r--r-- | tools/perf/util/probe-finder.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index df0238654698..3bf0c8cdccb7 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -1441,13 +1441,15 @@ static int line_range_walk_cb(const char *fname, int lineno, | |||
1441 | void *data) | 1441 | void *data) |
1442 | { | 1442 | { |
1443 | struct line_finder *lf = data; | 1443 | struct line_finder *lf = data; |
1444 | int err; | ||
1444 | 1445 | ||
1445 | if ((strtailcmp(fname, lf->fname) != 0) || | 1446 | if ((strtailcmp(fname, lf->fname) != 0) || |
1446 | (lf->lno_s > lineno || lf->lno_e < lineno)) | 1447 | (lf->lno_s > lineno || lf->lno_e < lineno)) |
1447 | return 0; | 1448 | return 0; |
1448 | 1449 | ||
1449 | if (line_range_add_line(fname, lineno, lf->lr) < 0) | 1450 | err = line_range_add_line(fname, lineno, lf->lr); |
1450 | return -EINVAL; | 1451 | if (err < 0 && err != -EEXIST) |
1452 | return err; | ||
1451 | 1453 | ||
1452 | return 0; | 1454 | return 0; |
1453 | } | 1455 | } |