aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2017-10-12 11:03:38 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-10-27 10:42:51 -0400
commit9445464bb8318e42e5232b37fc7218ed028517f6 (patch)
tree6d5f5641d87fb9ad15fadca7a7c118d12919bbef /tools/perf
parent331c7cb307971eac38e9470340e10c87855bf4bc (diff)
perf tools: Unwind properly location after REJECT
We have defined YY_USER_ACTION to keep trace of the column location during events parsing, but we need to clean it up when we call REJECT. When REJECT is called, the lexer shrinks the text and re-runs the matching, so we need to address it in resuming the previous location value to keep it correct for error display, like: Before: $ perf stat -e 'cpu/uops_executed.core,krava/' true event syntax error: '..38;5;9:mi=01;05;37;41:su=48;5;196;38;5;15:sg=48;5;1\ 1;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;\ 21;38;50 �' \___ unknown term After: $ ./perf stat -e 'cpu/uops_executed.core,krava/' true event syntax error: '..cuted.core,krava/' \___ unknown term Signed-off-by: Jiri Olsa <jolsa@kernel.org> Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: Andi Kleen <ak@linux.intel.com> Cc: Changbin Du <changbin.du@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-vug2hchlny30jfsfrumbym26@git.kernel.org Link: http://lkml.kernel.org/r/20171009140944.GD28623@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/parse-events.l8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index dcfdafdc2f1c..6680e4fb7967 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -154,6 +154,10 @@ do { \
154 yycolumn += yyleng; \ 154 yycolumn += yyleng; \
155} while (0); 155} while (0);
156 156
157#define USER_REJECT \
158 yycolumn -= yyleng; \
159 REJECT
160
157%} 161%}
158 162
159%x mem 163%x mem
@@ -335,8 +339,8 @@ r{num_raw_hex} { return raw(yyscanner); }
335{num_hex} { return value(yyscanner, 16); } 339{num_hex} { return value(yyscanner, 16); }
336 340
337{modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); } 341{modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); }
338{bpf_object} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_OBJECT); } 342{bpf_object} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_OBJECT); }
339{bpf_source} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_SOURCE); } 343{bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); }
340{name} { return pmu_str_check(yyscanner); } 344{name} { return pmu_str_check(yyscanner); }
341"/" { BEGIN(config); return '/'; } 345"/" { BEGIN(config); return '/'; }
342- { return '-'; } 346- { return '-'; }