[PATCH 1/4] perf-probe: Fix to ignore escaped characters in --lines option

Masami Hiramatsu (Google) posted 4 patches 2 weeks, 5 days ago
There is a newer version of this series
[PATCH 1/4] perf-probe: Fix to ignore escaped characters in --lines option
Posted by Masami Hiramatsu (Google) 2 weeks, 5 days ago
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

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 (Google) <mhiramat@kernel.org>
---
 tools/perf/util/probe-event.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index a17c9b8a7a79..665dcce482e1 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1355,7 +1355,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';
 
@@ -1396,16 +1396,16 @@ 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);
+		lr->file = strdup_esc(++file);
 		if (lr->file == NULL) {
 			err = -ENOMEM;
 			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;