Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
8dfdf440 bf541169

+8 -6
+2 -2
tools/perf/util/dso.c
··· 1326 1326 dso__delete(dso); 1327 1327 } 1328 1328 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) 1330 1330 { 1331 - memcpy(dso->bid.data, build_id, sizeof(dso->bid.data)); 1331 + dso->bid = *bid; 1332 1332 dso->has_build_id = 1; 1333 1333 } 1334 1334
+1 -1
tools/perf/util/dso.h
··· 260 260 void dso__set_sorted_by_name(struct dso *dso); 261 261 void dso__sort_by_name(struct dso *dso); 262 262 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); 264 264 bool dso__build_id_equal(const struct dso *dso, u8 *build_id); 265 265 void dso__read_running_kernel_build_id(struct dso *dso, 266 266 struct machine *machine);
+3 -1
tools/perf/util/header.c
··· 2082 2082 dso = machine__findnew_dso(machine, filename); 2083 2083 if (dso != NULL) { 2084 2084 char sbuild_id[SBUILD_ID_SIZE]; 2085 + struct build_id bid; 2085 2086 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); 2087 2089 2088 2090 if (dso_space != DSO_SPACE__USER) { 2089 2091 struct kmod_path m = { .name = NULL, };
+1 -1
tools/perf/util/symbol-minimal.c
··· 349 349 dso->is_64_bit = ret; 350 350 351 351 if (filename__read_build_id(ss->name, &bid) > 0) 352 - dso__set_build_id(dso, bid.data); 352 + dso__set_build_id(dso, &bid); 353 353 return 0; 354 354 } 355 355
+1 -1
tools/perf/util/symbol.c
··· 1818 1818 is_regular_file(dso->long_name)) { 1819 1819 __symbol__join_symfs(name, PATH_MAX, dso->long_name); 1820 1820 if (filename__read_build_id(name, &bid) > 0) 1821 - dso__set_build_id(dso, bid.data); 1821 + dso__set_build_id(dso, &bid); 1822 1822 } 1823 1823 1824 1824 /*