^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef PERF_BUILD_ID_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define PERF_BUILD_ID_H_ 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #define BUILD_ID_SIZE 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define SBUILD_ID_SIZE (BUILD_ID_SIZE * 2 + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include "tool.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct build_id {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) u8 data[BUILD_ID_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) size_t size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct nsinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) extern struct perf_tool build_id__mark_dso_hit_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct dso;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct feat_fd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) void build_id__init(struct build_id *bid, const u8 *data, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int build_id__sprintf(const struct build_id *build_id, char *bf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) int sysfs__sprintf_build_id(const char *root_dir, char *sbuild_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int filename__sprintf_build_id(const char *pathname, char *sbuild_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) bool is_debug);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct perf_sample *sample, struct evsel *evsel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct machine *machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int dsos__hit_all(struct perf_session *session);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int perf_event__inject_buildid(struct perf_tool *tool, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct perf_sample *sample, struct evsel *evsel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct machine *machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) bool perf_session__read_build_ids(struct perf_session *session, bool with_hits);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) int perf_session__write_buildid_table(struct perf_session *session,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct feat_fd *fd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int perf_session__cache_build_ids(struct perf_session *session);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) char *build_id_cache__origname(const char *sbuild_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) char *build_id_cache__linkname(const char *sbuild_id, char *bf, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) char *build_id_cache__cachedir(const char *sbuild_id, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct nsinfo *nsi, bool is_kallsyms,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) bool is_vdso);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct strlist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct strlist *build_id_cache__list_all(bool validonly);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) char *build_id_cache__complement(const char *incomplete_sbuild_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int build_id_cache__list_build_ids(const char *pathname, struct nsinfo *nsi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct strlist **result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) bool build_id_cache__cached(const char *sbuild_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) int build_id_cache__add_s(const char *sbuild_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) const char *name, struct nsinfo *nsi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) bool is_kallsyms, bool is_vdso);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) int build_id_cache__remove_s(const char *sbuild_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) extern char buildid_dir[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) void set_buildid_dir(const char *dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) void disable_buildid_cache(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #endif