2 #define __PERF_SYMBOL 1
4 #include <linux/types.h>
8 #include <linux/list.h>
9 #include <linux/rbtree.h>
12 #define DEBUG_CACHE_DIR ".debug"
14 #ifdef HAVE_CPLUS_DEMANGLE
15 extern char *cplus_demangle(const char *, int);
17 static inline char *bfd_demangle(void __used
*v
, const char *c
, int i
)
19 return cplus_demangle(c
, i
);
23 static inline char *bfd_demangle(void __used
*v
, const char __used
*c
,
33 int hex2u64(const char *ptr
, u64
*val
);
34 char *strxfrchar(char *s
, char from
, char to
);
37 * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
38 * for newer versions we can use mmap to reduce memory usage:
41 # define PERF_ELF_C_READ_MMAP ELF_C_READ
43 # define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
47 #define DMGL_PARAMS (1 << 0) /* Include function args */
48 #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
51 #define BUILD_ID_SIZE 20
54 struct rb_node rb_node
;
60 void symbol__delete(struct symbol
*self
);
65 unsigned short priv_size
;
66 bool try_vmlinux_path
,
74 const char *vmlinux_name
,
76 const char *default_guest_vmlinux_name
,
77 *default_guest_kallsyms
,
78 *default_guest_modules
;
79 const char *guestmount
;
84 struct strlist
*dso_list
,
89 extern struct symbol_conf symbol_conf
;
91 static inline void *symbol__priv(struct symbol
*self
)
93 return ((void *)self
) - symbol_conf
.priv_size
;
96 struct ref_reloc_sym
{
107 struct addr_location
{
108 struct thread
*thread
;
114 unsigned int cpumode
;
117 enum dso_kernel_type
{
120 DSO_TYPE_GUEST_KERNEL
124 struct list_head node
;
125 struct rb_root symbols
[MAP__NR_TYPES
];
126 struct rb_root symbol_names
[MAP__NR_TYPES
];
128 u8 slen_calculated
:1;
130 enum dso_kernel_type kernel
;
132 u8 annotate_warned
:1;
133 unsigned char origin
;
136 u8 build_id
[BUILD_ID_SIZE
];
137 const char *short_name
;
144 struct dso
*dso__new(const char *name
);
145 struct dso
*dso__new_kernel(const char *name
);
146 void dso__delete(struct dso
*self
);
148 bool dso__loaded(const struct dso
*self
, enum map_type type
);
149 bool dso__sorted_by_name(const struct dso
*self
, enum map_type type
);
151 static inline void dso__set_loaded(struct dso
*self
, enum map_type type
)
153 self
->loaded
|= (1 << type
);
156 void dso__sort_by_name(struct dso
*self
, enum map_type type
);
158 struct dso
*__dsos__findnew(struct list_head
*head
, const char *name
);
160 int dso__load(struct dso
*self
, struct map
*map
, symbol_filter_t filter
);
161 int dso__load_vmlinux_path(struct dso
*self
, struct map
*map
,
162 symbol_filter_t filter
);
163 int dso__load_kallsyms(struct dso
*self
, const char *filename
, struct map
*map
,
164 symbol_filter_t filter
);
165 void dsos__fprintf(struct rb_root
*kerninfo_root
, FILE *fp
);
166 size_t dsos__fprintf_buildid(struct rb_root
*kerninfo_root
,
167 FILE *fp
, bool with_hits
);
169 size_t dso__fprintf_buildid(struct dso
*self
, FILE *fp
);
170 size_t dso__fprintf(struct dso
*self
, enum map_type type
, FILE *fp
);
173 DSO__ORIG_KERNEL
= 0,
174 DSO__ORIG_GUEST_KERNEL
,
176 DSO__ORIG_BUILD_ID_CACHE
,
181 DSO__ORIG_GUEST_KMODULE
,
186 char dso__symtab_origin(const struct dso
*self
);
187 void dso__set_long_name(struct dso
*self
, char *name
);
188 void dso__set_build_id(struct dso
*self
, void *build_id
);
189 void dso__read_running_kernel_build_id(struct dso
*self
,
190 struct kernel_info
*kerninfo
);
191 struct symbol
*dso__find_symbol(struct dso
*self
, enum map_type type
, u64 addr
);
192 struct symbol
*dso__find_symbol_by_name(struct dso
*self
, enum map_type type
,
195 int filename__read_build_id(const char *filename
, void *bf
, size_t size
);
196 int sysfs__read_build_id(const char *filename
, void *bf
, size_t size
);
197 bool __dsos__read_build_ids(struct list_head
*head
, bool with_hits
);
198 int build_id__sprintf(const u8
*self
, int len
, char *bf
);
199 int kallsyms__parse(const char *filename
, void *arg
,
200 int (*process_symbol
)(void *arg
, const char *name
,
201 char type
, u64 start
));
203 int __map_groups__create_kernel_maps(struct map_groups
*self
,
204 struct map
*vmlinux_maps
[MAP__NR_TYPES
],
206 int map_groups__create_kernel_maps(struct rb_root
*kerninfo_root
, pid_t pid
);
207 int map_groups__create_guest_kernel_maps(struct rb_root
*kerninfo_root
);
209 int symbol__init(void);
210 bool symbol_type__is_a(char symbol_type
, enum map_type map_type
);
212 size_t vmlinux_path__fprintf(FILE *fp
);
214 #endif /* __PERF_SYMBOL */