diff options
Diffstat (limited to 'tools/perf/util/symbol.h')
-rw-r--r-- | tools/perf/util/symbol.h | 118 |
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 | */ | ||
51 | struct symbol { | 55 | struct 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 | ||
60 | void symbol__delete(struct symbol *self); | 65 | void symbol__delete(struct symbol *sym); |
61 | 66 | ||
62 | struct strlist; | 67 | struct 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 | ||
90 | extern struct symbol_conf symbol_conf; | 98 | extern struct symbol_conf symbol_conf; |
91 | 99 | ||
92 | static inline void *symbol__priv(struct symbol *self) | 100 | static 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 | ||
97 | struct ref_reloc_sym { | 105 | struct 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 | ||
150 | struct dso *dso__new(const char *name); | 157 | struct dso *dso__new(const char *name); |
151 | struct dso *dso__new_kernel(const char *name); | 158 | struct dso *dso__new_kernel(const char *name); |
152 | void dso__delete(struct dso *self); | 159 | void dso__delete(struct dso *dso); |
153 | 160 | ||
154 | int dso__name_len(const struct dso *self); | 161 | int dso__name_len(const struct dso *dso); |
155 | 162 | ||
156 | bool dso__loaded(const struct dso *self, enum map_type type); | 163 | bool dso__loaded(const struct dso *dso, enum map_type type); |
157 | bool dso__sorted_by_name(const struct dso *self, enum map_type type); | 164 | bool dso__sorted_by_name(const struct dso *dso, enum map_type type); |
158 | 165 | ||
159 | static inline void dso__set_loaded(struct dso *self, enum map_type type) | 166 | static 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 | ||
164 | void dso__sort_by_name(struct dso *self, enum map_type type); | 171 | void dso__sort_by_name(struct dso *dso, enum map_type type); |
165 | 172 | ||
166 | struct dso *__dsos__findnew(struct list_head *head, const char *name); | 173 | struct dso *__dsos__findnew(struct list_head *head, const char *name); |
167 | 174 | ||
168 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); | 175 | int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter); |
169 | int dso__load_vmlinux_path(struct dso *self, struct map *map, | 176 | int dso__load_vmlinux(struct dso *dso, struct map *map, |
177 | const char *vmlinux, symbol_filter_t filter); | ||
178 | int dso__load_vmlinux_path(struct dso *dso, struct map *map, | ||
170 | symbol_filter_t filter); | 179 | symbol_filter_t filter); |
171 | int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map, | 180 | int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, |
172 | symbol_filter_t filter); | 181 | symbol_filter_t filter); |
173 | int machine__load_kallsyms(struct machine *self, const char *filename, | 182 | int 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); |
175 | int machine__load_vmlinux_path(struct machine *self, enum map_type type, | 184 | int machine__load_vmlinux_path(struct machine *machine, enum map_type type, |
176 | symbol_filter_t filter); | 185 | symbol_filter_t filter); |
177 | 186 | ||
178 | size_t __dsos__fprintf(struct list_head *head, FILE *fp); | 187 | size_t __dsos__fprintf(struct list_head *head, FILE *fp); |
179 | 188 | ||
180 | size_t machine__fprintf_dsos_buildid(struct machine *self, FILE *fp, bool with_hits); | 189 | size_t machine__fprintf_dsos_buildid(struct machine *machine, |
181 | size_t machines__fprintf_dsos(struct rb_root *self, FILE *fp); | 190 | FILE *fp, bool with_hits); |
182 | size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_hits); | 191 | size_t machines__fprintf_dsos(struct rb_root *machines, FILE *fp); |
183 | 192 | size_t machines__fprintf_dsos_buildid(struct rb_root *machines, | |
184 | size_t dso__fprintf_buildid(struct dso *self, FILE *fp); | 193 | FILE *fp, bool with_hits); |
185 | size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); | 194 | size_t dso__fprintf_buildid(struct dso *dso, FILE *fp); |
186 | 195 | size_t dso__fprintf_symbols_by_name(struct dso *dso, | |
187 | enum dso_origin { | 196 | enum map_type type, FILE *fp); |
188 | DSO__ORIG_KERNEL = 0, | 197 | size_t dso__fprintf(struct dso *dso, enum map_type type, FILE *fp); |
189 | DSO__ORIG_GUEST_KERNEL, | 198 | |
190 | DSO__ORIG_JAVA_JIT, | 199 | enum 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 | ||
201 | char dso__symtab_origin(const struct dso *self); | 213 | char dso__symtab_origin(const struct dso *dso); |
202 | void dso__set_long_name(struct dso *self, char *name); | 214 | void dso__set_long_name(struct dso *dso, char *name); |
203 | void dso__set_build_id(struct dso *self, void *build_id); | 215 | void dso__set_build_id(struct dso *dso, void *build_id); |
204 | void dso__read_running_kernel_build_id(struct dso *self, struct machine *machine); | 216 | void dso__read_running_kernel_build_id(struct dso *dso, |
205 | struct symbol *dso__find_symbol(struct dso *self, enum map_type type, u64 addr); | 217 | struct machine *machine); |
206 | struct symbol *dso__find_symbol_by_name(struct dso *self, enum map_type type, | 218 | struct symbol *dso__find_symbol(struct dso *dso, enum map_type type, |
219 | u64 addr); | ||
220 | struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type, | ||
207 | const char *name); | 221 | const char *name); |
208 | 222 | ||
209 | int filename__read_build_id(const char *filename, void *bf, size_t size); | 223 | int filename__read_build_id(const char *filename, void *bf, size_t size); |
210 | int sysfs__read_build_id(const char *filename, void *bf, size_t size); | 224 | int sysfs__read_build_id(const char *filename, void *bf, size_t size); |
211 | bool __dsos__read_build_ids(struct list_head *head, bool with_hits); | 225 | bool __dsos__read_build_ids(struct list_head *head, bool with_hits); |
212 | int build_id__sprintf(const u8 *self, int len, char *bf); | 226 | int build_id__sprintf(const u8 *build_id, int len, char *bf); |
213 | int kallsyms__parse(const char *filename, void *arg, | 227 | int 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 | ||
217 | void machine__destroy_kernel_maps(struct machine *self); | 231 | void machine__destroy_kernel_maps(struct machine *machine); |
218 | int __machine__create_kernel_maps(struct machine *self, struct dso *kernel); | 232 | int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel); |
219 | int machine__create_kernel_maps(struct machine *self); | 233 | int machine__create_kernel_maps(struct machine *machine); |
220 | 234 | ||
221 | int machines__create_kernel_maps(struct rb_root *self, pid_t pid); | 235 | int machines__create_kernel_maps(struct rb_root *machines, pid_t pid); |
222 | int machines__create_guest_kernel_maps(struct rb_root *self); | 236 | int machines__create_guest_kernel_maps(struct rb_root *machines); |
223 | void machines__destroy_guest_kernel_maps(struct rb_root *self); | 237 | void machines__destroy_guest_kernel_maps(struct rb_root *machines); |
224 | 238 | ||
225 | int symbol__init(void); | 239 | int symbol__init(void); |
226 | void symbol__exit(void); | 240 | void symbol__exit(void); |
227 | bool symbol_type__is_a(char symbol_type, enum map_type map_type); | 241 | bool symbol_type__is_a(char symbol_type, enum map_type map_type); |
228 | 242 | ||
229 | size_t machine__fprintf_vmlinux_path(struct machine *self, FILE *fp); | 243 | size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp); |
230 | 244 | ||
231 | #endif /* __PERF_SYMBOL */ | 245 | #endif /* __PERF_SYMBOL */ |