Skip to content

Commit 47fa0f9

Browse files
mhiramatacmel
authored andcommitted
perf probe: Fix to ignore escaped characters in --lines option
Use strbprk_esc() and strdup_esc() to ignore escaped characters in --lines option. This has been done for other options, but only --lines option doesn't. Signed-off-by: Masami Hiramatsu <[email protected]> Cc: Alexander Lobakin <[email protected]> Cc: Dima Kogan <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Przemek Kitszel <[email protected]> Link: https://lore.kernel.org/r/173099114272.2431889.4820591557298941207.stgit@mhiramat.roam.corp.google.com Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent e7c70ee commit 47fa0f9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/perf/util/probe-event.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
13721372
lr->start = 0;
13731373
lr->end = INT_MAX;
13741374

1375-
range = strchr(name, ':');
1375+
range = strpbrk_esc(name, ":");
13761376
if (range) {
13771377
*range++ = '\0';
13781378

@@ -1413,7 +1413,7 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
14131413
}
14141414
}
14151415

1416-
file = strchr(name, '@');
1416+
file = strpbrk_esc(name, "@");
14171417
if (file) {
14181418
*file = '\0';
14191419
lr->file = strdup(++file);
@@ -1422,7 +1422,7 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
14221422
goto err;
14231423
}
14241424
lr->function = name;
1425-
} else if (strchr(name, '/') || strchr(name, '.'))
1425+
} else if (strpbrk_esc(name, "/."))
14261426
lr->file = name;
14271427
else if (is_c_func_name(name))/* We reuse it for checking funcname */
14281428
lr->function = name;

0 commit comments

Comments
 (0)