Re: [PATCH] perf tools: report initial event parsing error

Ian Rogers
2019-11-16T07:52:38Z

On Mon, Nov 11, 2019 at 4:02 AM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Fri, Nov 08, 2019 at 10:15:33AM -0800, Ian Rogers wrote:
> > Record the first event parsing error and report. Implementing feedback
> > from Jiri Olsa:
> > https://lkml.org/lkml/2019/10/28/680
> >
> > An example error is:
> >
> > $ tools/perf/perf stat -e c/c/
> > WARNING: multiple event parsing errors
> > event syntax error: 'c/c/'
> > \___ unknown term
> >
> > valid terms: event,filter_rem,filter_opc0,edge,filter_isoc,filter_tid,filter_loc,filter_nc,inv,umask,filter_opc1,tid_en,thresh,filter_all_op,filter_not_nm,filter_state,filter_nm,config,config1,config2,name,period,percore
> >
> > Initial error:
> > event syntax error: 'c/c/'
> > \___ Cannot find PMU `c'. Missing kernel support?
>
> not sure where this got lost or if it was there before,
> but the index should point to zero to have the 'arrow' aligned

This happened in:
448d732cefb3 perf parse: Add parse events handle error
When the code wasn't clear on the value of idx it was set to -1.
Fixed in v2 but perhaps there are other instances from 448d732cefb3
that should be addressed.

Thanks,
Ian

> jirka
>
>
> ---
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index a369bbc289b2..6bae9d6edc12 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -1366,7 +1366,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
> if (asprintf(&err_str,
> "Cannot find PMU `%s'. Missing kernel support?",
> name) >= 0)
> - parse_events__handle_error(err, -1, err_str, NULL);
> + parse_events__handle_error(err, 0, err_str, NULL);
> return -EINVAL;
> }
>
>