diff options
author | Namhyung Kim <[email protected]> | 2022-11-18 16:27:50 -0800 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2022-11-23 10:34:40 -0300 |
commit | 19030564ab116757e3270a567fd9d5b20b411d74 (patch) | |
tree | 8735c003d38ec834ca5198709788e9162afa9be8 | |
parent | 7d54a4acd8c1de3ea70d31424757dcdb7f0a231a (diff) |
perf inject: Set PERF_RECORD_MISC_BUILD_ID_SIZE
With perf inject -b, it synthesizes build-id event for DSOs. But it
missed to set the size and resulted in having trailing zeros.
As perf record sets the size in write_build_id(), let's set the size
here as well.
Signed-off-by: Namhyung Kim <[email protected]>
Acked-by: Adrian Hunter <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/util/synthetic-events.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c index cccd293b5312..0645795ff080 100644 --- a/tools/perf/util/synthetic-events.c +++ b/tools/perf/util/synthetic-events.c @@ -2218,8 +2218,9 @@ int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *pos, u16 len = pos->long_name_len + 1; len = PERF_ALIGN(len, NAME_ALIGN); memcpy(&ev.build_id.build_id, pos->bid.data, sizeof(pos->bid.data)); + ev.build_id.size = pos->bid.size; ev.build_id.header.type = PERF_RECORD_HEADER_BUILD_ID; - ev.build_id.header.misc = misc; + ev.build_id.header.misc = misc | PERF_RECORD_MISC_BUILD_ID_SIZE; ev.build_id.pid = machine->pid; ev.build_id.header.size = sizeof(ev.build_id) + len; memcpy(&ev.build_id.filename, pos->long_name, pos->long_name_len); |