Skip to content

Commit

Permalink
perf tools: Pass build_id object to dso__set_build_id()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Oct 14, 2020
1 parent bf54116 commit 8dfdf44
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tools/perf/util/dso.c
Original file line number Diff line number Diff line change
Expand Up @@ -1326,9 +1326,9 @@ void dso__put(struct dso *dso)
dso__delete(dso);
}

void dso__set_build_id(struct dso *dso, void *build_id)
void dso__set_build_id(struct dso *dso, struct build_id *bid)
{
memcpy(dso->bid.data, build_id, sizeof(dso->bid.data));
dso->bid = *bid;
dso->has_build_id = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/dso.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ bool dso__sorted_by_name(const struct dso *dso);
void dso__set_sorted_by_name(struct dso *dso);
void dso__sort_by_name(struct dso *dso);

void dso__set_build_id(struct dso *dso, void *build_id);
void dso__set_build_id(struct dso *dso, struct build_id *bid);
bool dso__build_id_equal(const struct dso *dso, u8 *build_id);
void dso__read_running_kernel_build_id(struct dso *dso,
struct machine *machine);
Expand Down
4 changes: 3 additions & 1 deletion tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -2082,8 +2082,10 @@ static int __event_process_build_id(struct perf_record_header_build_id *bev,
dso = machine__findnew_dso(machine, filename);
if (dso != NULL) {
char sbuild_id[SBUILD_ID_SIZE];
struct build_id bid;

dso__set_build_id(dso, &bev->build_id);
build_id__init(&bid, bev->build_id, BUILD_ID_SIZE);
dso__set_build_id(dso, &bid);

if (dso_space != DSO_SPACE__USER) {
struct kmod_path m = { .name = NULL, };
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/symbol-minimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ int dso__load_sym(struct dso *dso, struct map *map __maybe_unused,
dso->is_64_bit = ret;

if (filename__read_build_id(ss->name, &bid) > 0)
dso__set_build_id(dso, bid.data);
dso__set_build_id(dso, &bid);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,7 @@ int dso__load(struct dso *dso, struct map *map)
is_regular_file(dso->long_name)) {
__symbol__join_symfs(name, PATH_MAX, dso->long_name);
if (filename__read_build_id(name, &bid) > 0)
dso__set_build_id(dso, bid.data);
dso__set_build_id(dso, &bid);
}

/*
Expand Down

0 comments on commit 8dfdf44

Please sign in to comment.