Skip to content

Commit

Permalink
perf probe: Fix to ignore escaped characters in --lines option
Browse files Browse the repository at this point in the history
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 <mhiramat@kernel.org>
Cc: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: Dima Kogan <dima@secretsauce.net>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://lore.kernel.org/r/173099114272.2431889.4820591557298941207.stgit@mhiramat.roam.corp.google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Masami Hiramatsu (Google) authored and Arnaldo Carvalho de Melo committed Nov 14, 2024
1 parent e7c70ee commit 47fa0f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/perf/util/probe-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
lr->start = 0;
lr->end = INT_MAX;

range = strchr(name, ':');
range = strpbrk_esc(name, ":");
if (range) {
*range++ = '\0';

Expand Down Expand Up @@ -1413,7 +1413,7 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
}
}

file = strchr(name, '@');
file = strpbrk_esc(name, "@");
if (file) {
*file = '\0';
lr->file = strdup(++file);
Expand All @@ -1422,7 +1422,7 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
goto err;
}
lr->function = name;
} else if (strchr(name, '/') || strchr(name, '.'))
} else if (strpbrk_esc(name, "/."))
lr->file = name;
else if (is_c_func_name(name))/* We reuse it for checking funcname */
lr->function = name;
Expand Down

0 comments on commit 47fa0f9

Please sign in to comment.