perf report: Generalize perf_session__fprintf_hists()
[deliverable/linux.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
655000e7
ACM
52struct strlist;
53
b32d133a
ACM
54struct symbol_conf {
55 unsigned short priv_size;
56 bool try_vmlinux_path,
79406cd7 57 use_modules,
d599db3f
ACM
58 sort_by_name,
59 show_nr_samples,
60 use_callchain,
61 exclude_other;
c410a338
ACM
62 const char *vmlinux_name,
63 *field_sep;
655000e7
ACM
64 char *dso_list_str,
65 *comm_list_str,
66 *sym_list_str,
67 *col_width_list_str;
68 struct strlist *dso_list,
69 *comm_list,
70 *sym_list;
b32d133a
ACM
71};
72
75be6cf4 73extern struct symbol_conf symbol_conf;
00a192b3
ACM
74
75static inline void *symbol__priv(struct symbol *self)
76{
75be6cf4 77 return ((void *)self) - symbol_conf.priv_size;
00a192b3
ACM
78}
79
1ed091c4
ACM
80struct addr_location {
81 struct thread *thread;
82 struct map *map;
83 struct symbol *sym;
84 u64 addr;
85 char level;
c410a338 86 bool filtered;
1ed091c4
ACM
87};
88
a2928c42
ACM
89struct dso {
90 struct list_head node;
6a4694a4 91 struct rb_root symbols[MAP__NR_TYPES];
79406cd7 92 struct rb_root symbol_names[MAP__NR_TYPES];
8d06367f
ACM
93 u8 adjust_symbols:1;
94 u8 slen_calculated:1;
8d06367f 95 u8 has_build_id:1;
c338aee8 96 u8 kernel:1;
94cb9e38 97 unsigned char origin;
79406cd7 98 u8 sorted_by_name;
3610583c 99 u8 loaded;
8d06367f 100 u8 build_id[BUILD_ID_SIZE];
cfc10d3b 101 u16 long_name_len;
439d473b
ACM
102 const char *short_name;
103 char *long_name;
a2928c42
ACM
104 char name[0];
105};
106
00a192b3 107struct dso *dso__new(const char *name);
a2928c42
ACM
108void dso__delete(struct dso *self);
109
3610583c 110bool dso__loaded(const struct dso *self, enum map_type type);
79406cd7
ACM
111bool dso__sorted_by_name(const struct dso *self, enum map_type type);
112
113void dso__sort_by_name(struct dso *self, enum map_type type);
3610583c 114
4aa65636
ACM
115struct perf_session;
116
00a192b3 117struct dso *dsos__findnew(const char *name);
4aa65636
ACM
118int dso__load(struct dso *self, struct map *map, struct perf_session *session,
119 symbol_filter_t filter);
cd84c2ac 120void dsos__fprintf(FILE *fp);
9e03eb2d 121size_t dsos__fprintf_buildid(FILE *fp);
a2928c42 122
9e03eb2d 123size_t dso__fprintf_buildid(struct dso *self, FILE *fp);
95011c60 124size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp);
94cb9e38 125char dso__symtab_origin(const struct dso *self);
8d06367f 126void dso__set_build_id(struct dso *self, void *build_id);
ea08d8cb 127struct symbol *dso__find_symbol(struct dso *self, enum map_type type, u64 addr);
79406cd7
ACM
128struct symbol *dso__find_symbol_by_name(struct dso *self, enum map_type type,
129 const char *name);
a2928c42 130
2643ce11 131int filename__read_build_id(const char *filename, void *bf, size_t size);
f1617b40 132int sysfs__read_build_id(const char *filename, void *bf, size_t size);
e30a3d12 133bool dsos__read_build_ids(void);
8d06367f 134int build_id__sprintf(u8 *self, int len, char *bf);
2643ce11 135
75be6cf4
ACM
136int symbol__init(void);
137int perf_session__create_kernel_maps(struct perf_session *self);
cd84c2ac 138
b0da954a 139extern struct list_head dsos__user, dsos__kernel;
cd84c2ac 140extern struct dso *vdso;
8b40f521 141#endif /* __PERF_SYMBOL */
This page took 0.069068 seconds and 5 git commands to generate.