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