On Mon, Nov 02, 2026 at 12:15:24PM +0000, James Clark wrote:
Currently each auxtrace user has to implement both the snapshot search and the logic to fixup the 'head' and 'old' values after finding a wrap. IntelPT and BTS have the same fixup logic but different wrap searches. BTS and Arm SPE have the same search but SPE modifies head differently (although it probably shouldn’t), and Arm Coresight doesn't have a search at all, but later it will want the same search and fixup logic.
Add auxtrace_record__default_find_snapshot() as a generic find_snapshot() implementation that tracers can use without reimplementing it. It's based on intel_bts_find_snapshot() and the search includes the caching from it. Split the pointer fixup into auxtrace_record__snapshot_fixup() so that tracers with their own search, like Intel PT, can still share it.
No functional changes intended apart from changing the pr_debug3()s to print hex to match __auxtrace_mmap__read() and no longer leaking snapshot_refs when expanding the array length.
Signed-off-by: James Clark james.clark@linaro.org
Reviewed-by: Leo Yan leo.yan@arm.com