[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fWK-eeDEvE4+LeeScbHFecmc5+H8WB_5fepfrJJLZsF0Q@mail.gmail.com>
Date: Mon, 9 Dec 2024 10:35:34 -0800
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>, John Garry <john.g.garry@...cle.com>,
Sandipan Das <sandipan.das@....com>, Xu Yang <xu.yang_2@....com>,
Benjamin Gray <bgray@...ux.ibm.com>, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] perf jevents: Fix build issue in '*/' in event descriptions
On Wed, Nov 13, 2024 at 8:56 AM Ian Rogers <irogers@...gle.com> wrote:
>
> For big string offsets we output comments for what string the offset
> is for. If the string contains a '*/' as seen in Intel Arrowlake event
> descriptions, then this causes C parsing issues for the generated
> pmu-events.c. Catch such '*/' values and escape to avoid this.
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
Ping.
Thanks,
Ian
> ---
> tools/perf/pmu-events/jevents.py | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py
> index 6e71b09dbc2a..028cf3c43881 100755
> --- a/tools/perf/pmu-events/jevents.py
> +++ b/tools/perf/pmu-events/jevents.py
> @@ -430,8 +430,11 @@ class JsonEvent:
> def to_c_string(self, metric: bool) -> str:
> """Representation of the event as a C struct initializer."""
>
> + def fix_comment(s: str) -> str:
> + return s.replace('*/', '\*\/')
> +
> s = self.build_c_string(metric)
> - return f'{{ { _bcs.offsets[s] } }}, /* {s} */\n'
> + return f'{{ { _bcs.offsets[s] } }}, /* {fix_comment(s)} */\n'
>
>
> @lru_cache(maxsize=None)
> --
> 2.47.0.277.g8800431eea-goog
>
Powered by blists - more mailing lists