symbol.h (0c3c35e148dbc03106038dd25816fb9f3a084d86) symbol.h (9e03eb2d512e7f3a1e562d4b922aa8b1891750b6)
1#ifndef _PERF_SYMBOL_
2#define _PERF_SYMBOL_ 1
1#ifndef __PERF_SYMBOL
2#define __PERF_SYMBOL 1
3
4#include <linux/types.h>
3
4#include <linux/types.h>
5#include <stdbool.h>
5#include "types.h"
6#include <linux/list.h>
7#include <linux/rbtree.h>
6#include "types.h"
7#include <linux/list.h>
8#include <linux/rbtree.h>
8#include "module.h"
9#include "event.h"
10
11#ifdef HAVE_CPLUS_DEMANGLE
12extern char *cplus_demangle(const char *, int);
13
14static inline char *bfd_demangle(void __used *v, const char *c, int i)
15{
16 return cplus_demangle(c, i);

--- 24 unchanged lines hidden (view full) ---

41#define DMGL_PARAMS (1 << 0) /* Include function args */
42#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
43#endif
44
45struct symbol {
46 struct rb_node rb_node;
47 u64 start;
48 u64 end;
9#include "event.h"
10
11#ifdef HAVE_CPLUS_DEMANGLE
12extern char *cplus_demangle(const char *, int);
13
14static inline char *bfd_demangle(void __used *v, const char *c, int i)
15{
16 return cplus_demangle(c, i);

--- 24 unchanged lines hidden (view full) ---

41#define DMGL_PARAMS (1 << 0) /* Include function args */
42#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
43#endif
44
45struct symbol {
46 struct rb_node rb_node;
47 u64 start;
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];
55};
56
49 char name[0];
50};
51
52extern unsigned int symbol__priv_size;
53
54static inline void *symbol__priv(struct symbol *self)
55{
56 return ((void *)self) - symbol__priv_size;
57}
58
57struct dso {
58 struct list_head node;
59 struct rb_root syms;
60 struct symbol *(*find_symbol)(struct dso *, u64 ip);
59struct dso {
60 struct list_head node;
61 struct rb_root syms;
62 struct symbol *(*find_symbol)(struct dso *, u64 ip);
61 unsigned int sym_priv_size;
62 unsigned char adjust_symbols;
63 unsigned char slen_calculated;
63 u8 adjust_symbols:1;
64 u8 slen_calculated:1;
65 u8 loaded:1;
66 u8 has_build_id:1;
64 unsigned char origin;
67 unsigned char origin;
68 u8 build_id[BUILD_ID_SIZE];
69 const char *short_name;
70 char *long_name;
65 char name[0];
66};
67
71 char name[0];
72};
73
68extern const char *sym_hist_filter;
69
70typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
71
72struct dso *dso__new(const char *name, unsigned int sym_priv_size);
74struct dso *dso__new(const char *name);
73void dso__delete(struct dso *self);
74
75void dso__delete(struct dso *self);
76
75static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
76{
77 return ((void *)sym) - self->sym_priv_size;
78}
79
80struct symbol *dso__find_symbol(struct dso *self, u64 ip);
81
77struct symbol *dso__find_symbol(struct dso *self, u64 ip);
78
82int dso__load_kernel(struct dso *self, const char *vmlinux,
83 symbol_filter_t filter, int verbose, int modules);
84int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose);
85int dso__load(struct dso *self, symbol_filter_t filter, int verbose);
79int dsos__load_kernel(const char *vmlinux, symbol_filter_t filter, int modules);
86struct dso *dsos__findnew(const char *name);
80struct dso *dsos__findnew(const char *name);
81int dso__load(struct dso *self, struct map *map, symbol_filter_t filter);
87void dsos__fprintf(FILE *fp);
82void dsos__fprintf(FILE *fp);
83size_t dsos__fprintf_buildid(FILE *fp);
88
84
85size_t dso__fprintf_buildid(struct dso *self, FILE *fp);
89size_t dso__fprintf(struct dso *self, FILE *fp);
90char dso__symtab_origin(const struct dso *self);
86size_t dso__fprintf(struct dso *self, FILE *fp);
87char dso__symtab_origin(const struct dso *self);
88void dso__set_build_id(struct dso *self, void *build_id);
91
89
92int load_kernel(void);
90int filename__read_build_id(const char *filename, void *bf, size_t size);
91bool fetch_build_id_table(struct list_head *head);
92int build_id__sprintf(u8 *self, int len, char *bf);
93
93
94void symbol__init(void);
94int load_kernel(symbol_filter_t filter);
95
95
96void symbol__init(unsigned int priv_size);
97
96extern struct list_head dsos;
98extern struct list_head dsos;
97extern struct dso *kernel_dso;
99extern struct map *kernel_map;
98extern struct dso *vdso;
100extern struct dso *vdso;
99extern struct dso *hypervisor_dso;
100extern const char *vmlinux_name;
101extern int modules;
101extern const char *vmlinux_name;
102extern int modules;
102#endif /* _PERF_SYMBOL_ */
103#endif /* __PERF_SYMBOL */