aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/symbol.h')
-rw-r--r--tools/perf/util/symbol.h118
1 files changed, 66 insertions, 52 deletions
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index ea95c2756f05..325ee36a9d29 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -48,16 +48,21 @@ char *strxfrchar(char *s, char from, char to);
48 48
49#define BUILD_ID_SIZE 20 49#define BUILD_ID_SIZE 20
50 50
51/** struct symbol - symtab entry
52 *
53 * @ignore - resolvable but tools ignore it (e.g. idle routines)
54 */
51struct symbol { 55struct symbol {
52 struct rb_node rb_node; 56 struct rb_node rb_node;
53 u64 start; 57 u64 start;
54 u64 end; 58 u64 end;
55 u16 namelen; 59 u16 namelen;
56 u8 binding; 60 u8 binding;
61 bool ignore;
57 char name[0]; 62 char name[0];
58}; 63};
59 64
60void symbol__delete(struct symbol *self); 65void symbol__delete(struct symbol *sym);
61 66
62struct strlist; 67struct strlist;
63 68
@@ -70,8 +75,10 @@ struct symbol_conf {
70 use_callchain, 75 use_callchain,
71 exclude_other, 76 exclude_other,
72 show_cpu_utilization, 77 show_cpu_utilization,
73 initialized; 78 initialized,
79 kptr_restrict;
74 const char *vmlinux_name, 80 const char *vmlinux_name,
81 *kallsyms_name,
75 *source_prefix, 82 *source_prefix,
76 *field_sep; 83 *field_sep;
77 const char *default_guest_vmlinux_name, 84 const char *default_guest_vmlinux_name,
@@ -85,13 +92,14 @@ struct symbol_conf {
85 struct strlist *dso_list, 92 struct strlist *dso_list,
86 *comm_list, 93 *comm_list,
87 *sym_list; 94 *sym_list;
95 const char *symfs;
88}; 96};
89 97
90extern struct symbol_conf symbol_conf; 98extern struct symbol_conf symbol_conf;
91 99
92static inline void *symbol__priv(struct symbol *self) 100static inline void *symbol__priv(struct symbol *sym)
93{ 101{
94 return ((void *)self) - symbol_conf.priv_size; 102 return ((void *)sym) - symbol_conf.priv_size;
95} 103}
96 104
97struct ref_reloc_sym { 105struct ref_reloc_sym {
@@ -130,13 +138,12 @@ struct dso {
130 struct rb_root symbol_names[MAP__NR_TYPES]; 138 struct rb_root symbol_names[MAP__NR_TYPES];
131 enum dso_kernel_type kernel; 139 enum dso_kernel_type kernel;
132 u8 adjust_symbols:1; 140 u8 adjust_symbols:1;
133 u8 slen_calculated:1;
134 u8 has_build_id:1; 141 u8 has_build_id:1;
135 u8 hit:1; 142 u8 hit:1;
136 u8 annotate_warned:1; 143 u8 annotate_warned:1;
137 u8 sname_alloc:1; 144 u8 sname_alloc:1;
138 u8 lname_alloc:1; 145 u8 lname_alloc:1;
139 unsigned char origin; 146 unsigned char symtab_type;
140 u8 sorted_by_name; 147 u8 sorted_by_name;
141 u8 loaded; 148 u8 loaded;
142 u8 build_id[BUILD_ID_SIZE]; 149 u8 build_id[BUILD_ID_SIZE];
@@ -149,83 +156,90 @@ struct dso {
149 156
150struct dso *dso__new(const char *name); 157struct dso *dso__new(const char *name);
151struct dso *dso__new_kernel(const char *name); 158struct dso *dso__new_kernel(const char *name);
152void dso__delete(struct dso *self); 159void dso__delete(struct dso *dso);
153 160
154int dso__name_len(const struct dso *self); 161int dso__name_len(const struct dso *dso);
155 162
156bool dso__loaded(const struct dso *self, enum map_type type); 163bool dso__loaded(const struct dso *dso, enum map_type type);
157bool dso__sorted_by_name(const struct dso *self, enum map_type type); 164bool dso__sorted_by_name(const struct dso *dso, enum map_type type);
158 165
159static inline void dso__set_loaded(struct dso *self, enum map_type type) 166static inline void dso__set_loaded(struct dso *dso, enum map_type type)
160{ 167{
161 self->loaded |= (1 << type); 168 dso->loaded |= (1 << type);
162} 169}
163 170
164void dso__sort_by_name(struct dso *self, enum map_type type); 171void dso__sort_by_name(struct dso *dso, enum map_type type);
165 172
166struct dso *__dsos__findnew(struct list_head *head, const char *name); 173struct dso *__dsos__findnew(struct list_head *head, const char *name);
167 174
168int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); 175int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter);
169int dso__load_vmlinux_path(struct dso *self, struct map *map, 176int dso__load_vmlinux(struct dso *dso, struct map *map,
177 const char *vmlinux, symbol_filter_t filter);
178int dso__load_vmlinux_path(struct dso *dso, struct map *map,
170 symbol_filter_t filter); 179 symbol_filter_t filter);
171int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map, 180int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map,
172 symbol_filter_t filter); 181 symbol_filter_t filter);
173int machine__load_kallsyms(struct machine *self, const char *filename, 182int machine__load_kallsyms(struct machine *machine, const char *filename,
174 enum map_type type, symbol_filter_t filter); 183 enum map_type type, symbol_filter_t filter);
175int machine__load_vmlinux_path(struct machine *self, enum map_type type, 184int machine__load_vmlinux_path(struct machine *machine, enum map_type type,
176 symbol_filter_t filter); 185 symbol_filter_t filter);
177 186
178size_t __dsos__fprintf(struct list_head *head, FILE *fp); 187size_t __dsos__fprintf(struct list_head *head, FILE *fp);
179 188
180size_t machine__fprintf_dsos_buildid(struct machine *self, FILE *fp, bool with_hits); 189size_t machine__fprintf_dsos_buildid(struct machine *machine,
181size_t machines__fprintf_dsos(struct rb_root *self, FILE *fp); 190 FILE *fp, bool with_hits);
182size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_hits); 191size_t machines__fprintf_dsos(struct rb_root *machines, FILE *fp);
183 192size_t machines__fprintf_dsos_buildid(struct rb_root *machines,
184size_t dso__fprintf_buildid(struct dso *self, FILE *fp); 193 FILE *fp, bool with_hits);
185size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); 194size_t dso__fprintf_buildid(struct dso *dso, FILE *fp);
186 195size_t dso__fprintf_symbols_by_name(struct dso *dso,
187enum dso_origin { 196 enum map_type type, FILE *fp);
188 DSO__ORIG_KERNEL = 0, 197size_t dso__fprintf(struct dso *dso, enum map_type type, FILE *fp);
189 DSO__ORIG_GUEST_KERNEL, 198
190 DSO__ORIG_JAVA_JIT, 199enum symtab_type {
191 DSO__ORIG_BUILD_ID_CACHE, 200 SYMTAB__KALLSYMS = 0,
192 DSO__ORIG_FEDORA, 201 SYMTAB__GUEST_KALLSYMS,
193 DSO__ORIG_UBUNTU, 202 SYMTAB__JAVA_JIT,
194 DSO__ORIG_BUILDID, 203 SYMTAB__BUILD_ID_CACHE,
195 DSO__ORIG_DSO, 204 SYMTAB__FEDORA_DEBUGINFO,
196 DSO__ORIG_GUEST_KMODULE, 205 SYMTAB__UBUNTU_DEBUGINFO,
197 DSO__ORIG_KMODULE, 206 SYMTAB__BUILDID_DEBUGINFO,
198 DSO__ORIG_NOT_FOUND, 207 SYMTAB__SYSTEM_PATH_DSO,
208 SYMTAB__GUEST_KMODULE,
209 SYMTAB__SYSTEM_PATH_KMODULE,
210 SYMTAB__NOT_FOUND,
199}; 211};
200 212
201char dso__symtab_origin(const struct dso *self); 213char dso__symtab_origin(const struct dso *dso);
202void dso__set_long_name(struct dso *self, char *name); 214void dso__set_long_name(struct dso *dso, char *name);
203void dso__set_build_id(struct dso *self, void *build_id); 215void dso__set_build_id(struct dso *dso, void *build_id);
204void dso__read_running_kernel_build_id(struct dso *self, struct machine *machine); 216void dso__read_running_kernel_build_id(struct dso *dso,
205struct symbol *dso__find_symbol(struct dso *self, enum map_type type, u64 addr); 217 struct machine *machine);
206struct symbol *dso__find_symbol_by_name(struct dso *self, enum map_type type, 218struct symbol *dso__find_symbol(struct dso *dso, enum map_type type,
219 u64 addr);
220struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
207 const char *name); 221 const char *name);
208 222
209int filename__read_build_id(const char *filename, void *bf, size_t size); 223int filename__read_build_id(const char *filename, void *bf, size_t size);
210int sysfs__read_build_id(const char *filename, void *bf, size_t size); 224int sysfs__read_build_id(const char *filename, void *bf, size_t size);
211bool __dsos__read_build_ids(struct list_head *head, bool with_hits); 225bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
212int build_id__sprintf(const u8 *self, int len, char *bf); 226int build_id__sprintf(const u8 *build_id, int len, char *bf);
213int kallsyms__parse(const char *filename, void *arg, 227int kallsyms__parse(const char *filename, void *arg,
214 int (*process_symbol)(void *arg, const char *name, 228 int (*process_symbol)(void *arg, const char *name,
215 char type, u64 start)); 229 char type, u64 start, u64 end));
216 230
217void machine__destroy_kernel_maps(struct machine *self); 231void machine__destroy_kernel_maps(struct machine *machine);
218int __machine__create_kernel_maps(struct machine *self, struct dso *kernel); 232int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel);
219int machine__create_kernel_maps(struct machine *self); 233int machine__create_kernel_maps(struct machine *machine);
220 234
221int machines__create_kernel_maps(struct rb_root *self, pid_t pid); 235int machines__create_kernel_maps(struct rb_root *machines, pid_t pid);
222int machines__create_guest_kernel_maps(struct rb_root *self); 236int machines__create_guest_kernel_maps(struct rb_root *machines);
223void machines__destroy_guest_kernel_maps(struct rb_root *self); 237void machines__destroy_guest_kernel_maps(struct rb_root *machines);
224 238
225int symbol__init(void); 239int symbol__init(void);
226void symbol__exit(void); 240void symbol__exit(void);
227bool symbol_type__is_a(char symbol_type, enum map_type map_type); 241bool symbol_type__is_a(char symbol_type, enum map_type map_type);
228 242
229size_t machine__fprintf_vmlinux_path(struct machine *self, FILE *fp); 243size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp);
230 244
231#endif /* __PERF_SYMBOL */ 245#endif /* __PERF_SYMBOL */