Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^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_SYMBOL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define __PERF_SYMBOL 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/refcount.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <stdbool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <stdint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/rbtree.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include "path.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include "symbol_conf.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "spark.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #ifdef HAVE_LIBELF_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <libelf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <gelf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <elf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) struct dso;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) struct map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) struct maps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) struct option;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) struct build_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * for newer versions we can use mmap to reduce memory usage:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #ifdef ELF_C_READ_MMAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) # define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) # define PERF_ELF_C_READ_MMAP ELF_C_READ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #ifdef HAVE_LIBELF_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 			     GElf_Shdr *shp, const char *name, size_t *idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) /** struct symbol - symtab entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * @ignore - resolvable but tools ignore it (e.g. idle routines)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) struct symbol {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	struct rb_node	rb_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	u64		start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	u64		end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	u16		namelen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	u8		type:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	u8		binding:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	u8		idle:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	u8		ignore:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	u8		inlined:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	u8		arch_sym;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	bool		annotate2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	char		name[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) void symbol__delete(struct symbol *sym);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) void symbols__delete(struct rb_root_cached *symbols);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) /* symbols__for_each_entry - iterate over symbols (rb_root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * @symbols: the rb_root of symbols
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  * @pos: the 'struct symbol *' to use as a loop cursor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * @nd: the 'struct rb_node *' to use as a temporary storage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #define symbols__for_each_entry(symbols, pos, nd)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	for (nd = rb_first_cached(symbols);					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	     nd && (pos = rb_entry(nd, struct symbol, rb_node));	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	     nd = rb_next(nd))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) static inline size_t symbol__size(const struct symbol *sym)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	return sym->end - sym->start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) struct strlist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) struct intlist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) struct symbol_name_rb_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	struct rb_node	rb_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	struct symbol	sym;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) static inline int __symbol__join_symfs(char *bf, size_t size, const char *path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	return path__join(bf, size, symbol_conf.symfs, path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #define symbol__join_symfs(bf, path) __symbol__join_symfs(bf, sizeof(bf), path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) extern int vmlinux_path__nr_entries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) extern char **vmlinux_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) static inline void *symbol__priv(struct symbol *sym)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	return ((void *)sym) - symbol_conf.priv_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct ref_reloc_sym {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	const char	*name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	u64		addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	u64		unrelocated_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) struct addr_location {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	struct thread *thread;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	struct maps   *maps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	struct map    *map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	struct symbol *sym;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	const char    *srcline;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	u64	      addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	char	      level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	u8	      filtered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	u8	      cpumode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	s32	      cpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	s32	      socket;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) int dso__load(struct dso *dso, struct map *map);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) int dso__load_vmlinux(struct dso *dso, struct map *map,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		      const char *vmlinux, bool vmlinux_allocated);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int dso__load_vmlinux_path(struct dso *dso, struct map *map);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) int __dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 			 bool no_kcore);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) void dso__insert_symbol(struct dso *dso,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 			struct symbol *sym);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) void dso__delete_symbol(struct dso *dso,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 			struct symbol *sym);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct symbol *dso__find_symbol(struct dso *dso, u64 addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) struct symbol *symbol__next_by_name(struct symbol *sym);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct symbol *dso__first_symbol(struct dso *dso);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct symbol *dso__last_symbol(struct dso *dso);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) struct symbol *dso__next_symbol(struct symbol *sym);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) enum dso_type dso__type_fd(int fd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) int filename__read_build_id(const char *filename, struct build_id *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) int sysfs__read_build_id(const char *filename, struct build_id *bid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) int modules__parse(const char *filename, void *arg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		   int (*process_module)(void *arg, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 					 u64 start, u64 size));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) int filename__read_debuglink(const char *filename, char *debuglink,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 			     size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) struct perf_env;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) int symbol__init(struct perf_env *env);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) void symbol__exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) void symbol__elf_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) int symbol__annotation_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct symbol *symbol__new(u64 start, u64 len, u8 binding, u8 type, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) size_t __symbol__fprintf_symname_offs(const struct symbol *sym,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 				      const struct addr_location *al,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 				      bool unknown_as_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 				      bool print_offsets, FILE *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) size_t symbol__fprintf_symname_offs(const struct symbol *sym,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 				    const struct addr_location *al, FILE *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) size_t __symbol__fprintf_symname(const struct symbol *sym,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 				 const struct addr_location *al,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 				 bool unknown_as_addr, FILE *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) size_t symbol__fprintf(struct symbol *sym, FILE *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) bool symbol__restricted_filename(const char *filename,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 				 const char *restricted_filename);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) int symbol__config_symfs(const struct option *opt __maybe_unused,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 			 const char *dir, int unset __maybe_unused);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) struct symsrc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #ifdef HAVE_LIBBFD_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) int dso__load_bfd_symbols(struct dso *dso, const char *debugfile);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		  struct symsrc *runtime_ss, int kmodule);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) char *dso__demangle_sym(struct dso *dso, int kmodule, const char *elf_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) void __symbols__insert(struct rb_root_cached *symbols, struct symbol *sym,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		       bool kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) void symbols__insert(struct rb_root_cached *symbols, struct symbol *sym);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) void symbols__fixup_duplicate(struct rb_root_cached *symbols);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) void symbols__fixup_end(struct rb_root_cached *symbols);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) void maps__fixup_end(struct maps *maps);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) typedef int (*mapfn_t)(u64 start, u64 len, u64 pgoff, void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) int file__read_maps(int fd, bool exe, mapfn_t mapfn, void *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		    bool *is_64_bit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #define PERF_KCORE_EXTRACT "/tmp/perf-kcore-XXXXXX"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) struct kcore_extract {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	char *kcore_filename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	u64 addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	u64 offs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	u64 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	char extract_filename[sizeof(PERF_KCORE_EXTRACT)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	int fd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) int kcore_extract__create(struct kcore_extract *kce);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) void kcore_extract__delete(struct kcore_extract *kce);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) int kcore_copy(const char *from_dir, const char *to_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) int compare_proc_modules(const char *from, const char *to);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) int setup_list(struct strlist **list, const char *list_str,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	       const char *list_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) int setup_intlist(struct intlist **list, const char *list_str,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		  const char *list_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) #ifdef HAVE_LIBELF_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) bool elf__needs_adjust_symbols(GElf_Ehdr ehdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) void arch__sym_update(struct symbol *s, GElf_Sym *sym);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) const char *arch__normalize_symbol_name(const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) #define SYMBOL_A 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) #define SYMBOL_B 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) void arch__symbols__fixup_end(struct symbol *p, struct symbol *c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) int arch__compare_symbol_names(const char *namea, const char *nameb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) int arch__compare_symbol_names_n(const char *namea, const char *nameb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 				 unsigned int n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) int arch__choose_best_symbol(struct symbol *syma, struct symbol *symb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) enum symbol_tag_include {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	SYMBOL_TAG_INCLUDE__NONE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	SYMBOL_TAG_INCLUDE__DEFAULT_ONLY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) int symbol__match_symbol_name(const char *namea, const char *nameb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 			      enum symbol_tag_include includes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) /* structure containing an SDT note's info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) struct sdt_note {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	char *name;			/* name of the note*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	char *provider;			/* provider name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	char *args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	bool bit32;			/* whether the location is 32 bits? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	union {				/* location, base and semaphore addrs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		Elf64_Addr a64[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		Elf32_Addr a32[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	} addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	struct list_head note_list;	/* SDT notes' list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) int get_sdt_note_list(struct list_head *head, const char *target);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) int cleanup_sdt_note_list(struct list_head *sdt_notes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) int sdt_notes__get_count(struct list_head *start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) #define SDT_PROBES_SCN ".probes"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) #define SDT_BASE_SCN ".stapsdt.base"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) #define SDT_NOTE_SCN  ".note.stapsdt"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) #define SDT_NOTE_TYPE 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) #define SDT_NOTE_NAME "stapsdt"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) #define NR_ADDR 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	SDT_NOTE_IDX_LOC = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	SDT_NOTE_IDX_BASE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	SDT_NOTE_IDX_REFCTR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) struct mem_info *mem_info__new(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) struct mem_info *mem_info__get(struct mem_info *mi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) void   mem_info__put(struct mem_info *mi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) static inline void __mem_info__zput(struct mem_info **mi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	mem_info__put(*mi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	*mi = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) #define mem_info__zput(mi) __mem_info__zput(&mi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) #endif /* __PERF_SYMBOL */