Skip to content

Commit 2337b72

Browse files
Athira Rajeevnamhyung
authored andcommitted
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 15d4a6f ("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 <[email protected]> Signed-off-by: Athira Rajeev <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 5c496f1 commit 2337b72

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/perf/builtin-trace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4589,6 +4589,7 @@ static int trace__replay(struct trace *trace)
45894589
struct evsel *evsel;
45904590
int err = -1;
45914591

4592+
perf_tool__init(&trace->tool, /*ordered_events=*/true);
45924593
trace->tool.sample = trace__process_sample;
45934594
trace->tool.mmap = perf_event__process_mmap;
45944595
trace->tool.mmap2 = perf_event__process_mmap2;

0 commit comments

Comments
 (0)