symbol.h (43315956509ca6913764861ac7dec128b91eb1ec) symbol.h (84087126d50400789b44459cfc45721778e6ebb0)
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>
6#include "types.h"
7#include <linux/list.h>
8#include <linux/rbtree.h>
5#include "types.h"
6#include <linux/list.h>
7#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);

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

22{
23 return NULL;
24}
25#else
26#include <bfd.h>
27#endif
28#endif
29
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);

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

22{
23 return NULL;
24}
25#else
26#include <bfd.h>
27#endif
28#endif
29
30/*
31 * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
32 * for newer versions we can use mmap to reduce memory usage:
33 */
34#ifdef LIBELF_NO_MMAP
35# define PERF_ELF_C_READ_MMAP ELF_C_READ
36#else
37# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
38#endif
39
30#ifndef DMGL_PARAMS
31#define DMGL_PARAMS (1 << 0) /* Include function args */
32#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
33#endif
34
35struct symbol {
36 struct rb_node rb_node;
37 u64 start;
38 u64 end;
40#ifndef DMGL_PARAMS
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;
39 char name[0];
40};
41
42struct dso {
43 struct list_head node;
44 struct rb_root syms;
45 struct symbol *(*find_symbol)(struct dso *, u64 ip);
46 unsigned int sym_priv_size;
47 unsigned char adjust_symbols;
48 unsigned char slen_calculated;
49 unsigned char origin;
54 char name[0];
55};
56
57struct dso {
58 struct list_head node;
59 struct rb_root syms;
60 struct symbol *(*find_symbol)(struct dso *, u64 ip);
61 unsigned int sym_priv_size;
62 unsigned char adjust_symbols;
63 unsigned char slen_calculated;
64 unsigned char origin;
50 const char *short_name;
51 char *long_name;
52 char name[0];
53};
54
65 char name[0];
66};
67
68extern const char *sym_hist_filter;
69
70typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
71
55struct dso *dso__new(const char *name, unsigned int sym_priv_size);
56void dso__delete(struct dso *self);
57
58static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
59{
60 return ((void *)sym) - self->sym_priv_size;
61}
62
63struct symbol *dso__find_symbol(struct dso *self, u64 ip);
64
72struct dso *dso__new(const char *name, unsigned int sym_priv_size);
73void dso__delete(struct dso *self);
74
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
65int dsos__load_kernel(const char *vmlinux, unsigned int sym_priv_size,
66 symbol_filter_t filter, int modules);
67struct dso *dsos__findnew(const char *name, unsigned int sym_priv_size,
68 bool *is_new);
69int dso__load(struct dso *self, struct map *map, symbol_filter_t filter);
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);
86struct dso *dsos__findnew(const char *name);
70void dsos__fprintf(FILE *fp);
71
72size_t dso__fprintf(struct dso *self, FILE *fp);
73char dso__symtab_origin(const struct dso *self);
74
87void dsos__fprintf(FILE *fp);
88
89size_t dso__fprintf(struct dso *self, FILE *fp);
90char dso__symtab_origin(const struct dso *self);
91
75int load_kernel(unsigned int sym_priv_size, symbol_filter_t filter);
92int load_kernel(void);
76
77void symbol__init(void);
78
79extern struct list_head dsos;
93
94void symbol__init(void);
95
96extern struct list_head dsos;
80extern struct map *kernel_map;
97extern struct dso *kernel_dso;
81extern struct dso *vdso;
98extern struct dso *vdso;
99extern struct dso *hypervisor_dso;
82extern const char *vmlinux_name;
83extern int modules;
100extern const char *vmlinux_name;
101extern int modules;
84#endif /* __PERF_SYMBOL */
102#endif /* _PERF_SYMBOL_ */