Merge commit 'perf/core' into perf/hw-breakpoint
[deliverable/linux.git] / tools / perf / util / symbol.h
1 #ifndef __PERF_SYMBOL
2 #define __PERF_SYMBOL 1
3
4 #include <linux/types.h>
5 #include "types.h"
6 #include <linux/list.h>
7 #include <linux/rbtree.h>
8 #include "event.h"
9
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
34 struct symbol {
35 struct rb_node rb_node;
36 u64 start;
37 u64 end;
38 u64 hist_sum;
39 u64 *hist;
40 void *priv;
41 char name[0];
42 };
43
44 struct dso {
45 struct list_head node;
46 struct rb_root syms;
47 struct symbol *(*find_symbol)(struct dso *, u64 ip);
48 unsigned int sym_priv_size;
49 unsigned char adjust_symbols;
50 unsigned char slen_calculated;
51 unsigned char origin;
52 const char *short_name;
53 char *long_name;
54 char name[0];
55 };
56
57 extern const char *sym_hist_filter;
58
59 typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
60
61 struct dso *dso__new(const char *name, unsigned int sym_priv_size);
62 void dso__delete(struct dso *self);
63
64 static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
65 {
66 return ((void *)sym) - self->sym_priv_size;
67 }
68
69 struct symbol *dso__find_symbol(struct dso *self, u64 ip);
70
71 int dsos__load_kernel(const char *vmlinux, unsigned int sym_priv_size,
72 symbol_filter_t filter, int verbose, int modules);
73 int dso__load(struct dso *self, struct map *map, symbol_filter_t filter,
74 int verbose);
75 struct dso *dsos__findnew(const char *name);
76 void dsos__fprintf(FILE *fp);
77
78 size_t dso__fprintf(struct dso *self, FILE *fp);
79 char dso__symtab_origin(const struct dso *self);
80
81 int load_kernel(void);
82
83 void symbol__init(void);
84
85 extern struct list_head dsos;
86 extern struct map *kernel_map;
87 extern struct dso *vdso;
88 extern const char *vmlinux_name;
89 extern int modules;
90 #endif /* __PERF_SYMBOL */
This page took 0.034178 seconds and 6 git commands to generate.