Commit | Line | Data |
---|---|---|
a2928c42 ACM |
1 | #ifndef _PERF_SYMBOL_ |
2 | #define _PERF_SYMBOL_ 1 | |
3 | ||
4 | #include <linux/types.h> | |
7c6a1c65 | 5 | #include "types.h" |
5da50258 | 6 | #include <linux/list.h> |
43cbcd8a | 7 | #include <linux/rbtree.h> |
6cfcc53e | 8 | #include "module.h" |
a2928c42 | 9 | |
247648e3 ACM |
10 | #ifdef HAVE_CPLUS_DEMANGLE |
11 | extern char *cplus_demangle(const char *, int); | |
12 | ||
13 | static inline char *bfd_demangle(void __used *v, const char *c, int i) | |
14 | { | |
15 | return cplus_demangle(c, i); | |
16 | } | |
17 | #else | |
18 | #ifdef NO_DEMANGLE | |
19 | static inline char *bfd_demangle(void __used *v, const char __used *c, | |
20 | int __used i) | |
21 | { | |
22 | return NULL; | |
23 | } | |
24 | #else | |
25 | #include <bfd.h> | |
26 | #endif | |
27 | #endif | |
28 | ||
29 | #ifndef DMGL_PARAMS | |
30 | #define DMGL_PARAMS (1 << 0) /* Include function args */ | |
31 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ | |
32 | #endif | |
33 | ||
a2928c42 ACM |
34 | struct symbol { |
35 | struct rb_node rb_node; | |
9cffa8d5 PM |
36 | u64 start; |
37 | u64 end; | |
38 | u64 obj_start; | |
39 | u64 hist_sum; | |
40 | u64 *hist; | |
6cfcc53e | 41 | struct module *module; |
301406b9 | 42 | void *priv; |
a2928c42 ACM |
43 | char name[0]; |
44 | }; | |
45 | ||
46 | struct dso { | |
47 | struct list_head node; | |
48 | struct rb_root syms; | |
9cffa8d5 | 49 | struct symbol *(*find_symbol)(struct dso *, u64 ip); |
f5812a7a | 50 | unsigned int sym_priv_size; |
30d7a77d | 51 | unsigned char adjust_symbols; |
52d422de | 52 | unsigned char slen_calculated; |
94cb9e38 | 53 | unsigned char origin; |
a2928c42 ACM |
54 | char name[0]; |
55 | }; | |
56 | ||
0b73da3f IM |
57 | const char *sym_hist_filter; |
58 | ||
69ee69f6 ACM |
59 | typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym); |
60 | ||
0085c954 | 61 | struct dso *dso__new(const char *name, unsigned int sym_priv_size); |
a2928c42 ACM |
62 | void dso__delete(struct dso *self); |
63 | ||
0085c954 ACM |
64 | static inline void *dso__sym_priv(struct dso *self, struct symbol *sym) |
65 | { | |
66 | return ((void *)sym) - self->sym_priv_size; | |
67 | } | |
68 | ||
9cffa8d5 | 69 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); |
a2928c42 | 70 | |
69ee69f6 | 71 | int dso__load_kernel(struct dso *self, const char *vmlinux, |
6cfcc53e MG |
72 | symbol_filter_t filter, int verbose, int modules); |
73 | int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose); | |
bd74137e | 74 | int dso__load(struct dso *self, symbol_filter_t filter, int verbose); |
a2928c42 ACM |
75 | |
76 | size_t dso__fprintf(struct dso *self, FILE *fp); | |
94cb9e38 | 77 | char dso__symtab_origin(const struct dso *self); |
a2928c42 ACM |
78 | |
79 | void symbol__init(void); | |
80 | #endif /* _PERF_SYMBOL_ */ |