blob: 93668f38f1ed9306adf97b56cc9175a0b53cd379 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Arnaldo Carvalho de Melo7b2567c2010-02-03 16:52:04 -02002#ifndef PERF_BUILD_ID_H_
3#define PERF_BUILD_ID_H_ 1
4
Masami Hiramatsud77fac72015-07-15 18:14:28 +09005#define BUILD_ID_SIZE 20
6#define SBUILD_ID_SIZE (BUILD_ID_SIZE * 2 + 1)
Jiri Olsa4383db82012-10-27 23:18:29 +02007
8#include "tool.h"
Borislav Petkovd944c4e2014-04-25 21:31:02 +02009#include <linux/types.h>
Arnaldo Carvalho de Melo7b2567c2010-02-03 16:52:04 -020010
Arnaldo Carvalho de Melo40f3b2d2019-01-22 11:24:34 -020011struct nsinfo;
12
Arnaldo Carvalho de Melo45694aa2011-11-28 08:30:20 -020013extern struct perf_tool build_id__mark_dso_hit_ops;
Jiri Olsa4383db82012-10-27 23:18:29 +020014struct dso;
David Carrillo-Cisnerosccebbeb2017-07-17 21:25:39 -070015struct feat_fd;
Arnaldo Carvalho de Melo7b2567c2010-02-03 16:52:04 -020016
Jiri Olsaebb296c2012-10-27 23:18:28 +020017int build_id__sprintf(const u8 *build_id, int len, char *bf);
Masami Hiramatsu0b5a7932015-08-15 20:42:59 +090018int sysfs__sprintf_build_id(const char *root_dir, char *sbuild_id);
19int filename__sprintf_build_id(const char *pathname, char *sbuild_id);
Masami Hiramatsu01412262016-05-29 00:15:37 +090020char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf,
21 size_t size);
Masami Hiramatsu0b5a7932015-08-15 20:42:59 +090022
Krister Johansend2396992017-07-05 18:48:13 -070023char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size,
24 bool is_debug);
Arnaldo Carvalho de Melob36f19d2010-05-20 12:15:33 -030025
Andrew Vagin54a3cf52012-08-07 16:56:05 +040026int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
27 struct perf_sample *sample, struct perf_evsel *evsel,
28 struct machine *machine);
Namhyung Kime195fac2014-11-04 10:14:30 +090029
30int dsos__hit_all(struct perf_session *session);
31
32bool perf_session__read_build_ids(struct perf_session *session, bool with_hits);
David Carrillo-Cisnerosccebbeb2017-07-17 21:25:39 -070033int perf_session__write_buildid_table(struct perf_session *session,
34 struct feat_fd *fd);
Namhyung Kime195fac2014-11-04 10:14:30 +090035int perf_session__cache_build_ids(struct perf_session *session);
36
Masami Hiramatsu1f3736c2016-07-01 17:03:26 +090037char *build_id_cache__origname(const char *sbuild_id);
38char *build_id_cache__linkname(const char *sbuild_id, char *bf, size_t size);
Masami Hiramatsu4698b8b2016-06-08 18:29:30 +090039char *build_id_cache__cachedir(const char *sbuild_id, const char *name,
Krister Johansenf045b8c2017-07-05 18:48:11 -070040 struct nsinfo *nsi, bool is_kallsyms,
41 bool is_vdso);
Arnaldo Carvalho de Melo8ec20b12017-04-18 10:57:25 -030042
43struct strlist;
44
Masami Hiramatsuc3492a32016-07-12 19:04:54 +090045struct strlist *build_id_cache__list_all(bool validonly);
Masami Hiramatsua5981802016-07-12 19:05:37 +090046char *build_id_cache__complement(const char *incomplete_sbuild_id);
Krister Johansenf045b8c2017-07-05 18:48:11 -070047int build_id_cache__list_build_ids(const char *pathname, struct nsinfo *nsi,
Masami Hiramatsu8d8c8e42015-02-27 13:50:26 +090048 struct strlist **result);
Masami Hiramatsua50d11a2015-02-26 15:54:40 +090049bool build_id_cache__cached(const char *sbuild_id);
Masami Hiramatsue35f7362015-02-10 18:18:51 +090050int build_id_cache__add_s(const char *sbuild_id,
Krister Johansenf045b8c2017-07-05 18:48:11 -070051 const char *name, struct nsinfo *nsi,
52 bool is_kallsyms, bool is_vdso);
Masami Hiramatsue35f7362015-02-10 18:18:51 +090053int build_id_cache__remove_s(const char *sbuild_id);
Arnaldo Carvalho de Melo6db81642017-04-25 11:45:59 -030054
55extern char buildid_dir[];
56
57void set_buildid_dir(const char *dir);
Namhyung Kim73c5d222014-11-07 22:57:56 +090058void disable_buildid_cache(void);
Namhyung Kime195fac2014-11-04 10:14:30 +090059
Arnaldo Carvalho de Melo7b2567c2010-02-03 16:52:04 -020060#endif