John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 1 | #ifndef __PERF_SYMBOL |
| 2 | #define __PERF_SYMBOL 1 |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 3 | |
| 4 | #include <linux/types.h> |
Arnaldo Carvalho de Melo | e420499 | 2009-10-20 14:25:40 -0200 | [diff] [blame] | 5 | #include <stdbool.h> |
Arnaldo Carvalho de Melo | 5aab621 | 2010-03-25 19:59:00 -0300 | [diff] [blame] | 6 | #include <stdint.h> |
| 7 | #include "map.h" |
Roberto Agostino Vitillo | b538752 | 2012-02-09 23:21:01 +0100 | [diff] [blame] | 8 | #include "../perf.h" |
Arnaldo Carvalho de Melo | 5da5025 | 2009-07-01 14:46:08 -0300 | [diff] [blame] | 9 | #include <linux/list.h> |
Arnaldo Carvalho de Melo | 43cbcd8 | 2009-07-01 12:28:37 -0300 | [diff] [blame] | 10 | #include <linux/rbtree.h> |
Arnaldo Carvalho de Melo | 5aab621 | 2010-03-25 19:59:00 -0300 | [diff] [blame] | 11 | #include <stdio.h> |
Jiri Olsa | 8db4841 | 2012-05-30 14:23:42 +0200 | [diff] [blame] | 12 | #include <byteswap.h> |
Irina Tirdea | b771a83 | 2012-09-08 03:43:17 +0300 | [diff] [blame] | 13 | #include <libgen.h> |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 14 | |
Cody P Schafer | b68e2f9 | 2012-08-10 15:22:57 -0700 | [diff] [blame] | 15 | #ifndef NO_LIBELF_SUPPORT |
| 16 | #include <libelf.h> |
| 17 | #include <gelf.h> |
| 18 | #include <elf.h> |
| 19 | #endif |
| 20 | |
Arnaldo Carvalho de Melo | 247648e | 2009-08-11 16:22:11 -0300 | [diff] [blame] | 21 | #ifdef HAVE_CPLUS_DEMANGLE |
| 22 | extern char *cplus_demangle(const char *, int); |
| 23 | |
Irina Tirdea | 1d037ca | 2012-09-11 01:15:03 +0300 | [diff] [blame^] | 24 | static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i) |
Arnaldo Carvalho de Melo | 247648e | 2009-08-11 16:22:11 -0300 | [diff] [blame] | 25 | { |
| 26 | return cplus_demangle(c, i); |
| 27 | } |
| 28 | #else |
| 29 | #ifdef NO_DEMANGLE |
Irina Tirdea | 1d037ca | 2012-09-11 01:15:03 +0300 | [diff] [blame^] | 30 | static inline char *bfd_demangle(void __maybe_unused *v, |
| 31 | const char __maybe_unused *c, |
| 32 | int __maybe_unused i) |
Arnaldo Carvalho de Melo | 247648e | 2009-08-11 16:22:11 -0300 | [diff] [blame] | 33 | { |
| 34 | return NULL; |
| 35 | } |
| 36 | #else |
| 37 | #include <bfd.h> |
| 38 | #endif |
| 39 | #endif |
| 40 | |
Arnaldo Carvalho de Melo | 5aab621 | 2010-03-25 19:59:00 -0300 | [diff] [blame] | 41 | int hex2u64(const char *ptr, u64 *val); |
| 42 | char *strxfrchar(char *s, char from, char to); |
| 43 | |
Marti Raudsepp | 8408712 | 2009-10-24 19:10:36 +0300 | [diff] [blame] | 44 | /* |
| 45 | * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; |
| 46 | * for newer versions we can use mmap to reduce memory usage: |
| 47 | */ |
| 48 | #ifdef LIBELF_NO_MMAP |
| 49 | # define PERF_ELF_C_READ_MMAP ELF_C_READ |
| 50 | #else |
| 51 | # define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP |
| 52 | #endif |
| 53 | |
Arnaldo Carvalho de Melo | 247648e | 2009-08-11 16:22:11 -0300 | [diff] [blame] | 54 | #ifndef DMGL_PARAMS |
| 55 | #define DMGL_PARAMS (1 << 0) /* Include function args */ |
| 56 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ |
| 57 | #endif |
| 58 | |
Arnaldo Carvalho de Melo | 5aab621 | 2010-03-25 19:59:00 -0300 | [diff] [blame] | 59 | #define BUILD_ID_SIZE 20 |
| 60 | |
Arnaldo Carvalho de Melo | 171b3be | 2011-03-11 13:36:01 -0300 | [diff] [blame] | 61 | /** struct symbol - symtab entry |
| 62 | * |
| 63 | * @ignore - resolvable but tools ignore it (e.g. idle routines) |
| 64 | */ |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 65 | struct symbol { |
| 66 | struct rb_node rb_node; |
Paul Mackerras | 9cffa8d | 2009-06-19 22:21:42 +1000 | [diff] [blame] | 67 | u64 start; |
| 68 | u64 end; |
Arnaldo Carvalho de Melo | fefb0b9 | 2010-05-10 13:57:51 -0300 | [diff] [blame] | 69 | u16 namelen; |
Arnaldo Carvalho de Melo | c408fed | 2010-08-05 12:59:47 -0300 | [diff] [blame] | 70 | u8 binding; |
Arnaldo Carvalho de Melo | 171b3be | 2011-03-11 13:36:01 -0300 | [diff] [blame] | 71 | bool ignore; |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 72 | char name[0]; |
| 73 | }; |
| 74 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 75 | void symbol__delete(struct symbol *sym); |
Arnaldo Carvalho de Melo | 628ada0 | 2010-02-25 12:57:40 -0300 | [diff] [blame] | 76 | |
Arnaldo Carvalho de Melo | 1b2e2df | 2012-04-19 10:57:06 -0300 | [diff] [blame] | 77 | static inline size_t symbol__size(const struct symbol *sym) |
| 78 | { |
| 79 | return sym->end - sym->start + 1; |
| 80 | } |
| 81 | |
Arnaldo Carvalho de Melo | 655000e | 2009-12-15 20:04:40 -0200 | [diff] [blame] | 82 | struct strlist; |
| 83 | |
Arnaldo Carvalho de Melo | b32d133 | 2009-11-24 12:05:15 -0200 | [diff] [blame] | 84 | struct symbol_conf { |
| 85 | unsigned short priv_size; |
Arnaldo Carvalho de Melo | d04b35f | 2011-11-11 22:17:32 -0200 | [diff] [blame] | 86 | unsigned short nr_events; |
Arnaldo Carvalho de Melo | b32d133 | 2009-11-24 12:05:15 -0200 | [diff] [blame] | 87 | bool try_vmlinux_path, |
Akihiro Nagai | 0bc8d20 | 2012-01-30 13:43:20 +0900 | [diff] [blame] | 88 | show_kernel_path, |
Arnaldo Carvalho de Melo | 79406cd | 2009-12-11 18:50:22 -0200 | [diff] [blame] | 89 | use_modules, |
Arnaldo Carvalho de Melo | d599db3 | 2009-12-15 20:04:42 -0200 | [diff] [blame] | 90 | sort_by_name, |
| 91 | show_nr_samples, |
Arnaldo Carvalho de Melo | 3f2728b | 2011-10-05 16:10:06 -0300 | [diff] [blame] | 92 | show_total_period, |
Arnaldo Carvalho de Melo | d599db3 | 2009-12-15 20:04:42 -0200 | [diff] [blame] | 93 | use_callchain, |
Arnaldo Carvalho de Melo | f7d8744 | 2009-12-27 21:37:04 -0200 | [diff] [blame] | 94 | exclude_other, |
Jovi Zhang | 85e00b5 | 2010-09-09 13:30:59 -0300 | [diff] [blame] | 95 | show_cpu_utilization, |
Arnaldo Carvalho de Melo | ec80fde | 2011-05-26 09:53:51 -0300 | [diff] [blame] | 96 | initialized, |
Stephane Eranian | 3e6a2a7 | 2011-05-17 17:32:07 +0200 | [diff] [blame] | 97 | kptr_restrict, |
| 98 | annotate_asm_raw, |
| 99 | annotate_src; |
Arnaldo Carvalho de Melo | c410a33 | 2009-12-15 20:04:41 -0200 | [diff] [blame] | 100 | const char *vmlinux_name, |
David Ahern | b226a5a7 | 2010-12-07 19:39:46 -0700 | [diff] [blame] | 101 | *kallsyms_name, |
Chase Douglas | 9ed7e1b | 2010-06-14 15:26:30 -0400 | [diff] [blame] | 102 | *source_prefix, |
Arnaldo Carvalho de Melo | c410a33 | 2009-12-15 20:04:41 -0200 | [diff] [blame] | 103 | *field_sep; |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 104 | const char *default_guest_vmlinux_name, |
| 105 | *default_guest_kallsyms, |
| 106 | *default_guest_modules; |
| 107 | const char *guestmount; |
Arnaldo Carvalho de Melo | edb7c60 | 2010-05-17 16:22:41 -0300 | [diff] [blame] | 108 | const char *dso_list_str, |
Arnaldo Carvalho de Melo | 655000e | 2009-12-15 20:04:40 -0200 | [diff] [blame] | 109 | *comm_list_str, |
| 110 | *sym_list_str, |
| 111 | *col_width_list_str; |
| 112 | struct strlist *dso_list, |
| 113 | *comm_list, |
Stephane Eranian | a68c2c5 | 2012-03-08 23:47:48 +0100 | [diff] [blame] | 114 | *sym_list, |
| 115 | *dso_from_list, |
| 116 | *dso_to_list, |
| 117 | *sym_from_list, |
| 118 | *sym_to_list; |
David Ahern | ec5761e | 2010-12-09 13:27:07 -0700 | [diff] [blame] | 119 | const char *symfs; |
Arnaldo Carvalho de Melo | b32d133 | 2009-11-24 12:05:15 -0200 | [diff] [blame] | 120 | }; |
| 121 | |
Arnaldo Carvalho de Melo | 75be6cf | 2009-12-15 20:04:39 -0200 | [diff] [blame] | 122 | extern struct symbol_conf symbol_conf; |
Arnaldo Carvalho de Melo | 00a192b | 2009-10-30 16:28:24 -0200 | [diff] [blame] | 123 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 124 | static inline void *symbol__priv(struct symbol *sym) |
Arnaldo Carvalho de Melo | 00a192b | 2009-10-30 16:28:24 -0200 | [diff] [blame] | 125 | { |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 126 | return ((void *)sym) - symbol_conf.priv_size; |
Arnaldo Carvalho de Melo | 00a192b | 2009-10-30 16:28:24 -0200 | [diff] [blame] | 127 | } |
| 128 | |
Arnaldo Carvalho de Melo | 9de89fe | 2010-02-03 16:52:00 -0200 | [diff] [blame] | 129 | struct ref_reloc_sym { |
| 130 | const char *name; |
| 131 | u64 addr; |
| 132 | u64 unrelocated_addr; |
| 133 | }; |
| 134 | |
Arnaldo Carvalho de Melo | 59fd530 | 2010-03-24 16:40:17 -0300 | [diff] [blame] | 135 | struct map_symbol { |
| 136 | struct map *map; |
| 137 | struct symbol *sym; |
Arnaldo Carvalho de Melo | 0f0cbf7 | 2010-07-26 17:13:40 -0300 | [diff] [blame] | 138 | bool unfolded; |
| 139 | bool has_children; |
Arnaldo Carvalho de Melo | 59fd530 | 2010-03-24 16:40:17 -0300 | [diff] [blame] | 140 | }; |
| 141 | |
Roberto Agostino Vitillo | b538752 | 2012-02-09 23:21:01 +0100 | [diff] [blame] | 142 | struct addr_map_symbol { |
| 143 | struct map *map; |
| 144 | struct symbol *sym; |
| 145 | u64 addr; |
Stephane Eranian | a68c2c5 | 2012-03-08 23:47:48 +0100 | [diff] [blame] | 146 | u64 al_addr; |
Roberto Agostino Vitillo | b538752 | 2012-02-09 23:21:01 +0100 | [diff] [blame] | 147 | }; |
| 148 | |
| 149 | struct branch_info { |
| 150 | struct addr_map_symbol from; |
| 151 | struct addr_map_symbol to; |
| 152 | struct branch_flags flags; |
| 153 | }; |
| 154 | |
Arnaldo Carvalho de Melo | 1ed091c | 2009-11-27 16:29:23 -0200 | [diff] [blame] | 155 | struct addr_location { |
| 156 | struct thread *thread; |
| 157 | struct map *map; |
| 158 | struct symbol *sym; |
| 159 | u64 addr; |
| 160 | char level; |
Arnaldo Carvalho de Melo | c410a33 | 2009-12-15 20:04:41 -0200 | [diff] [blame] | 161 | bool filtered; |
Arun Sharma | f60f359 | 2010-06-04 11:27:10 -0300 | [diff] [blame] | 162 | u8 cpumode; |
| 163 | s32 cpu; |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 164 | }; |
| 165 | |
Jiri Olsa | 44f24cb | 2012-07-22 14:14:32 +0200 | [diff] [blame] | 166 | enum dso_binary_type { |
| 167 | DSO_BINARY_TYPE__KALLSYMS = 0, |
| 168 | DSO_BINARY_TYPE__GUEST_KALLSYMS, |
Cody P Schafer | 21ea453 | 2012-08-10 15:22:56 -0700 | [diff] [blame] | 169 | DSO_BINARY_TYPE__VMLINUX, |
| 170 | DSO_BINARY_TYPE__GUEST_VMLINUX, |
Jiri Olsa | 44f24cb | 2012-07-22 14:14:32 +0200 | [diff] [blame] | 171 | DSO_BINARY_TYPE__JAVA_JIT, |
| 172 | DSO_BINARY_TYPE__DEBUGLINK, |
| 173 | DSO_BINARY_TYPE__BUILD_ID_CACHE, |
| 174 | DSO_BINARY_TYPE__FEDORA_DEBUGINFO, |
| 175 | DSO_BINARY_TYPE__UBUNTU_DEBUGINFO, |
| 176 | DSO_BINARY_TYPE__BUILDID_DEBUGINFO, |
| 177 | DSO_BINARY_TYPE__SYSTEM_PATH_DSO, |
| 178 | DSO_BINARY_TYPE__GUEST_KMODULE, |
| 179 | DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE, |
| 180 | DSO_BINARY_TYPE__NOT_FOUND, |
| 181 | }; |
| 182 | |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 183 | enum dso_kernel_type { |
| 184 | DSO_TYPE_USER = 0, |
| 185 | DSO_TYPE_KERNEL, |
| 186 | DSO_TYPE_GUEST_KERNEL |
Arnaldo Carvalho de Melo | 1ed091c | 2009-11-27 16:29:23 -0200 | [diff] [blame] | 187 | }; |
| 188 | |
Jiri Olsa | 8db4841 | 2012-05-30 14:23:42 +0200 | [diff] [blame] | 189 | enum dso_swap_type { |
| 190 | DSO_SWAP__UNSET, |
| 191 | DSO_SWAP__NO, |
| 192 | DSO_SWAP__YES, |
| 193 | }; |
| 194 | |
Jiri Olsa | 4dff624 | 2012-07-22 14:14:39 +0200 | [diff] [blame] | 195 | #define DSO__DATA_CACHE_SIZE 4096 |
| 196 | #define DSO__DATA_CACHE_MASK ~(DSO__DATA_CACHE_SIZE - 1) |
| 197 | |
| 198 | struct dso_cache { |
| 199 | struct rb_node rb_node; |
| 200 | u64 offset; |
| 201 | u64 size; |
| 202 | char data[0]; |
| 203 | }; |
| 204 | |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 205 | struct dso { |
| 206 | struct list_head node; |
Arnaldo Carvalho de Melo | 6a4694a | 2009-11-27 16:29:17 -0200 | [diff] [blame] | 207 | struct rb_root symbols[MAP__NR_TYPES]; |
Arnaldo Carvalho de Melo | 79406cd | 2009-12-11 18:50:22 -0200 | [diff] [blame] | 208 | struct rb_root symbol_names[MAP__NR_TYPES]; |
Jiri Olsa | 4dff624 | 2012-07-22 14:14:39 +0200 | [diff] [blame] | 209 | struct rb_root cache; |
Arnaldo Carvalho de Melo | 6e40625 | 2010-07-29 15:11:30 -0300 | [diff] [blame] | 210 | enum dso_kernel_type kernel; |
Jiri Olsa | 8db4841 | 2012-05-30 14:23:42 +0200 | [diff] [blame] | 211 | enum dso_swap_type needs_swap; |
Jiri Olsa | 44f24cb | 2012-07-22 14:14:32 +0200 | [diff] [blame] | 212 | enum dso_binary_type symtab_type; |
Jiri Olsa | 949d160 | 2012-07-22 14:14:33 +0200 | [diff] [blame] | 213 | enum dso_binary_type data_type; |
Arnaldo Carvalho de Melo | 8d06367 | 2009-11-04 18:50:43 -0200 | [diff] [blame] | 214 | u8 adjust_symbols:1; |
Arnaldo Carvalho de Melo | 8d06367 | 2009-11-04 18:50:43 -0200 | [diff] [blame] | 215 | u8 has_build_id:1; |
Arnaldo Carvalho de Melo | 88d3d9b7 | 2010-01-14 23:45:30 -0200 | [diff] [blame] | 216 | u8 hit:1; |
Arnaldo Carvalho de Melo | d06d92b | 2010-03-15 13:04:33 -0300 | [diff] [blame] | 217 | u8 annotate_warned:1; |
Arnaldo Carvalho de Melo | 6e40625 | 2010-07-29 15:11:30 -0300 | [diff] [blame] | 218 | u8 sname_alloc:1; |
| 219 | u8 lname_alloc:1; |
Arnaldo Carvalho de Melo | 79406cd | 2009-12-11 18:50:22 -0200 | [diff] [blame] | 220 | u8 sorted_by_name; |
Arnaldo Carvalho de Melo | 3610583 | 2009-11-27 16:29:16 -0200 | [diff] [blame] | 221 | u8 loaded; |
Arnaldo Carvalho de Melo | 8d06367 | 2009-11-04 18:50:43 -0200 | [diff] [blame] | 222 | u8 build_id[BUILD_ID_SIZE]; |
Arnaldo Carvalho de Melo | 439d473 | 2009-10-02 03:29:58 -0300 | [diff] [blame] | 223 | const char *short_name; |
| 224 | char *long_name; |
Arnaldo Carvalho de Melo | b63be8d | 2010-03-15 15:03:50 -0300 | [diff] [blame] | 225 | u16 long_name_len; |
| 226 | u16 short_name_len; |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 227 | char name[0]; |
| 228 | }; |
| 229 | |
Cody P Schafer | b68e2f9 | 2012-08-10 15:22:57 -0700 | [diff] [blame] | 230 | struct symsrc { |
| 231 | char *name; |
| 232 | int fd; |
| 233 | enum dso_binary_type type; |
| 234 | |
| 235 | #ifndef NO_LIBELF_SUPPORT |
| 236 | Elf *elf; |
| 237 | GElf_Ehdr ehdr; |
| 238 | |
| 239 | Elf_Scn *opdsec; |
| 240 | size_t opdidx; |
| 241 | GElf_Shdr opdshdr; |
| 242 | |
| 243 | Elf_Scn *symtab; |
| 244 | GElf_Shdr symshdr; |
| 245 | |
| 246 | Elf_Scn *dynsym; |
| 247 | size_t dynsym_idx; |
| 248 | GElf_Shdr dynshdr; |
| 249 | |
| 250 | bool adjust_symbols; |
| 251 | #endif |
| 252 | }; |
| 253 | |
| 254 | void symsrc__destroy(struct symsrc *ss); |
| 255 | int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, |
| 256 | enum dso_binary_type type); |
Cody P Schafer | d26cd12 | 2012-08-10 15:23:00 -0700 | [diff] [blame] | 257 | bool symsrc__has_symtab(struct symsrc *ss); |
Cody P Schafer | 3aafe5a | 2012-08-10 15:23:02 -0700 | [diff] [blame] | 258 | bool symsrc__possibly_runtime(struct symsrc *ss); |
Cody P Schafer | b68e2f9 | 2012-08-10 15:22:57 -0700 | [diff] [blame] | 259 | |
Jiri Olsa | 8db4841 | 2012-05-30 14:23:42 +0200 | [diff] [blame] | 260 | #define DSO__SWAP(dso, type, val) \ |
| 261 | ({ \ |
| 262 | type ____r = val; \ |
| 263 | BUG_ON(dso->needs_swap == DSO_SWAP__UNSET); \ |
| 264 | if (dso->needs_swap == DSO_SWAP__YES) { \ |
| 265 | switch (sizeof(____r)) { \ |
| 266 | case 2: \ |
| 267 | ____r = bswap_16(val); \ |
| 268 | break; \ |
| 269 | case 4: \ |
| 270 | ____r = bswap_32(val); \ |
| 271 | break; \ |
| 272 | case 8: \ |
| 273 | ____r = bswap_64(val); \ |
| 274 | break; \ |
| 275 | default: \ |
| 276 | BUG_ON(1); \ |
| 277 | } \ |
| 278 | } \ |
| 279 | ____r; \ |
| 280 | }) |
| 281 | |
Arnaldo Carvalho de Melo | 00a192b | 2009-10-30 16:28:24 -0200 | [diff] [blame] | 282 | struct dso *dso__new(const char *name); |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 283 | void dso__delete(struct dso *dso); |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 284 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 285 | int dso__name_len(const struct dso *dso); |
Arnaldo Carvalho de Melo | 8a6c5b2 | 2010-07-20 14:42:52 -0300 | [diff] [blame] | 286 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 287 | bool dso__loaded(const struct dso *dso, enum map_type type); |
| 288 | bool dso__sorted_by_name(const struct dso *dso, enum map_type type); |
Arnaldo Carvalho de Melo | 79406cd | 2009-12-11 18:50:22 -0200 | [diff] [blame] | 289 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 290 | static inline void dso__set_loaded(struct dso *dso, enum map_type type) |
Arnaldo Carvalho de Melo | 8d92c02 | 2010-02-03 16:52:02 -0200 | [diff] [blame] | 291 | { |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 292 | dso->loaded |= (1 << type); |
Arnaldo Carvalho de Melo | 8d92c02 | 2010-02-03 16:52:02 -0200 | [diff] [blame] | 293 | } |
| 294 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 295 | void dso__sort_by_name(struct dso *dso, enum map_type type); |
Arnaldo Carvalho de Melo | 3610583 | 2009-11-27 16:29:16 -0200 | [diff] [blame] | 296 | |
Namhyung Kim | e5a1845 | 2012-08-06 13:41:20 +0900 | [diff] [blame] | 297 | void dsos__add(struct list_head *head, struct dso *dso); |
Jiri Olsa | 1c4be9f | 2012-09-10 18:50:18 +0200 | [diff] [blame] | 298 | struct dso *dsos__find(struct list_head *head, const char *name); |
Arnaldo Carvalho de Melo | a89e5abe | 2010-01-07 19:59:39 -0200 | [diff] [blame] | 299 | struct dso *__dsos__findnew(struct list_head *head, const char *name); |
| 300 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 301 | int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter); |
| 302 | int dso__load_vmlinux(struct dso *dso, struct map *map, |
Franck Bui-Huu | fd930ff | 2010-12-10 14:06:03 +0100 | [diff] [blame] | 303 | const char *vmlinux, symbol_filter_t filter); |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 304 | int dso__load_vmlinux_path(struct dso *dso, struct map *map, |
Arnaldo Carvalho de Melo | 9de89fe | 2010-02-03 16:52:00 -0200 | [diff] [blame] | 305 | symbol_filter_t filter); |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 306 | int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, |
Arnaldo Carvalho de Melo | 9de89fe | 2010-02-03 16:52:00 -0200 | [diff] [blame] | 307 | symbol_filter_t filter); |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 308 | int machine__load_kallsyms(struct machine *machine, const char *filename, |
Arnaldo Carvalho de Melo | 5c0541d | 2010-04-29 15:25:23 -0300 | [diff] [blame] | 309 | enum map_type type, symbol_filter_t filter); |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 310 | int machine__load_vmlinux_path(struct machine *machine, enum map_type type, |
Arnaldo Carvalho de Melo | 5c0541d | 2010-04-29 15:25:23 -0300 | [diff] [blame] | 311 | symbol_filter_t filter); |
| 312 | |
Arnaldo Carvalho de Melo | 1f626bc | 2010-05-09 19:57:08 -0300 | [diff] [blame] | 313 | size_t __dsos__fprintf(struct list_head *head, FILE *fp); |
| 314 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 315 | size_t machine__fprintf_dsos_buildid(struct machine *machine, |
| 316 | FILE *fp, bool with_hits); |
| 317 | size_t machines__fprintf_dsos(struct rb_root *machines, FILE *fp); |
| 318 | size_t machines__fprintf_dsos_buildid(struct rb_root *machines, |
| 319 | FILE *fp, bool with_hits); |
| 320 | size_t dso__fprintf_buildid(struct dso *dso, FILE *fp); |
| 321 | size_t dso__fprintf_symbols_by_name(struct dso *dso, |
| 322 | enum map_type type, FILE *fp); |
| 323 | size_t dso__fprintf(struct dso *dso, enum map_type type, FILE *fp); |
Arnaldo Carvalho de Melo | b0a9ab6 | 2010-03-15 11:46:58 -0300 | [diff] [blame] | 324 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 325 | char dso__symtab_origin(const struct dso *dso); |
| 326 | void dso__set_long_name(struct dso *dso, char *name); |
| 327 | void dso__set_build_id(struct dso *dso, void *build_id); |
Namhyung Kim | e5a1845 | 2012-08-06 13:41:20 +0900 | [diff] [blame] | 328 | bool dso__build_id_equal(const struct dso *dso, u8 *build_id); |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 329 | void dso__read_running_kernel_build_id(struct dso *dso, |
| 330 | struct machine *machine); |
Srikar Dronamraju | 225466f | 2012-04-16 17:39:09 +0530 | [diff] [blame] | 331 | struct map *dso__new_map(const char *name); |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 332 | struct symbol *dso__find_symbol(struct dso *dso, enum map_type type, |
| 333 | u64 addr); |
| 334 | struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type, |
Arnaldo Carvalho de Melo | 79406cd | 2009-12-11 18:50:22 -0200 | [diff] [blame] | 335 | const char *name); |
Arnaldo Carvalho de Melo | a2928c4 | 2009-05-28 14:55:04 -0300 | [diff] [blame] | 336 | |
Arnaldo Carvalho de Melo | 2643ce114 | 2009-11-03 21:46:10 -0200 | [diff] [blame] | 337 | int filename__read_build_id(const char *filename, void *bf, size_t size); |
Arnaldo Carvalho de Melo | f1617b4 | 2009-11-18 20:20:52 -0200 | [diff] [blame] | 338 | int sysfs__read_build_id(const char *filename, void *bf, size_t size); |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 339 | bool __dsos__read_build_ids(struct list_head *head, bool with_hits); |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 340 | int build_id__sprintf(const u8 *build_id, int len, char *bf); |
Arnaldo Carvalho de Melo | 9e20144 | 2010-01-14 18:30:06 -0200 | [diff] [blame] | 341 | int kallsyms__parse(const char *filename, void *arg, |
| 342 | int (*process_symbol)(void *arg, const char *name, |
Cody P Schafer | 8215152 | 2012-08-10 15:22:48 -0700 | [diff] [blame] | 343 | char type, u64 start)); |
Namhyung Kim | e5a1845 | 2012-08-06 13:41:20 +0900 | [diff] [blame] | 344 | int filename__read_debuglink(const char *filename, char *debuglink, |
| 345 | size_t size); |
Arnaldo Carvalho de Melo | 2643ce114 | 2009-11-03 21:46:10 -0200 | [diff] [blame] | 346 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 347 | void machine__destroy_kernel_maps(struct machine *machine); |
| 348 | int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel); |
| 349 | int machine__create_kernel_maps(struct machine *machine); |
Arnaldo Carvalho de Melo | 5c0541d | 2010-04-29 15:25:23 -0300 | [diff] [blame] | 350 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 351 | int machines__create_kernel_maps(struct rb_root *machines, pid_t pid); |
| 352 | int machines__create_guest_kernel_maps(struct rb_root *machines); |
| 353 | void machines__destroy_guest_kernel_maps(struct rb_root *machines); |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 354 | |
Arnaldo Carvalho de Melo | 75be6cf | 2009-12-15 20:04:39 -0200 | [diff] [blame] | 355 | int symbol__init(void); |
Arnaldo Carvalho de Melo | d65a458 | 2010-07-30 18:31:28 -0300 | [diff] [blame] | 356 | void symbol__exit(void); |
Namhyung Kim | 166ccc9 | 2012-08-06 13:41:19 +0900 | [diff] [blame] | 357 | void symbol__elf_init(void); |
Namhyung Kim | e5a1845 | 2012-08-06 13:41:20 +0900 | [diff] [blame] | 358 | struct symbol *symbol__new(u64 start, u64 len, u8 binding, const char *name); |
Akihiro Nagai | a978f2a | 2012-01-30 13:43:15 +0900 | [diff] [blame] | 359 | size_t symbol__fprintf_symname_offs(const struct symbol *sym, |
| 360 | const struct addr_location *al, FILE *fp); |
Akihiro Nagai | 547a92e | 2012-01-30 13:42:57 +0900 | [diff] [blame] | 361 | size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp); |
Arnaldo Carvalho de Melo | 36a3e64 | 2010-01-04 16:19:27 -0200 | [diff] [blame] | 362 | bool symbol_type__is_a(char symbol_type, enum map_type map_type); |
| 363 | |
Arnaldo Carvalho de Melo | aeafcba | 2011-03-31 10:56:28 -0300 | [diff] [blame] | 364 | size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp); |
Arnaldo Carvalho de Melo | b0a9ab6 | 2010-03-15 11:46:58 -0300 | [diff] [blame] | 365 | |
Jiri Olsa | 44f24cb | 2012-07-22 14:14:32 +0200 | [diff] [blame] | 366 | int dso__binary_type_file(struct dso *dso, enum dso_binary_type type, |
| 367 | char *root_dir, char *file, size_t size); |
Jiri Olsa | 949d160 | 2012-07-22 14:14:33 +0200 | [diff] [blame] | 368 | |
| 369 | int dso__data_fd(struct dso *dso, struct machine *machine); |
| 370 | ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine, |
| 371 | u64 offset, u8 *data, ssize_t size); |
| 372 | ssize_t dso__data_read_addr(struct dso *dso, struct map *map, |
| 373 | struct machine *machine, u64 addr, |
| 374 | u8 *data, ssize_t size); |
Jiri Olsa | f7add55 | 2012-07-22 14:14:40 +0200 | [diff] [blame] | 375 | int dso__test_data(void); |
Cody P Schafer | 261360b | 2012-08-10 15:23:01 -0700 | [diff] [blame] | 376 | int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, |
| 377 | struct symsrc *runtime_ss, symbol_filter_t filter, |
| 378 | int kmodule); |
Cody P Schafer | a44f605 | 2012-08-10 15:22:59 -0700 | [diff] [blame] | 379 | int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, |
| 380 | struct map *map, symbol_filter_t filter); |
Namhyung Kim | e5a1845 | 2012-08-06 13:41:20 +0900 | [diff] [blame] | 381 | |
| 382 | void symbols__insert(struct rb_root *symbols, struct symbol *sym); |
| 383 | void symbols__fixup_duplicate(struct rb_root *symbols); |
| 384 | void symbols__fixup_end(struct rb_root *symbols); |
| 385 | void __map_groups__fixup_end(struct map_groups *mg, enum map_type type); |
| 386 | |
John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 387 | #endif /* __PERF_SYMBOL */ |