Re: [PATCH v3] perf c2c: fix '-e list'

From: Jiri Olsa
Date: Mon May 11 2020 - 17:09:24 EST


On Mon, May 11, 2020 at 01:29:42PM -0700, Ian Rogers wrote:

SNIP

> > > diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
> > > index 1baf4cae086f..d617d5682c68 100644
> > > --- a/tools/perf/builtin-c2c.c
> > > +++ b/tools/perf/builtin-c2c.c
> > > @@ -2887,8 +2887,15 @@ static int parse_record_events(const struct option *opt,
> > > {
> > > bool *event_set = (bool *) opt->value;
> > >
> > > + if (!strcmp(str, "list")) {
> > > + perf_mem_events__list();
> > > + exit(0);
> > > + }
> > > + if (perf_mem_events__parse(str))
> > > + exit(-1);
> >
> > won't this exit(-1) callsbreak the parsing stuff?
> > like displaying the option values on error or such?
>
> The previous code was:
> - if (strcmp(str, "list")) {
> This is handled explicitly in the code above this.
>
> - if (!perf_mem_events__parse(str)) {
> - mem->operation = 0;
> - return 0;
> - }
> - exit(-1);
> This is the code where the exit -1 happens, I inverted the comparison
> so that exit was more the exceptional code path. The behavior should
> be identical.

ok

Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>

thanks,
jirka