diff options
Diffstat (limited to 'tools/perf/util/symbol.h')
-rw-r--r-- | tools/perf/util/symbol.h | 92 |
1 files changed, 55 insertions, 37 deletions
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 829da9edba64..17003efa0b39 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -1,11 +1,11 @@ | |||
1 | #ifndef _PERF_SYMBOL_ | 1 | #ifndef __PERF_SYMBOL |
2 | #define _PERF_SYMBOL_ 1 | 2 | #define __PERF_SYMBOL 1 |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <stdbool.h> | ||
5 | #include "types.h" | 6 | #include "types.h" |
6 | #include <linux/list.h> | 7 | #include <linux/list.h> |
7 | #include <linux/rbtree.h> | 8 | #include <linux/rbtree.h> |
8 | #include "module.h" | ||
9 | #include "event.h" | 9 | #include "event.h" |
10 | 10 | ||
11 | #ifdef HAVE_CPLUS_DEMANGLE | 11 | #ifdef HAVE_CPLUS_DEMANGLE |
@@ -46,57 +46,75 @@ struct symbol { | |||
46 | struct rb_node rb_node; | 46 | struct rb_node rb_node; |
47 | u64 start; | 47 | u64 start; |
48 | u64 end; | 48 | u64 end; |
49 | u64 obj_start; | ||
50 | u64 hist_sum; | ||
51 | u64 *hist; | ||
52 | struct module *module; | ||
53 | void *priv; | ||
54 | char name[0]; | 49 | char name[0]; |
55 | }; | 50 | }; |
56 | 51 | ||
52 | struct symbol_conf { | ||
53 | unsigned short priv_size; | ||
54 | bool try_vmlinux_path, | ||
55 | use_modules; | ||
56 | const char *vmlinux_name; | ||
57 | }; | ||
58 | |||
59 | extern unsigned int symbol__priv_size; | ||
60 | |||
61 | static inline void *symbol__priv(struct symbol *self) | ||
62 | { | ||
63 | return ((void *)self) - symbol__priv_size; | ||
64 | } | ||
65 | |||
66 | struct addr_location { | ||
67 | struct thread *thread; | ||
68 | struct map *map; | ||
69 | struct symbol *sym; | ||
70 | u64 addr; | ||
71 | char level; | ||
72 | }; | ||
73 | |||
57 | struct dso { | 74 | struct dso { |
58 | struct list_head node; | 75 | struct list_head node; |
59 | struct rb_root syms; | 76 | struct rb_root symbols[MAP__NR_TYPES]; |
60 | struct symbol *(*find_symbol)(struct dso *, u64 ip); | 77 | struct symbol *(*find_symbol)(struct dso *self, |
61 | unsigned int sym_priv_size; | 78 | enum map_type type, u64 addr); |
62 | unsigned char adjust_symbols; | 79 | u8 adjust_symbols:1; |
63 | unsigned char slen_calculated; | 80 | u8 slen_calculated:1; |
81 | u8 has_build_id:1; | ||
82 | u8 kernel:1; | ||
64 | unsigned char origin; | 83 | unsigned char origin; |
84 | u8 loaded; | ||
85 | u8 build_id[BUILD_ID_SIZE]; | ||
86 | u16 long_name_len; | ||
87 | const char *short_name; | ||
88 | char *long_name; | ||
65 | char name[0]; | 89 | char name[0]; |
66 | }; | 90 | }; |
67 | 91 | ||
68 | extern const char *sym_hist_filter; | 92 | struct dso *dso__new(const char *name); |
69 | |||
70 | typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym); | ||
71 | |||
72 | struct dso *dso__new(const char *name, unsigned int sym_priv_size); | ||
73 | void dso__delete(struct dso *self); | 93 | void dso__delete(struct dso *self); |
74 | 94 | ||
75 | static inline void *dso__sym_priv(struct dso *self, struct symbol *sym) | 95 | bool dso__loaded(const struct dso *self, enum map_type type); |
76 | { | ||
77 | return ((void *)sym) - self->sym_priv_size; | ||
78 | } | ||
79 | |||
80 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); | ||
81 | 96 | ||
82 | int dso__load_kernel(struct dso *self, const char *vmlinux, | ||
83 | symbol_filter_t filter, int verbose, int modules); | ||
84 | int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose); | ||
85 | int dso__load(struct dso *self, symbol_filter_t filter, int verbose); | ||
86 | struct dso *dsos__findnew(const char *name); | 97 | struct dso *dsos__findnew(const char *name); |
98 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); | ||
87 | void dsos__fprintf(FILE *fp); | 99 | void dsos__fprintf(FILE *fp); |
100 | size_t dsos__fprintf_buildid(FILE *fp); | ||
88 | 101 | ||
89 | size_t dso__fprintf(struct dso *self, FILE *fp); | 102 | size_t dso__fprintf_buildid(struct dso *self, FILE *fp); |
103 | size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); | ||
90 | char dso__symtab_origin(const struct dso *self); | 104 | char dso__symtab_origin(const struct dso *self); |
105 | void dso__set_build_id(struct dso *self, void *build_id); | ||
106 | |||
107 | int filename__read_build_id(const char *filename, void *bf, size_t size); | ||
108 | int sysfs__read_build_id(const char *filename, void *bf, size_t size); | ||
109 | bool dsos__read_build_ids(void); | ||
110 | int build_id__sprintf(u8 *self, int len, char *bf); | ||
91 | 111 | ||
92 | int load_kernel(void); | 112 | size_t kernel_maps__fprintf(FILE *fp); |
93 | 113 | ||
94 | void symbol__init(void); | 114 | int symbol__init(struct symbol_conf *conf); |
95 | 115 | ||
96 | extern struct list_head dsos; | 116 | struct thread; |
97 | extern struct dso *kernel_dso; | 117 | struct thread *kthread; |
118 | extern struct list_head dsos__user, dsos__kernel; | ||
98 | extern struct dso *vdso; | 119 | extern struct dso *vdso; |
99 | extern struct dso *hypervisor_dso; | 120 | #endif /* __PERF_SYMBOL */ |
100 | extern const char *vmlinux_name; | ||
101 | extern int modules; | ||
102 | #endif /* _PERF_SYMBOL_ */ | ||