]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
perf tools: Pass build_id object to dso__set_build_id()
authorJiri Olsa <jolsa@kernel.org>
Tue, 13 Oct 2020 19:24:37 +0000 (21:24 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 14 Oct 2020 11:46:42 +0000 (08:46 -0300)
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>
tools/perf/util/dso.c
tools/perf/util/dso.h
tools/perf/util/header.c
tools/perf/util/symbol-minimal.c
tools/perf/util/symbol.c

index 2f7f01ead9a1ca531f294ce4cde8a008dc42d36c..4415ce83150bcf6597a5a7bf83f18651652dd98d 100644 (file)
@@ -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;
 }
 
index eac004210b47b0818c923da72fa701125ff5577b..5a5678dbdaa5d4458a982d23c712fc06f33eecff 100644 (file)
@@ -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);
index fe220f01fc949d03251b67e84be990d235f8596c..21243adbb9fd7a31b000fd0862ab4d9b08b7e5af 100644 (file)
@@ -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, };
index dba6b9e5d64e41a6893e6ce8662cd9914fec68ab..f9eb0bee7f157a971ff514496ddc0b69c0aa3ee3 100644 (file)
@@ -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;
 }
 
index 369cbad09f0ddab74c9f1d3afdee0a7f88fe5183..976632d0baa0406b8fd73c951e3789b9e6c56bb0 100644 (file)
@@ -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);
        }
 
        /*