Skip to contentSkip to conversation

perf tools: Fix handling of wildcards in tracepoint event selectors

tip:perf/urgent tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Jan 18, 2011 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  dd9a9ad5e1e94894433110ccbf492ed60d75ffcb
Gitweb:     http://git.kernel.org/tip/dd9a9ad5e1e94894433110ccbf492ed60d75ffcb
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Mon, 17 Jan 2011 14:25:06 -0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 17 Jan 2011 15:26:07 -0200

perf tools: Fix handling of wildcards in tracepoint event selectors

It wasn't accounting the ':' when consuming bytes in the the event selector string, so parse_events() would fail in this test:

                if (!(*str == 0 || *str == ',' || isspace(*str)))
                        return -1;

as *str would be pointing to '*', the last character in the '-e' arg in:

$ perf record -q -a -D -e sched:sched_* | perf script -i - -s perf-script.py

Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Tom Zanussi <[email protected]>
LKML-Reference: <new-submission>

---
 tools/perf/util/parse-events.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/parse-events.c +1 -1
index 5cb6f4b..1f4cfe5 100644
@@ -555,7 +555,7 @@ static enum event_result parse_tracepoint_event(const char **strp,
 	if (evt_length >= MAX_EVENT_LENGTH)
 		return EVT_FAILED;
 	if (strpbrk(evt_name, "*?")) {
-		*strp += strlen(sys_name) + evt_length;
+		*strp += strlen(sys_name) + evt_length + 1; /* 1 == the ':' */
 		return parse_multiple_tracepoint_event(sys_name, evt_name,
 						       flags);
 	} else {