]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf trace: Add missing perf_tool__init()
authorAthira Rajeev <atrajeev@linux.ibm.com>
Tue, 25 Feb 2025 11:31:57 +0000 (17:01 +0530)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 27 Feb 2025 16:46:45 +0000 (08:46 -0800)
commit2337b7251dd5d3c58af877e6eee85a594c6b51f5
tree360ada00c26bd0a0f0836b6aee5c45840206cc39
parent5c496f1d67805fcf6bc2b88b3e4938016b50997c
perf trace: Add missing perf_tool__init()

Perf trace on perf.data fails as below:

./perf trace record -- sleep 1
./perf trace -i perf.data
perf: Segmentation fault
Segmentation fault (core dumped)

Backtrace pointed to :
?? ()
perf_session.process_user_event ()
reader.read_event ()
perf_session.process_events ()
cmd_trace ()
run_builtin ()
handle_internal_command ()
main ()

Further debug pointed that, segmentation fault happens when
trying to access id_index. Code snippet:

case PERF_RECORD_ID_INDEX:
err = tool->id_index(session, event);

Since 'commit 15d4a6f41d72 ("perf tool: Remove
perf_tool__fill_defaults()")', perf_tool__fill_defaults is
removed. All tools are initialized using perf_tool__init()
prior to use. But in builtin-trace, perf_tool__init is not
used and hence the defaults are not initialized. Use
perf_tool__init() in perf trace to handle the initialization.

Reported-by: Tejas Manhas <Tejas.Manhas1@ibm.com>
Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
Link: https://lore.kernel.org/r/20250225113157.28836-1-atrajeev@linux.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/builtin-trace.c