int typeflag, struct FTW *ftwbuf __maybe_unused)
{
struct bench_dso *dso = &dsos[nr_dsos];
- unsigned char build_id[BUILD_ID_SIZE];
+ struct build_id bid;
if (typeflag == FTW_D || typeflag == FTW_SL)
return 0;
- if (filename__read_build_id(fpath, build_id, BUILD_ID_SIZE) < 0)
+ if (filename__read_build_id(fpath, bid.data, sizeof(bid.data)) < 0)
return 0;
dso->name = realpath(fpath, NULL);
pr_warning("Problems with %s file, consider removing it from the cache\n",
filename);
- } else if (memcmp(dso->build_id, build_id, sizeof(dso->build_id))) {
+ } else if (memcmp(dso->bid.data, build_id, sizeof(dso->bid.data))) {
pr_warning("Problems with %s file, consider removing it from the cache\n",
filename);
}
return 0;
nsinfo__mountns_enter(dso->nsinfo, &nsc);
- if (filename__read_build_id(dso->long_name, dso->build_id,
- sizeof(dso->build_id)) > 0) {
+ if (filename__read_build_id(dso->long_name, dso->bid.data,
+ sizeof(dso->bid.data)) > 0) {
dso->has_build_id = true;
}
nsinfo__mountns_exit(&nsc);
char *build_id_msg = NULL;
if (dso->has_build_id) {
- build_id__sprintf(dso->build_id,
- sizeof(dso->build_id), bf + 15);
+ build_id__sprintf(dso->bid.data,
+ sizeof(dso->bid.data), bf + 15);
build_id_msg = bf;
}
scnprintf(buf, buflen,
if (!dso->has_build_id)
return NULL;
- build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
+ build_id__sprintf(dso->bid.data, sizeof(dso->bid.data), sbuild_id);
linkname = build_id_cache__linkname(sbuild_id, NULL, 0);
if (!linkname)
return NULL;
in_kernel = pos->kernel ||
is_kernel_module(name,
PERF_RECORD_MISC_CPUMODE_UNKNOWN);
- err = write_buildid(name, name_len, pos->build_id, machine->pid,
+ err = write_buildid(name, name_len, pos->bid.data, machine->pid,
in_kernel ? kmisc : umisc, fd);
if (err)
break;
is_kallsyms = true;
name = machine->mmap_name;
}
- return build_id_cache__add_b(dso->build_id, sizeof(dso->build_id), name,
+ return build_id_cache__add_b(dso->bid.data, sizeof(dso->bid.data), name,
dso->nsinfo, is_kallsyms, is_vdso);
}
#include "tool.h"
#include <linux/types.h>
+struct build_id {
+ u8 data[BUILD_ID_SIZE];
+ size_t size;
+};
+
struct nsinfo;
extern struct perf_tool build_id__mark_dso_hit_ops;
break;
}
- build_id__sprintf(dso->build_id,
- sizeof(dso->build_id),
+ build_id__sprintf(dso->bid.data,
+ sizeof(dso->bid.data),
build_id_hex);
len = __symbol__join_symfs(filename, size, "/usr/lib/debug/.build-id/");
snprintf(filename + len, size - len, "%.2s/%s.debug",
void dso__set_build_id(struct dso *dso, void *build_id)
{
- memcpy(dso->build_id, build_id, sizeof(dso->build_id));
+ memcpy(dso->bid.data, build_id, sizeof(dso->bid.data));
dso->has_build_id = 1;
}
bool dso__build_id_equal(const struct dso *dso, u8 *build_id)
{
- return memcmp(dso->build_id, build_id, sizeof(dso->build_id)) == 0;
+ return memcmp(dso->bid.data, build_id, sizeof(dso->bid.data)) == 0;
}
void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine)
if (machine__is_default_guest(machine))
return;
sprintf(path, "%s/sys/kernel/notes", machine->root_dir);
- if (sysfs__read_build_id(path, dso->build_id,
- sizeof(dso->build_id)) == 0)
+ if (sysfs__read_build_id(path, dso->bid.data,
+ sizeof(dso->bid.data)) == 0)
dso->has_build_id = true;
}
"%s/sys/module/%.*s/notes/.note.gnu.build-id",
root_dir, (int)strlen(name) - 1, name);
- if (sysfs__read_build_id(filename, dso->build_id,
- sizeof(dso->build_id)) == 0)
+ if (sysfs__read_build_id(filename, dso->bid.data,
+ sizeof(dso->bid.data)) == 0)
dso->has_build_id = true;
return 0;
{
char sbuild_id[SBUILD_ID_SIZE];
- build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
+ build_id__sprintf(dso->bid.data, sizeof(dso->bid.data), sbuild_id);
return fprintf(fp, "%s", sbuild_id);
}
bool sorted_by_name;
bool loaded;
u8 rel;
- u8 build_id[BUILD_ID_SIZE];
+ struct build_id bid;
u64 text_offset;
const char *short_name;
const char *long_name;
continue;
}
nsinfo__mountns_enter(pos->nsinfo, &nsc);
- if (filename__read_build_id(pos->long_name, pos->build_id,
- sizeof(pos->build_id)) > 0) {
+ if (filename__read_build_id(pos->long_name, pos->bid.data,
+ sizeof(pos->bid.data)) > 0) {
have_build_id = true;
pos->has_build_id = true;
}
free(m.name);
}
- build_id__sprintf(dso->build_id, sizeof(dso->build_id),
+ build_id__sprintf(dso->bid.data, sizeof(dso->bid.data),
sbuild_id);
pr_debug("build id event received for %s: %s\n",
dso->long_name, sbuild_id);
if (map->dso->has_build_id) {
char sbuild_id[SBUILD_ID_SIZE];
- build_id__sprintf(map->dso->build_id,
- sizeof(map->dso->build_id),
+ build_id__sprintf(map->dso->bid.data,
+ sizeof(map->dso->bid.data),
sbuild_id);
pr_debug("%s with build id %s not found", name, sbuild_id);
} else
if (!c)
return NULL;
- build_id__sprintf(dso->build_id, BUILD_ID_SIZE, sbuild_id);
+ build_id__sprintf(dso->bid.data, BUILD_ID_SIZE, sbuild_id);
fd = debuginfod_find_debuginfo(c, (const unsigned char *)sbuild_id,
0, &path);
if (fd >= 0)
char sbuild_id[SBUILD_ID_SIZE];
PyObject *t;
- build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
+ build_id__sprintf(dso->bid.data, sizeof(dso->bid.data), sbuild_id);
t = tuple_new(5);
goto proc_kallsyms;
}
- build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
+ build_id__sprintf(dso->bid.data, sizeof(dso->bid.data), sbuild_id);
/* Find kallsyms in build-id cache with kcore */
scnprintf(path, sizeof(path), "%s/%s/%s",
len = pos->long_name_len + 1;
len = PERF_ALIGN(len, NAME_ALIGN);
- memcpy(&ev.build_id.build_id, pos->build_id, sizeof(pos->build_id));
+ memcpy(&ev.build_id.build_id, pos->bid.data, sizeof(pos->bid.data));
ev.build_id.header.type = PERF_RECORD_HEADER_BUILD_ID;
ev.build_id.header.misc = misc;
ev.build_id.pid = machine->pid;