xref: /openbmc/linux/tools/perf/util/build-id.h (revision 41e4b7dc)
1 #ifndef PERF_BUILD_ID_H_
2 #define PERF_BUILD_ID_H_ 1
3 
4 #define BUILD_ID_SIZE	20
5 #define SBUILD_ID_SIZE	(BUILD_ID_SIZE * 2 + 1)
6 
7 #include "tool.h"
8 #include "namespaces.h"
9 #include <linux/types.h>
10 
11 extern struct perf_tool build_id__mark_dso_hit_ops;
12 struct dso;
13 struct feat_fd;
14 
15 int build_id__sprintf(const u8 *build_id, int len, char *bf);
16 int sysfs__sprintf_build_id(const char *root_dir, char *sbuild_id);
17 int filename__sprintf_build_id(const char *pathname, char *sbuild_id);
18 char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf,
19 				    size_t size);
20 
21 char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size,
22 			     bool is_debug);
23 
24 int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
25 			   struct perf_sample *sample, struct perf_evsel *evsel,
26 			   struct machine *machine);
27 
28 int dsos__hit_all(struct perf_session *session);
29 
30 bool perf_session__read_build_ids(struct perf_session *session, bool with_hits);
31 int perf_session__write_buildid_table(struct perf_session *session,
32 				      struct feat_fd *fd);
33 int perf_session__cache_build_ids(struct perf_session *session);
34 
35 char *build_id_cache__origname(const char *sbuild_id);
36 char *build_id_cache__linkname(const char *sbuild_id, char *bf, size_t size);
37 char *build_id_cache__cachedir(const char *sbuild_id, const char *name,
38 			       struct nsinfo *nsi, bool is_kallsyms,
39 			       bool is_vdso);
40 
41 struct strlist;
42 
43 struct strlist *build_id_cache__list_all(bool validonly);
44 char *build_id_cache__complement(const char *incomplete_sbuild_id);
45 int build_id_cache__list_build_ids(const char *pathname, struct nsinfo *nsi,
46 				   struct strlist **result);
47 bool build_id_cache__cached(const char *sbuild_id);
48 int build_id_cache__add_s(const char *sbuild_id,
49 			  const char *name, struct nsinfo *nsi,
50 			  bool is_kallsyms, bool is_vdso);
51 int build_id_cache__remove_s(const char *sbuild_id);
52 
53 extern char buildid_dir[];
54 
55 void set_buildid_dir(const char *dir);
56 void disable_buildid_cache(void);
57 
58 #endif
59