perf parse-events: Improve error location of terms cloned from an event
authorIan Rogers <irogers@google.com>
Wed, 31 Jan 2024 13:49:39 +0000 (05:49 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 2 Feb 2024 21:07:45 +0000 (13:07 -0800)
commitf5144ecad74101f87843aa08070df26a3937102a
tree70e949a1622f1a38e7b1f1ed733369f5ea06e5dc
parent2882358b8b83b417a9d82205ae6aae5be00bd989
perf parse-events: Improve error location of terms cloned from an event

A PMU event/alias will have a set of format terms that replace it when
an event is parsed. The location of the terms is their position when
parsed for the event/alias either from sysfs or json. This location is
of little use when an event fails to parse as the error will be given
in terms of the location in the string of events parsed not the json
or sysfs string. Fix this by making the cloned terms location that of
the event/alias.

If a cloned term from an event/alias is invalid the bad format is hard
to determine from the error string. Add the name of the bad format
into the error string.

Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: James Clark <james.clark@arm.com>
Cc: tchen168@asu.edu
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240131134940.593788-2-irogers@google.com
tools/perf/util/pmu.c