Skip to content

Commit 8dfdf44

Browse files
olsajiriacmel
authored andcommitted
perf tools: Pass build_id object to dso__set_build_id()
Passing build_id object to dso__set_build_id(), so it's easier to initialize dos's build id object. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20201013192441.1299447-6-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent bf54116 commit 8dfdf44

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

tools/perf/util/dso.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,9 +1326,9 @@ void dso__put(struct dso *dso)
13261326
dso__delete(dso);
13271327
}
13281328

1329-
void dso__set_build_id(struct dso *dso, void *build_id)
1329+
void dso__set_build_id(struct dso *dso, struct build_id *bid)
13301330
{
1331-
memcpy(dso->bid.data, build_id, sizeof(dso->bid.data));
1331+
dso->bid = *bid;
13321332
dso->has_build_id = 1;
13331333
}
13341334

tools/perf/util/dso.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ bool dso__sorted_by_name(const struct dso *dso);
260260
void dso__set_sorted_by_name(struct dso *dso);
261261
void dso__sort_by_name(struct dso *dso);
262262

263-
void dso__set_build_id(struct dso *dso, void *build_id);
263+
void dso__set_build_id(struct dso *dso, struct build_id *bid);
264264
bool dso__build_id_equal(const struct dso *dso, u8 *build_id);
265265
void dso__read_running_kernel_build_id(struct dso *dso,
266266
struct machine *machine);

tools/perf/util/header.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2082,8 +2082,10 @@ static int __event_process_build_id(struct perf_record_header_build_id *bev,
20822082
dso = machine__findnew_dso(machine, filename);
20832083
if (dso != NULL) {
20842084
char sbuild_id[SBUILD_ID_SIZE];
2085+
struct build_id bid;
20852086

2086-
dso__set_build_id(dso, &bev->build_id);
2087+
build_id__init(&bid, bev->build_id, BUILD_ID_SIZE);
2088+
dso__set_build_id(dso, &bid);
20872089

20882090
if (dso_space != DSO_SPACE__USER) {
20892091
struct kmod_path m = { .name = NULL, };

tools/perf/util/symbol-minimal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ int dso__load_sym(struct dso *dso, struct map *map __maybe_unused,
349349
dso->is_64_bit = ret;
350350

351351
if (filename__read_build_id(ss->name, &bid) > 0)
352-
dso__set_build_id(dso, bid.data);
352+
dso__set_build_id(dso, &bid);
353353
return 0;
354354
}
355355

tools/perf/util/symbol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ int dso__load(struct dso *dso, struct map *map)
18181818
is_regular_file(dso->long_name)) {
18191819
__symbol__join_symfs(name, PATH_MAX, dso->long_name);
18201820
if (filename__read_build_id(name, &bid) > 0)
1821-
dso__set_build_id(dso, bid.data);
1821+
dso__set_build_id(dso, &bid);
18221822
}
18231823

18241824
/*

0 commit comments

Comments
 (0)