Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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 "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);
17}
18#else
19#ifdef NO_DEMANGLE
20static inline char *bfd_demangle(void __used *v, const char __used *c,
21 int __used i)
22{
23 return NULL;
24}
25#else
26#include <bfd.h>
27#endif
28#endif
29
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;
39 u64 obj_start;
40 u64 hist_sum;
41 u64 *hist;
42 struct module *module;
43 void *priv;
44 char name[0];
45};
46
47struct dso {
48 struct list_head node;
49 struct rb_root syms;
50 struct symbol *(*find_symbol)(struct dso *, u64 ip);
51 unsigned int sym_priv_size;
52 unsigned char adjust_symbols;
53 unsigned char slen_calculated;
54 unsigned char origin;
55 char name[0];
56};
57
58extern const char *sym_hist_filter;
59
60typedef int (*symbol_filter_t)(struct dso *self, struct symbol *sym);
61
62struct dso *dso__new(const char *name, unsigned int sym_priv_size);
63void dso__delete(struct dso *self);
64
65static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
66{
67 return ((void *)sym) - self->sym_priv_size;
68}
69
70struct symbol *dso__find_symbol(struct dso *self, u64 ip);
71
72int dso__load_kernel(struct dso *self, const char *vmlinux,
73 symbol_filter_t filter, int verbose, int modules);
74int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose);
75int dso__load(struct dso *self, symbol_filter_t filter, int verbose);
76struct dso *dsos__findnew(const char *name);
77void dsos__fprintf(FILE *fp);
78
79size_t dso__fprintf(struct dso *self, FILE *fp);
80char dso__symtab_origin(const struct dso *self);
81
82int load_kernel(void);
83
84void symbol__init(void);
85
86extern struct list_head dsos;
87extern struct dso *kernel_dso;
88extern struct dso *vdso;
89extern struct dso *hypervisor_dso;
90extern const char *vmlinux_name;
91extern int modules;
92#endif /* _PERF_SYMBOL_ */