]> bbs.cooldavid.org Git - net-next-2.6.git/blame - tools/perf/util/symbol.h
perf symbols: Unexport kernel_map__functions
[net-next-2.6.git] / tools / perf / util / symbol.h
CommitLineData
8b40f521
JK
1#ifndef __PERF_SYMBOL
2#define __PERF_SYMBOL 1
a2928c42
ACM
3
4#include <linux/types.h>
e4204992 5#include <stdbool.h>
7c6a1c65 6#include "types.h"
5da50258 7#include <linux/list.h>
43cbcd8a 8#include <linux/rbtree.h>
66e274f3 9#include "event.h"
a2928c42 10
247648e3
ACM
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
84087126
MR
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
247648e3
ACM
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
a2928c42
ACM
45struct symbol {
46 struct rb_node rb_node;
9cffa8d5
PM
47 u64 start;
48 u64 end;
a2928c42
ACM
49 char name[0];
50};
51
b32d133a
ACM
52struct symbol_conf {
53 unsigned short priv_size;
54 bool try_vmlinux_path,
55 use_modules;
56 const char *vmlinux_name;
57};
58
00a192b3
ACM
59extern unsigned int symbol__priv_size;
60
61static inline void *symbol__priv(struct symbol *self)
62{
63 return ((void *)self) - symbol__priv_size;
64}
65
a2928c42
ACM
66struct dso {
67 struct list_head node;
fcf1203a
ACM
68 struct rb_root functions;
69 struct symbol *(*find_function)(struct dso *, u64 ip);
8d06367f
ACM
70 u8 adjust_symbols:1;
71 u8 slen_calculated:1;
72 u8 loaded:1;
73 u8 has_build_id:1;
c338aee8 74 u8 kernel:1;
94cb9e38 75 unsigned char origin;
8d06367f 76 u8 build_id[BUILD_ID_SIZE];
cfc10d3b 77 u16 long_name_len;
439d473b
ACM
78 const char *short_name;
79 char *long_name;
a2928c42
ACM
80 char name[0];
81};
82
00a192b3 83struct dso *dso__new(const char *name);
a2928c42
ACM
84void dso__delete(struct dso *self);
85
fcf1203a 86struct symbol *dso__find_function(struct dso *self, u64 ip);
a2928c42 87
00a192b3 88struct dso *dsos__findnew(const char *name);
6beba7ad 89int dso__load(struct dso *self, struct map *map, symbol_filter_t filter);
cd84c2ac 90void dsos__fprintf(FILE *fp);
9e03eb2d 91size_t dsos__fprintf_buildid(FILE *fp);
a2928c42 92
9e03eb2d 93size_t dso__fprintf_buildid(struct dso *self, FILE *fp);
a2928c42 94size_t dso__fprintf(struct dso *self, FILE *fp);
94cb9e38 95char dso__symtab_origin(const struct dso *self);
8d06367f 96void dso__set_build_id(struct dso *self, void *build_id);
a2928c42 97
2643ce11 98int filename__read_build_id(const char *filename, void *bf, size_t size);
f1617b40 99int sysfs__read_build_id(const char *filename, void *bf, size_t size);
e30a3d12 100bool dsos__read_build_ids(void);
8d06367f 101int build_id__sprintf(u8 *self, int len, char *bf);
2643ce11 102
c338aee8 103size_t kernel_maps__fprintf(FILE *fp);
cd84c2ac 104
b32d133a 105int symbol__init(struct symbol_conf *conf);
cd84c2ac 106
b0da954a 107extern struct list_head dsos__user, dsos__kernel;
cd84c2ac 108extern struct dso *vdso;
8b40f521 109#endif /* __PERF_SYMBOL */