/linux-4.4.14/tools/perf/util/ |
H A D | dso.c | 5 #include "dso.h" 11 char dso__symtab_origin(const struct dso *dso) dso__symtab_origin() argument 32 if (dso == NULL || dso->symtab_type == DSO_BINARY_TYPE__NOT_FOUND) dso__symtab_origin() 34 return origin[dso->symtab_type]; dso__symtab_origin() 37 int dso__read_binary_type_filename(const struct dso *dso, dso__read_binary_type_filename() argument 49 len = __symbol__join_symfs(filename, size, dso->long_name); dso__read_binary_type_filename() 62 (dso__build_id_filename(dso, filename, size) == NULL)) dso__read_binary_type_filename() 68 snprintf(filename + len, size - len, "%s.debug", dso->long_name); dso__read_binary_type_filename() 73 snprintf(filename + len, size - len, "%s", dso->long_name); dso__read_binary_type_filename() 81 last_slash = dso->long_name + dso->long_name_len; dso__read_binary_type_filename() 82 while (last_slash != dso->long_name && *last_slash != '/') dso__read_binary_type_filename() 86 dir_size = last_slash - dso->long_name + 2; dso__read_binary_type_filename() 91 len += scnprintf(filename + len, dir_size, "%s", dso->long_name); dso__read_binary_type_filename() 98 if (!dso->has_build_id) { dso__read_binary_type_filename() 103 build_id__sprintf(dso->build_id, dso__read_binary_type_filename() 104 sizeof(dso->build_id), dso__read_binary_type_filename() 114 __symbol__join_symfs(filename, size, dso->long_name); dso__read_binary_type_filename() 120 root_dir, dso->long_name); dso__read_binary_type_filename() 125 __symbol__join_symfs(filename, size, dso->long_name); dso__read_binary_type_filename() 130 snprintf(filename, size, "%s", dso->long_name); dso__read_binary_type_filename() 207 bool dso__needs_decompress(struct dso *dso) dso__needs_decompress() argument 209 return dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP || dso__needs_decompress() 210 dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; dso__needs_decompress() 307 static void dso__list_add(struct dso *dso) dso__list_add() argument 309 list_add_tail(&dso->data.open_entry, &dso__data_open); dso__list_add() 313 static void dso__list_del(struct dso *dso) dso__list_del() argument 315 list_del(&dso->data.open_entry); dso__list_del() 333 pr_debug("dso open failed: %s\n", do_open() 344 static int __open_dso(struct dso *dso, struct machine *machine) __open_dso() argument 356 if (dso__read_binary_type_filename(dso, dso->binary_type, __open_dso() 371 * @dso: dso object 373 * Open @dso's data file descriptor and updates 376 static int open_dso(struct dso *dso, struct machine *machine) open_dso() argument 378 int fd = __open_dso(dso, machine); open_dso() 381 dso__list_add(dso); open_dso() 392 static void close_data_fd(struct dso *dso) close_data_fd() argument 394 if (dso->data.fd >= 0) { close_data_fd() 395 close(dso->data.fd); close_data_fd() 396 dso->data.fd = -1; close_data_fd() 397 dso->data.file_size = 0; close_data_fd() 398 dso__list_del(dso); close_data_fd() 404 * @dso: dso object 406 * Close @dso's data file descriptor and updates 409 static void close_dso(struct dso *dso) close_dso() argument 411 close_data_fd(dso); close_dso() 416 struct dso *dso; close_first_dso() local 418 dso = list_first_entry(&dso__data_open, struct dso, data.open_entry); close_first_dso() 419 close_dso(dso); close_first_dso() 455 * Check and close LRU dso if we crossed allowed limit 456 * for opened dso file descriptors. The limit is half 469 * @dso: dso object 471 * External interface to close @dso's data file descriptor. 473 void dso__data_close(struct dso *dso) dso__data_close() argument 476 close_dso(dso); dso__data_close() 480 static void try_to_open_dso(struct dso *dso, struct machine *machine) try_to_open_dso() argument 489 if (dso->data.fd >= 0) try_to_open_dso() 492 if (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND) { try_to_open_dso() 493 dso->data.fd = open_dso(dso, machine); try_to_open_dso() 498 dso->binary_type = binary_type_data[i++]; try_to_open_dso() 500 dso->data.fd = open_dso(dso, machine); try_to_open_dso() 501 if (dso->data.fd >= 0) try_to_open_dso() 504 } while (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND); try_to_open_dso() 506 if (dso->data.fd >= 0) try_to_open_dso() 507 dso->data.status = DSO_DATA_STATUS_OK; try_to_open_dso() 509 dso->data.status = DSO_DATA_STATUS_ERROR; try_to_open_dso() 513 * dso__data_get_fd - Get dso's data file descriptor 514 * @dso: dso object 517 * External interface to find dso's file, open it and 521 int dso__data_get_fd(struct dso *dso, struct machine *machine) dso__data_get_fd() argument 523 if (dso->data.status == DSO_DATA_STATUS_ERROR) dso__data_get_fd() 529 try_to_open_dso(dso, machine); dso__data_get_fd() 531 if (dso->data.fd < 0) dso__data_get_fd() 534 return dso->data.fd; dso__data_get_fd() 537 void dso__data_put_fd(struct dso *dso __maybe_unused) dso__data_put_fd() 542 bool dso__data_status_seen(struct dso *dso, enum dso_data_status_seen by) dso__data_status_seen() argument 546 if (dso->data.status_seen & flag) dso__data_status_seen() 549 dso->data.status_seen |= flag; dso__data_status_seen() 555 dso_cache__free(struct dso *dso) dso_cache__free() argument 557 struct rb_root *root = &dso->data.cache; dso_cache__free() 560 pthread_mutex_lock(&dso->lock); dso_cache__free() 569 pthread_mutex_unlock(&dso->lock); dso_cache__free() 572 static struct dso_cache *dso_cache__find(struct dso *dso, u64 offset) dso_cache__find() argument 574 const struct rb_root *root = &dso->data.cache; dso_cache__find() 598 dso_cache__insert(struct dso *dso, struct dso_cache *new) dso_cache__insert() argument 600 struct rb_root *root = &dso->data.cache; dso_cache__insert() 606 pthread_mutex_lock(&dso->lock); dso_cache__insert() 627 pthread_mutex_unlock(&dso->lock); dso_cache__insert() 643 dso_cache__read(struct dso *dso, struct machine *machine, dso_cache__read() argument 660 * dso->data.fd might be closed if other thread opened another dso_cache__read() 661 * file (dso) due to open file limit (RLIMIT_NOFILE). dso_cache__read() 663 try_to_open_dso(dso, machine); dso_cache__read() 665 if (dso->data.fd < 0) { dso_cache__read() 667 dso->data.status = DSO_DATA_STATUS_ERROR; dso_cache__read() 673 ret = pread(dso->data.fd, cache->data, DSO__DATA_CACHE_SIZE, cache_offset); dso_cache__read() 684 old = dso_cache__insert(dso, cache); dso_cache__read() 700 static ssize_t dso_cache_read(struct dso *dso, struct machine *machine, dso_cache_read() argument 705 cache = dso_cache__find(dso, offset); dso_cache_read() 709 return dso_cache__read(dso, machine, offset, data, size); dso_cache_read() 713 * Reads and caches dso data DSO__DATA_CACHE_SIZE size chunks 717 static ssize_t cached_read(struct dso *dso, struct machine *machine, cached_read() argument 726 ret = dso_cache_read(dso, machine, offset, p, size); cached_read() 746 static int data_file_size(struct dso *dso, struct machine *machine) data_file_size() argument 752 if (dso->data.file_size) data_file_size() 755 if (dso->data.status == DSO_DATA_STATUS_ERROR) data_file_size() 761 * dso->data.fd might be closed if other thread opened another data_file_size() 762 * file (dso) due to open file limit (RLIMIT_NOFILE). data_file_size() 764 try_to_open_dso(dso, machine); data_file_size() 766 if (dso->data.fd < 0) { data_file_size() 768 dso->data.status = DSO_DATA_STATUS_ERROR; data_file_size() 772 if (fstat(dso->data.fd, &st) < 0) { data_file_size() 774 pr_err("dso cache fstat failed: %s\n", data_file_size() 776 dso->data.status = DSO_DATA_STATUS_ERROR; data_file_size() 779 dso->data.file_size = st.st_size; data_file_size() 787 * dso__data_size - Return dso data size 788 * @dso: dso object 791 * Return: dso data size 793 off_t dso__data_size(struct dso *dso, struct machine *machine) dso__data_size() argument 795 if (data_file_size(dso, machine)) dso__data_size() 798 /* For now just estimate dso data size is close to file size */ dso__data_size() 799 return dso->data.file_size; dso__data_size() 802 static ssize_t data_read_offset(struct dso *dso, struct machine *machine, data_read_offset() argument 805 if (data_file_size(dso, machine)) data_read_offset() 809 if (offset > dso->data.file_size) data_read_offset() 815 return cached_read(dso, machine, offset, data, size); data_read_offset() 819 * dso__data_read_offset - Read data from dso file offset 820 * @dso: dso object 826 * External interface to read data from dso file offset. Open 827 * dso data file and use cached_read to get the data. 829 ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine, dso__data_read_offset() argument 832 if (dso->data.status == DSO_DATA_STATUS_ERROR) dso__data_read_offset() 835 return data_read_offset(dso, machine, offset, data, size); dso__data_read_offset() 839 * dso__data_read_addr - Read data from dso address 840 * @dso: dso object 846 * External interface to read data from dso address. 848 ssize_t dso__data_read_addr(struct dso *dso, struct map *map, dso__data_read_addr() argument 853 return dso__data_read_offset(dso, machine, offset, data, size); dso__data_read_addr() 859 struct dso *dso = dso__new(name); dso__new_map() local 861 if (dso) dso__new_map() 862 map = map__new2(0, dso, MAP__FUNCTION); dso__new_map() 867 struct dso *machine__findnew_kernel(struct machine *machine, const char *name, machine__findnew_kernel() 871 * The kernel dso could be created by build_id processing. machine__findnew_kernel() 873 struct dso *dso = machine__findnew_dso(machine, name); machine__findnew_kernel() local 877 * processing we had no idea this was the kernel dso. machine__findnew_kernel() 879 if (dso != NULL) { machine__findnew_kernel() 880 dso__set_short_name(dso, short_name, false); machine__findnew_kernel() 881 dso->kernel = dso_type; machine__findnew_kernel() 884 return dso; machine__findnew_kernel() 889 * Either one of the dso or name parameter must be non-NULL or the 892 static struct dso *__dso__findlink_by_longname(struct rb_root *root, __dso__findlink_by_longname() argument 893 struct dso *dso, const char *name) __dso__findlink_by_longname() 899 name = dso->long_name; __dso__findlink_by_longname() 904 struct dso *this = rb_entry(*p, struct dso, rb_node); __dso__findlink_by_longname() 914 if (!dso || (dso == this)) __dso__findlink_by_longname() 915 return this; /* Find matching dso */ __dso__findlink_by_longname() 921 rc = strcmp(dso->short_name, this->short_name); __dso__findlink_by_longname() 923 pr_err("Duplicated dso name: %s\n", name); __dso__findlink_by_longname() 932 if (dso) { __dso__findlink_by_longname() 934 rb_link_node(&dso->rb_node, parent, p); __dso__findlink_by_longname() 935 rb_insert_color(&dso->rb_node, root); __dso__findlink_by_longname() 936 dso->root = root; __dso__findlink_by_longname() 941 static inline struct dso *__dso__find_by_longname(struct rb_root *root, __dso__find_by_longname() 947 void dso__set_long_name(struct dso *dso, const char *name, bool name_allocated) dso__set_long_name() argument 949 struct rb_root *root = dso->root; dso__set_long_name() 954 if (dso->long_name_allocated) dso__set_long_name() 955 free((char *)dso->long_name); dso__set_long_name() 958 rb_erase(&dso->rb_node, root); dso__set_long_name() 963 RB_CLEAR_NODE(&dso->rb_node); dso__set_long_name() 964 dso->root = NULL; dso__set_long_name() 967 dso->long_name = name; dso__set_long_name() 968 dso->long_name_len = strlen(name); dso__set_long_name() 969 dso->long_name_allocated = name_allocated; dso__set_long_name() 972 __dso__findlink_by_longname(root, dso, NULL); dso__set_long_name() 975 void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated) dso__set_short_name() argument 980 if (dso->short_name_allocated) dso__set_short_name() 981 free((char *)dso->short_name); dso__set_short_name() 983 dso->short_name = name; dso__set_short_name() 984 dso->short_name_len = strlen(name); dso__set_short_name() 985 dso->short_name_allocated = name_allocated; dso__set_short_name() 988 static void dso__set_basename(struct dso *dso) dso__set_basename() argument 994 char *base, *lname = strdup(dso->long_name); dso__set_basename() 1011 dso__set_short_name(dso, base, true); dso__set_basename() 1014 int dso__name_len(const struct dso *dso) dso__name_len() argument 1016 if (!dso) dso__name_len() 1019 return dso->long_name_len; dso__name_len() 1021 return dso->short_name_len; dso__name_len() 1024 bool dso__loaded(const struct dso *dso, enum map_type type) dso__loaded() argument 1026 return dso->loaded & (1 << type); dso__loaded() 1029 bool dso__sorted_by_name(const struct dso *dso, enum map_type type) dso__sorted_by_name() argument 1031 return dso->sorted_by_name & (1 << type); dso__sorted_by_name() 1034 void dso__set_sorted_by_name(struct dso *dso, enum map_type type) dso__set_sorted_by_name() argument 1036 dso->sorted_by_name |= (1 << type); dso__set_sorted_by_name() 1039 struct dso *dso__new(const char *name) dso__new() 1041 struct dso *dso = calloc(1, sizeof(*dso) + strlen(name) + 1); dso__new() local 1043 if (dso != NULL) { dso__new() 1045 strcpy(dso->name, name); dso__new() 1046 dso__set_long_name(dso, dso->name, false); dso__new() 1047 dso__set_short_name(dso, dso->name, false); dso__new() 1049 dso->symbols[i] = dso->symbol_names[i] = RB_ROOT; dso__new() 1050 dso->data.cache = RB_ROOT; dso__new() 1051 dso->data.fd = -1; dso__new() 1052 dso->data.status = DSO_DATA_STATUS_UNKNOWN; dso__new() 1053 dso->symtab_type = DSO_BINARY_TYPE__NOT_FOUND; dso__new() 1054 dso->binary_type = DSO_BINARY_TYPE__NOT_FOUND; dso__new() 1055 dso->is_64_bit = (sizeof(void *) == 8); dso__new() 1056 dso->loaded = 0; dso__new() 1057 dso->rel = 0; dso__new() 1058 dso->sorted_by_name = 0; dso__new() 1059 dso->has_build_id = 0; dso__new() 1060 dso->has_srcline = 1; dso__new() 1061 dso->a2l_fails = 1; dso__new() 1062 dso->kernel = DSO_TYPE_USER; dso__new() 1063 dso->needs_swap = DSO_SWAP__UNSET; dso__new() 1064 RB_CLEAR_NODE(&dso->rb_node); dso__new() 1065 dso->root = NULL; dso__new() 1066 INIT_LIST_HEAD(&dso->node); dso__new() 1067 INIT_LIST_HEAD(&dso->data.open_entry); dso__new() 1068 pthread_mutex_init(&dso->lock, NULL); dso__new() 1069 atomic_set(&dso->refcnt, 1); dso__new() 1072 return dso; dso__new() 1075 void dso__delete(struct dso *dso) dso__delete() argument 1079 if (!RB_EMPTY_NODE(&dso->rb_node)) dso__delete() 1081 dso->long_name); dso__delete() 1083 symbols__delete(&dso->symbols[i]); dso__delete() 1085 if (dso->short_name_allocated) { dso__delete() 1086 zfree((char **)&dso->short_name); dso__delete() 1087 dso->short_name_allocated = false; dso__delete() 1090 if (dso->long_name_allocated) { dso__delete() 1091 zfree((char **)&dso->long_name); dso__delete() 1092 dso->long_name_allocated = false; dso__delete() 1095 dso__data_close(dso); dso__delete() 1096 auxtrace_cache__free(dso->auxtrace_cache); dso__delete() 1097 dso_cache__free(dso); dso__delete() 1098 dso__free_a2l(dso); dso__delete() 1099 zfree(&dso->symsrc_filename); dso__delete() 1100 pthread_mutex_destroy(&dso->lock); dso__delete() 1101 free(dso); dso__delete() 1104 struct dso *dso__get(struct dso *dso) dso__get() argument 1106 if (dso) dso__get() 1107 atomic_inc(&dso->refcnt); dso__get() 1108 return dso; dso__get() 1111 void dso__put(struct dso *dso) dso__put() argument 1113 if (dso && atomic_dec_and_test(&dso->refcnt)) dso__put() 1114 dso__delete(dso); dso__put() 1117 void dso__set_build_id(struct dso *dso, void *build_id) dso__set_build_id() argument 1119 memcpy(dso->build_id, build_id, sizeof(dso->build_id)); dso__set_build_id() 1120 dso->has_build_id = 1; dso__set_build_id() 1123 bool dso__build_id_equal(const struct dso *dso, u8 *build_id) dso__build_id_equal() argument 1125 return memcmp(dso->build_id, build_id, sizeof(dso->build_id)) == 0; dso__build_id_equal() 1128 void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine) dso__read_running_kernel_build_id() argument 1135 if (sysfs__read_build_id(path, dso->build_id, dso__read_running_kernel_build_id() 1136 sizeof(dso->build_id)) == 0) dso__read_running_kernel_build_id() 1137 dso->has_build_id = true; dso__read_running_kernel_build_id() 1140 int dso__kernel_module_get_build_id(struct dso *dso, dso__kernel_module_get_build_id() argument 1148 const char *name = dso->short_name + 1; dso__kernel_module_get_build_id() 1154 if (sysfs__read_build_id(filename, dso->build_id, dso__kernel_module_get_build_id() 1155 sizeof(dso->build_id)) == 0) dso__kernel_module_get_build_id() 1156 dso->has_build_id = true; dso__kernel_module_get_build_id() 1164 struct dso *pos; __dsos__read_build_ids() 1183 void __dsos__add(struct dsos *dsos, struct dso *dso) __dsos__add() argument 1185 list_add_tail(&dso->node, &dsos->head); __dsos__add() 1186 __dso__findlink_by_longname(&dsos->root, dso, NULL); __dsos__add() 1189 * this when needing memory, by looking at LRU dso instances in the __dsos__add() 1190 * list with atomic_read(&dso->refcnt) == 1, i.e. no references __dsos__add() 1196 * 'struct dso' instances will be removed from the list, in __dsos__add() 1202 * references to the 'thread', 'map', 'dso' structs all from 'struct __dsos__add() 1207 dso__get(dso); __dsos__add() 1210 void dsos__add(struct dsos *dsos, struct dso *dso) dsos__add() argument 1213 __dsos__add(dsos, dso); dsos__add() 1217 struct dso *__dsos__find(struct dsos *dsos, const char *name, bool cmp_short) __dsos__find() 1219 struct dso *pos; __dsos__find() 1230 struct dso *dsos__find(struct dsos *dsos, const char *name, bool cmp_short) dsos__find() 1232 struct dso *dso; dsos__find() local 1234 dso = __dsos__find(dsos, name, cmp_short); dsos__find() 1236 return dso; dsos__find() 1239 struct dso *__dsos__addnew(struct dsos *dsos, const char *name) __dsos__addnew() 1241 struct dso *dso = dso__new(name); __dsos__addnew() local 1243 if (dso != NULL) { __dsos__addnew() 1244 __dsos__add(dsos, dso); __dsos__addnew() 1245 dso__set_basename(dso); __dsos__addnew() 1247 return dso; __dsos__addnew() 1250 struct dso *__dsos__findnew(struct dsos *dsos, const char *name) __dsos__findnew() 1252 struct dso *dso = __dsos__find(dsos, name, false); __dsos__findnew() local 1254 return dso ? dso : __dsos__addnew(dsos, name); __dsos__findnew() 1257 struct dso *dsos__findnew(struct dsos *dsos, const char *name) dsos__findnew() 1259 struct dso *dso; dsos__findnew() local 1261 dso = dso__get(__dsos__findnew(dsos, name)); dsos__findnew() 1263 return dso; dsos__findnew() 1267 bool (skip)(struct dso *dso, int parm), int parm) __dsos__fprintf_buildid() 1269 struct dso *pos; __dsos__fprintf_buildid() 1283 struct dso *pos; __dsos__fprintf() 1295 size_t dso__fprintf_buildid(struct dso *dso, FILE *fp) dso__fprintf_buildid() argument 1299 build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); dso__fprintf_buildid() 1303 size_t dso__fprintf(struct dso *dso, enum map_type type, FILE *fp) dso__fprintf() argument 1306 size_t ret = fprintf(fp, "dso: %s (", dso->short_name); dso__fprintf() 1308 if (dso->short_name != dso->long_name) dso__fprintf() 1309 ret += fprintf(fp, "%s, ", dso->long_name); dso__fprintf() 1311 dso__loaded(dso, type) ? "" : "NOT "); dso__fprintf() 1312 ret += dso__fprintf_buildid(dso, fp); dso__fprintf() 1314 for (nd = rb_first(&dso->symbols[type]); nd; nd = rb_next(nd)) { dso__fprintf() 1322 enum dso_type dso__type(struct dso *dso, struct machine *machine) dso__type() argument 1327 fd = dso__data_get_fd(dso, machine); dso__type() 1330 dso__data_put_fd(dso); dso__type() 1336 int dso__strerror_load(struct dso *dso, char *buf, size_t buflen) dso__strerror_load() argument 1338 int idx, errnum = dso->load_errno; dso__strerror_load() 1266 __dsos__fprintf_buildid(struct list_head *head, FILE *fp, bool (skip)(struct dso *dso, int parm), int parm) __dsos__fprintf_buildid() argument
|
H A D | dso.h | 90 #define DSO__SWAP(dso, type, val) \ 93 BUG_ON(dso->needs_swap == DSO_SWAP__UNSET); \ 94 if (dso->needs_swap == DSO_SWAP__YES) { \ 134 struct dso { struct 172 /* dso data file */ 194 * @dso: the 'struct dso *' in which symbols itereated 199 #define dso__for_each_symbol(dso, pos, n, type) \ 200 symbols__for_each_entry(&(dso)->symbols[(type)], pos, n) 202 static inline void dso__set_loaded(struct dso *dso, enum map_type type) dso__set_loaded() argument 204 dso->loaded |= (1 << type); dso__set_loaded() 207 struct dso *dso__new(const char *name); 208 void dso__delete(struct dso *dso); 210 void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated); 211 void dso__set_long_name(struct dso *dso, const char *name, bool name_allocated); 213 int dso__name_len(const struct dso *dso); 215 struct dso *dso__get(struct dso *dso); 216 void dso__put(struct dso *dso); 218 static inline void __dso__zput(struct dso **dso) __dso__zput() argument 220 dso__put(*dso); __dso__zput() 221 *dso = NULL; __dso__zput() 224 #define dso__zput(dso) __dso__zput(&dso) 226 bool dso__loaded(const struct dso *dso, enum map_type type); 228 bool dso__sorted_by_name(const struct dso *dso, enum map_type type); 229 void dso__set_sorted_by_name(struct dso *dso, enum map_type type); 230 void dso__sort_by_name(struct dso *dso, enum map_type type); 232 void dso__set_build_id(struct dso *dso, void *build_id); 233 bool dso__build_id_equal(const struct dso *dso, u8 *build_id); 234 void dso__read_running_kernel_build_id(struct dso *dso, 236 int dso__kernel_module_get_build_id(struct dso *dso, const char *root_dir); 238 char dso__symtab_origin(const struct dso *dso); 239 int dso__read_binary_type_filename(const struct dso *dso, enum dso_binary_type type, 244 bool dso__needs_decompress(struct dso *dso); 269 * Please refer to the dso.c object code for each function and 271 * dso file descriptor caching. 274 * to speed up the dso data accesses. The idea is to leave the file 275 * descriptor opened ideally for the whole life of the dso object. 280 * int fd = dso__data_get_fd(dso, machine); 283 * dso__data_put_fd(dso); 291 * dso__data_close(dso); 298 * data file descriptor gets closed/unmapped before the dso object 303 int dso__data_get_fd(struct dso *dso, struct machine *machine); 304 void dso__data_put_fd(struct dso *dso __maybe_unused); 305 void dso__data_close(struct dso *dso); 307 off_t dso__data_size(struct dso *dso, struct machine *machine); 308 ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine, 310 ssize_t dso__data_read_addr(struct dso *dso, struct map *map, 313 bool dso__data_status_seen(struct dso *dso, enum dso_data_status_seen by); 316 struct dso *machine__findnew_kernel(struct machine *machine, const char *name, 319 void __dsos__add(struct dsos *dsos, struct dso *dso); 320 void dsos__add(struct dsos *dsos, struct dso *dso); 321 struct dso *__dsos__addnew(struct dsos *dsos, const char *name); 322 struct dso *__dsos__find(struct dsos *dsos, const char *name, bool cmp_short); 323 struct dso *dsos__find(struct dsos *dsos, const char *name, bool cmp_short); 324 struct dso *__dsos__findnew(struct dsos *dsos, const char *name); 325 struct dso *dsos__findnew(struct dsos *dsos, const char *name); 328 void dso__reset_find_symbol_cache(struct dso *dso); 331 bool (skip)(struct dso *dso, int parm), int parm); 334 size_t dso__fprintf_buildid(struct dso *dso, FILE *fp); 335 size_t dso__fprintf_symbols_by_name(struct dso *dso, 337 size_t dso__fprintf(struct dso *dso, enum map_type type, FILE *fp); 339 static inline bool dso__is_vmlinux(struct dso *dso) dso__is_vmlinux() argument 341 return dso->binary_type == DSO_BINARY_TYPE__VMLINUX || dso__is_vmlinux() 342 dso->binary_type == DSO_BINARY_TYPE__GUEST_VMLINUX; dso__is_vmlinux() 345 static inline bool dso__is_kcore(struct dso *dso) dso__is_kcore() argument 347 return dso->binary_type == DSO_BINARY_TYPE__KCORE || dso__is_kcore() 348 dso->binary_type == DSO_BINARY_TYPE__GUEST_KCORE; dso__is_kcore() 351 void dso__free_a2l(struct dso *dso); 353 enum dso_type dso__type(struct dso *dso, struct machine *machine); 355 int dso__strerror_load(struct dso *dso, char *buf, size_t buflen);
|
H A D | vdso.h | 19 struct dso; 21 bool dso__is_vdso(struct dso *dso); 26 struct dso *machine__findnew_vdso(struct machine *machine, struct thread *thread);
|
H A D | vdso.c | 123 static struct dso *__machine__addnew_vdso(struct machine *machine, const char *short_name, __machine__addnew_vdso() 126 struct dso *dso; __machine__addnew_vdso() local 128 dso = dso__new(short_name); __machine__addnew_vdso() 129 if (dso != NULL) { __machine__addnew_vdso() 130 __dsos__add(&machine->dsos, dso); __machine__addnew_vdso() 131 dso__set_long_name(dso, long_name, false); __machine__addnew_vdso() 134 return dso; __machine__addnew_vdso() 144 struct dso *dso; machine__thread_dso_type() local 148 dso = map->dso; machine__thread_dso_type() 149 if (!dso || dso->long_name[0] != '/') machine__thread_dso_type() 151 dso_type = dso__type(dso, machine); machine__thread_dso_type() 233 static struct dso *__machine__findnew_compat(struct machine *machine, __machine__findnew_compat() 237 struct dso *dso; __machine__findnew_compat() local 239 dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true); __machine__findnew_compat() 240 if (dso) __machine__findnew_compat() 247 dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name); __machine__findnew_compat() 249 return dso; __machine__findnew_compat() 255 struct dso **dso) __machine__findnew_vdso_compat() 272 *dso = __machine__findnew_compat(machine, &vdso_info->vdso32); __machine__findnew_vdso_compat() 275 *dso = __machine__findnew_compat(machine, &vdso_info->vdsox32); __machine__findnew_vdso_compat() 286 struct dso *machine__findnew_vdso(struct machine *machine, machine__findnew_vdso() 290 struct dso *dso = NULL; machine__findnew_vdso() local 301 if (__machine__findnew_vdso_compat(machine, thread, vdso_info, &dso)) machine__findnew_vdso() 305 dso = __dsos__find(&machine->dsos, DSO__NAME_VDSO, true); machine__findnew_vdso() 306 if (!dso) { machine__findnew_vdso() 311 dso = __machine__addnew_vdso(machine, DSO__NAME_VDSO, file); machine__findnew_vdso() 315 dso__get(dso); machine__findnew_vdso() 317 return dso; machine__findnew_vdso() 320 bool dso__is_vdso(struct dso *dso) dso__is_vdso() argument 322 return !strcmp(dso->short_name, DSO__NAME_VDSO) || dso__is_vdso() 323 !strcmp(dso->short_name, DSO__NAME_VDSO32) || dso__is_vdso() 324 !strcmp(dso->short_name, DSO__NAME_VDSOX32); dso__is_vdso() 252 __machine__findnew_vdso_compat(struct machine *machine, struct thread *thread, struct vdso_info *vdso_info, struct dso **dso) __machine__findnew_vdso_compat() argument
|
H A D | symbol.c | 26 static int dso__load_kernel_sym(struct dso *dso, struct map *map, 28 static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, 444 void dso__reset_find_symbol_cache(struct dso *dso) dso__reset_find_symbol_cache() argument 449 dso->last_find_result[type].addr = 0; dso__reset_find_symbol_cache() 450 dso->last_find_result[type].symbol = NULL; dso__reset_find_symbol_cache() 454 struct symbol *dso__find_symbol(struct dso *dso, dso__find_symbol() argument 457 if (dso->last_find_result[type].addr != addr) { dso__find_symbol() 458 dso->last_find_result[type].addr = addr; dso__find_symbol() 459 dso->last_find_result[type].symbol = symbols__find(&dso->symbols[type], addr); dso__find_symbol() 462 return dso->last_find_result[type].symbol; dso__find_symbol() 465 struct symbol *dso__first_symbol(struct dso *dso, enum map_type type) dso__first_symbol() argument 467 return symbols__first(&dso->symbols[type]); dso__first_symbol() 486 struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type, dso__find_symbol_by_name() argument 489 return symbols__find_by_name(&dso->symbol_names[type], name); dso__find_symbol_by_name() 492 void dso__sort_by_name(struct dso *dso, enum map_type type) dso__sort_by_name() argument 494 dso__set_sorted_by_name(dso, type); dso__sort_by_name() 495 return symbols__sort_by_name(&dso->symbol_names[type], dso__sort_by_name() 496 &dso->symbols[type]); dso__sort_by_name() 499 size_t dso__fprintf_symbols_by_name(struct dso *dso, dso__fprintf_symbols_by_name() argument 506 for (nd = rb_first(&dso->symbol_names[type]); nd; nd = rb_next(nd)) { dso__fprintf_symbols_by_name() 574 struct dso *dso; member in struct:process_kallsyms_args 617 struct rb_root *root = &a->dso->symbols[a->map->type]; map__process_kallsym_symbol() 640 * Loads the function entries in /proc/kallsyms into kernel_map->dso, 644 static int dso__load_all_kallsyms(struct dso *dso, const char *filename, dso__load_all_kallsyms() argument 647 struct process_kallsyms_args args = { .map = map, .dso = dso, }; dso__load_all_kallsyms() 651 static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map, dso__split_kallsyms_for_kcore() argument 658 struct rb_root old_root = dso->symbols[map->type]; dso__split_kallsyms_for_kcore() 659 struct rb_root *root = &dso->symbols[map->type]; dso__split_kallsyms_for_kcore() 689 symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); dso__split_kallsyms_for_kcore() 694 dso->adjust_symbols = 1; dso__split_kallsyms_for_kcore() 704 static int dso__split_kallsyms(struct dso *dso, struct map *map, u64 delta, dso__split_kallsyms() argument 712 struct rb_root *root = &dso->symbols[map->type]; dso__split_kallsyms() 734 if (strcmp(curr_map->dso->short_name, module)) { dso__split_kallsyms() 736 dso->kernel == DSO_TYPE_GUEST_KERNEL && dso__split_kallsyms() 745 dso__set_loaded(curr_map->dso, dso__split_kallsyms() 760 if (curr_map->dso->loaded && dso__split_kallsyms() 772 struct dso *ndso; dso__split_kallsyms() 785 if (dso->kernel == DSO_TYPE_GUEST_KERNEL) dso__split_kallsyms() 798 ndso->kernel = dso->kernel; dso__split_kallsyms() 821 symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); dso__split_kallsyms() 829 dso->kernel == DSO_TYPE_GUEST_KERNEL && dso__split_kallsyms() 831 dso__set_loaded(curr_map->dso, curr_map->type); dso__split_kallsyms() 1014 mi = find_module(old_map->dso->short_name, &modules); do_validate_kcore_modules() 1092 struct dso *dso; member in struct:kcore_mapfn_data 1102 map = map__new2(start, md->dso, md->type); kcore_mapfn() 1114 static int dso__load_kcore(struct dso *dso, struct map *map, dso__load_kcore() argument 1143 md.dso = dso; dso__load_kcore() 1159 dso->is_64_bit = is_64_bit; dso__load_kcore() 1177 sym = dso__first_symbol(dso, map->type); dso__load_kcore() 1215 if (dso->kernel == DSO_TYPE_GUEST_KERNEL) dso__load_kcore() 1216 dso->binary_type = DSO_BINARY_TYPE__GUEST_KCORE; dso__load_kcore() 1218 dso->binary_type = DSO_BINARY_TYPE__KCORE; dso__load_kcore() 1219 dso__set_long_name(dso, strdup(kcore_filename), true); dso__load_kcore() 1264 int dso__load_kallsyms(struct dso *dso, const char *filename, dso__load_kallsyms() argument 1272 if (dso__load_all_kallsyms(dso, filename, map) < 0) dso__load_kallsyms() 1278 symbols__fixup_duplicate(&dso->symbols[map->type]); dso__load_kallsyms() 1279 symbols__fixup_end(&dso->symbols[map->type]); dso__load_kallsyms() 1281 if (dso->kernel == DSO_TYPE_GUEST_KERNEL) dso__load_kallsyms() 1282 dso->symtab_type = DSO_BINARY_TYPE__GUEST_KALLSYMS; dso__load_kallsyms() 1284 dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS; dso__load_kallsyms() 1286 if (!dso__load_kcore(dso, map, filename)) dso__load_kallsyms() 1287 return dso__split_kallsyms_for_kcore(dso, map, filter); dso__load_kallsyms() 1289 return dso__split_kallsyms(dso, map, delta, filter); dso__load_kallsyms() 1292 static int dso__load_perf_map(struct dso *dso, struct map *map, dso__load_perf_map() argument 1300 file = fopen(dso->long_name, "r"); dso__load_perf_map() 1338 symbols__insert(&dso->symbols[map->type], sym); dso__load_perf_map() 1354 static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod, dso__is_compatible_symtab_type() argument 1365 return !kmod && dso->kernel == DSO_TYPE_USER; dso__is_compatible_symtab_type() 1370 return dso->kernel == DSO_TYPE_KERNEL; dso__is_compatible_symtab_type() 1375 return dso->kernel == DSO_TYPE_GUEST_KERNEL; dso__is_compatible_symtab_type() 1383 * creating a module dso in machine__findnew_module_map(). dso__is_compatible_symtab_type() 1385 return kmod && dso->symtab_type == type; dso__is_compatible_symtab_type() 1396 int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) dso__load() argument 1409 pthread_mutex_lock(&dso->lock); dso__load() 1411 /* check again under the dso->lock */ dso__load() 1412 if (dso__loaded(dso, map->type)) { dso__load() 1417 if (dso->kernel) { dso__load() 1418 if (dso->kernel == DSO_TYPE_KERNEL) dso__load() 1419 ret = dso__load_kernel_sym(dso, map, filter); dso__load() 1420 else if (dso->kernel == DSO_TYPE_GUEST_KERNEL) dso__load() 1421 ret = dso__load_guest_kernel_sym(dso, map, filter); dso__load() 1431 dso->adjust_symbols = 0; dso__load() 1433 if (strncmp(dso->name, "/tmp/perf-", 10) == 0) { dso__load() 1436 if (lstat(dso->name, &st) < 0) dso__load() 1441 "ignoring it (use -f to override).\n", dso->name); dso__load() 1445 ret = dso__load_perf_map(dso, map, filter); dso__load() 1446 dso->symtab_type = ret > 0 ? DSO_BINARY_TYPE__JAVA_JIT : dso__load() 1458 kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE || dso__load() 1459 dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP || dso__load() 1460 dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE || dso__load() 1461 dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; dso__load() 1468 if (filename__read_build_id(dso->name, build_id, BUILD_ID_SIZE) > 0) dso__load() 1469 dso__set_build_id(dso, build_id); dso__load() 1482 if (!dso__is_compatible_symtab_type(dso, kmod, symtab_type)) dso__load() 1485 if (dso__read_binary_type_filename(dso, symtab_type, dso__load() 1490 if (symsrc__init(ss, dso, name, symtab_type) < 0) dso__load() 1496 if (!dso->symsrc_filename) dso__load() 1497 dso->symsrc_filename = strdup(name); dso__load() 1528 ret = dso__load_sym(dso, map, syms_ss, runtime_ss, filter, kmod); dso__load() 1535 nr_plt = dso__synthesize_plt_symbols(dso, runtime_ss, map, filter); dso__load() 1544 if (ret < 0 && strstr(dso->name, " (deleted)") != NULL) dso__load() 1547 dso__set_loaded(dso, map->type); dso__load() 1548 pthread_mutex_unlock(&dso->lock); dso__load() 1562 if (map->dso && strcmp(map->dso->short_name, name) == 0) map_groups__find_by_name() 1573 int dso__load_vmlinux(struct dso *dso, struct map *map, dso__load_vmlinux() argument 1587 if (dso->kernel == DSO_TYPE_GUEST_KERNEL) dso__load_vmlinux() 1592 if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type)) dso__load_vmlinux() 1595 err = dso__load_sym(dso, map, &ss, &ss, filter, 0); dso__load_vmlinux() 1599 if (dso->kernel == DSO_TYPE_GUEST_KERNEL) dso__load_vmlinux() 1600 dso->binary_type = DSO_BINARY_TYPE__GUEST_VMLINUX; dso__load_vmlinux() 1602 dso->binary_type = DSO_BINARY_TYPE__VMLINUX; dso__load_vmlinux() 1603 dso__set_long_name(dso, vmlinux, vmlinux_allocated); dso__load_vmlinux() 1604 dso__set_loaded(dso, map->type); dso__load_vmlinux() 1611 int dso__load_vmlinux_path(struct dso *dso, struct map *map, dso__load_vmlinux_path() argument 1621 err = dso__load_vmlinux(dso, map, vmlinux_path[i], false, filter); dso__load_vmlinux_path() 1627 filename = dso__build_id_filename(dso, NULL, 0); dso__load_vmlinux_path() 1629 err = dso__load_vmlinux(dso, map, filename, true, filter); dso__load_vmlinux_path() 1669 static char *dso__find_kallsyms(struct dso *dso, struct map *map) dso__find_kallsyms() argument 1676 if (!dso->has_build_id) { dso__find_kallsyms() 1686 is_host = dso__build_id_equal(dso, host_build_id); dso__find_kallsyms() 1688 build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); dso__find_kallsyms() 1742 static int dso__load_kernel_sym(struct dso *dso, struct map *map, dso__load_kernel_sym() argument 1769 return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name, dso__load_kernel_sym() 1774 err = dso__load_vmlinux_path(dso, map, filter); dso__load_kernel_sym() 1783 kallsyms_allocated_filename = dso__find_kallsyms(dso, map); dso__load_kernel_sym() 1790 err = dso__load_kallsyms(dso, kallsyms_filename, map, filter); dso__load_kernel_sym() 1795 if (err > 0 && !dso__is_kcore(dso)) { dso__load_kernel_sym() 1796 dso->binary_type = DSO_BINARY_TYPE__KALLSYMS; dso__load_kernel_sym() 1797 dso__set_long_name(dso, "[kernel.kallsyms]", false); dso__load_kernel_sym() 1805 static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, dso__load_guest_kernel_sym() argument 1826 err = dso__load_vmlinux(dso, map, dso__load_guest_kernel_sym() 1840 err = dso__load_kallsyms(dso, kallsyms_filename, map, filter); dso__load_guest_kernel_sym() 1843 if (err > 0 && !dso__is_kcore(dso)) { dso__load_guest_kernel_sym() 1844 dso->binary_type = DSO_BINARY_TYPE__GUEST_KALLSYMS; dso__load_guest_kernel_sym() 1846 dso__set_long_name(dso, strdup(path), true); dso__load_guest_kernel_sym() 1998 symbol_conf.dso_list_str, "dso") < 0) symbol__init()
|
H A D | srcline.c | 7 #include "util/dso.h" 155 char **file, unsigned int *line, struct dso *dso, addr2line() 159 struct a2l_data *a2l = dso->a2l; addr2line() 162 dso->a2l = addr2line_init(dso_name); addr2line() 163 a2l = dso->a2l; addr2line() 196 void dso__free_a2l(struct dso *dso) dso__free_a2l() argument 198 struct a2l_data *a2l = dso->a2l; dso__free_a2l() 205 dso->a2l = NULL; dso__free_a2l() 212 struct dso *dso __maybe_unused, addr2line() 258 void dso__free_a2l(struct dso *dso __maybe_unused) dso__free_a2l() 266 * dso. 270 char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, __get_srcline() argument 278 if (!dso->has_srcline) __get_srcline() 281 if (dso->symsrc_filename) __get_srcline() 282 dso_name = dso->symsrc_filename; __get_srcline() 284 dso_name = dso->long_name; __get_srcline() 292 if (!addr2line(dso_name, addr, &file, &line, dso, unwind_inlines)) __get_srcline() 302 dso->a2l_fails = 0; __get_srcline() 308 if (dso->a2l_fails && ++dso->a2l_fails > A2L_FAIL_LIMIT) { __get_srcline() 309 dso->has_srcline = 0; __get_srcline() 310 dso__free_a2l(dso); __get_srcline() 316 } else if (asprintf(&srcline, "%s[%" PRIx64 "]", dso->short_name, addr) < 0) __get_srcline() 327 char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, get_srcline() argument 330 return __get_srcline(dso, addr, sym, show_sym, false); get_srcline() 154 addr2line(const char *dso_name, u64 addr, char **file, unsigned int *line, struct dso *dso, bool unwind_inlines) addr2line() argument
|
H A D | symbol.h | 24 #include "dso.h" 224 int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, 229 int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter); 230 int dso__load_vmlinux(struct dso *dso, struct map *map, 233 int dso__load_vmlinux_path(struct dso *dso, struct map *map, 235 int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, 238 struct symbol *dso__find_symbol(struct dso *dso, enum map_type type, 240 struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type, 244 struct symbol *dso__first_symbol(struct dso *dso, enum map_type type); 271 int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, 274 int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss,
|
H A D | db-export.h | 26 struct dso; 56 int (*export_dso)(struct db_export *dbe, struct dso *dso, 59 struct dso *dso); 91 int db_export__dso(struct db_export *dbe, struct dso *dso, 94 struct dso *dso);
|
H A D | map.c | 128 u64 start, u64 end, u64 pgoff, struct dso *dso) map__init() 135 map->dso = dso__get(dso); map__init() 153 struct dso *dso; map__new() local 180 dso = machine__findnew_vdso(machine, thread); map__new() 182 dso = machine__findnew_dso(machine, filename); map__new() 184 if (dso == NULL) map__new() 187 map__init(map, type, start, start + len, pgoff, dso); map__new() 198 dso__set_loaded(dso, map->type); map__new() 200 dso__put(dso); map__new() 213 struct map *map__new2(u64 start, struct dso *dso, enum map_type type) map__new2() argument 216 (dso->kernel ? sizeof(struct kmap) : 0))); map__new2() 221 map__init(map, type, start, 0, 0, dso); map__new2() 234 * map->dso->kernel) before calling __map__is_{kernel,kmodule}()) 244 dso__zput(map->dso); map__exit() 261 struct rb_root *symbols = &map->dso->symbols[map->type]; map__fixup_start() 271 struct rb_root *symbols = &map->dso->symbols[map->type]; map__fixup_end() 283 const char *name = map->dso->long_name; map__load() 286 if (dso__loaded(map->dso, map->type)) map__load() 289 nr = dso__load(map->dso, map, filter); map__load() 291 if (map->dso->has_build_id) { map__load() 294 build_id__sprintf(map->dso->build_id, map__load() 295 sizeof(map->dso->build_id), map__load() 336 return dso__find_symbol(map->dso, map->type, addr); map__find_symbol() 345 if (!dso__sorted_by_name(map->dso, map->type)) map__find_symbol_by_name() 346 dso__sort_by_name(map->dso, map->type); map__find_symbol_by_name() 348 return dso__find_symbol_by_name(map->dso, map->type, name); map__find_symbol_by_name() 358 dso__get(map->dso); map__clone() 382 map->start, map->end, map->pgoff, map->dso->name); map__fprintf() 389 if (map && map->dso && (map->dso->name || map->dso->long_name)) { map__fprintf_dsoname() 390 if (symbol_conf.show_kernel_path && map->dso->long_name) map__fprintf_dsoname() 391 dsoname = map->dso->long_name; map__fprintf_dsoname() 392 else if (map->dso->name) map__fprintf_dsoname() 393 dsoname = map->dso->name; map__fprintf_dsoname() 405 if (map && map->dso) { map__fprintf_srcline() 406 srcline = get_srcline(map->dso, map__fprintf_srcline() 421 * map->dso->adjust_symbols==1 for ET_EXEC-like cases except ET_REL which is 428 if (!map->dso->adjust_symbols) map__rip_2objdump() 431 if (map->dso->rel) map__rip_2objdump() 451 if (!map->dso->adjust_symbols) map__objdump_2mem() 454 if (map->dso->rel) map__objdump_2mem() 622 printed += dso__fprintf(pos->dso, pos->type, fp); maps__fprintf() 839 if (!map->dso || !map->dso->kernel) { map__kmap() 127 map__init(struct map *map, enum map_type type, u64 start, u64 end, u64 pgoff, struct dso *dso) map__init() argument
|
H A D | build-id.h | 12 struct dso; 18 char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size);
|
H A D | unwind-libunwind.c | 241 static int unwind_spec_ehframe(struct dso *dso, struct machine *machine, unwind_spec_ehframe() argument 250 r = dso__data_read_offset(dso, machine, offset, unwind_spec_ehframe() 264 static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, read_unwind_spec_eh_frame() argument 269 u64 offset = dso->data.eh_frame_hdr_offset; read_unwind_spec_eh_frame() 272 fd = dso__data_get_fd(dso, machine); read_unwind_spec_eh_frame() 278 dso->data.eh_frame_hdr_offset = offset; read_unwind_spec_eh_frame() 279 dso__data_put_fd(dso); read_unwind_spec_eh_frame() 283 ret = unwind_spec_ehframe(dso, machine, offset, read_unwind_spec_eh_frame() 291 static int read_unwind_spec_debug_frame(struct dso *dso, read_unwind_spec_debug_frame() argument 295 u64 ofs = dso->data.debug_frame_offset; read_unwind_spec_debug_frame() 298 fd = dso__data_get_fd(dso, machine); read_unwind_spec_debug_frame() 304 dso->data.debug_frame_offset = ofs; read_unwind_spec_debug_frame() 305 dso__data_put_fd(dso); read_unwind_spec_debug_frame() 336 if (!map || !map->dso) find_proc_info() 339 pr_debug("unwind: find_proc_info dso %s\n", map->dso->name); find_proc_info() 342 if (!read_unwind_spec_eh_frame(map->dso, ui->machine, find_proc_info() 359 !read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) { find_proc_info() 360 int fd = dso__data_get_fd(map->dso, ui->machine); find_proc_info() 361 int is_exec = elf_is_exec(fd, map->dso->name); find_proc_info() 366 dso__data_put_fd(map->dso); find_proc_info() 368 symfile = map->dso->symsrc_filename ?: map->dso->name; find_proc_info() 429 if (!al.map->dso) access_dso_mem() 432 size = dso__data_read_addr(al.map->dso, al.map, ui->machine, access_dso_mem()
|
H A D | db-export.c | 204 int db_export__dso(struct db_export *dbe, struct dso *dso, db_export__dso() argument 207 if (dso->db_id) db_export__dso() 210 dso->db_id = ++dbe->dso_last_db_id; db_export__dso() 213 return dbe->export_dso(dbe, dso, machine); db_export__dso() 219 struct dso *dso) db_export__symbol() 229 return dbe->export_symbol(dbe, sym, dso); db_export__symbol() 251 struct dso *dso = al->map->dso; db_ids_from_al() local 253 err = db_export__dso(dbe, dso, al->machine); db_ids_from_al() 256 *dso_db_id = dso->db_id; db_ids_from_al() 261 symbols__insert(&dso->symbols[al->map->type], db_ids_from_al() 268 err = db_export__symbol(dbe, al->sym, dso); db_ids_from_al() 218 db_export__symbol(struct db_export *dbe, struct symbol *sym, struct dso *dso) db_export__symbol() argument
|
H A D | unwind-libdw.c | 27 struct dso *dso = NULL; __report_module() local 34 dso = al->map->dso; __report_module() 36 if (!dso) __report_module() 41 mod = dwfl_report_elf(ui->dwfl, dso->short_name, __report_module() 42 dso->long_name, -1, al->map->start, __report_module() 99 if (!al.map->dso) access_dso_mem() 102 size = dso__data_read_addr(al.map->dso, al.map, ui->machine, access_dso_mem()
|
H A D | build-id.c | 44 al.map->dso->hit = 1; build_id__mark_dso_hit() 158 char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size) dso__build_id_filename() argument 162 if (!dso->has_build_id) dso__build_id_filename() 165 build_id__sprintf(dso->build_id, sizeof(dso->build_id), build_id_hex); dso__build_id_filename() 202 struct dso *pos; machine__write_buildid_table() 258 struct dso *pos; __dsos__hit_all() 477 static int dso__cache_build_id(struct dso *dso, struct machine *machine) dso__cache_build_id() argument 479 bool is_kallsyms = dso->kernel && dso->long_name[0] != '/'; dso__cache_build_id() 480 bool is_vdso = dso__is_vdso(dso); dso__cache_build_id() 481 const char *name = dso->long_name; dso__cache_build_id() 484 if (dso__is_kcore(dso)) { dso__cache_build_id() 489 return build_id_cache__add_b(dso->build_id, sizeof(dso->build_id), name, dso__cache_build_id() 496 struct dso *pos; __dsos__cache_build_ids()
|
H A D | symbol-elf.c | 212 * And always look at the original dso, not at debuginfo packages, that 215 int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *map, dso__synthesize_plt_symbols() argument 307 symbols__insert(&dso->symbols[map->type], f); elf_section__for_each_rela() 329 symbols__insert(&dso->symbols[map->type], f); elf_section__for_each_rel() 340 __func__, dso->long_name); 552 static int dso__swap_init(struct dso *dso, unsigned char eidata) dso__swap_init() argument 556 dso->needs_swap = DSO_SWAP__NO; dso__swap_init() 562 dso->needs_swap = DSO_SWAP__YES; dso__swap_init() 568 dso->needs_swap = DSO_SWAP__YES; dso__swap_init() 579 static int decompress_kmodule(struct dso *dso, const char *name, decompress_kmodule() argument 592 name = dso->long_name; decompress_kmodule() 599 dso->load_errno = errno; decompress_kmodule() 604 dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE; decompress_kmodule() 638 int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, symsrc__init() argument 646 if (dso__needs_decompress(dso)) { symsrc__init() 647 fd = decompress_kmodule(dso, name, type); symsrc__init() 653 dso->load_errno = errno; symsrc__init() 661 dso->load_errno = DSO_LOAD_ERRNO__INVALID_ELF; symsrc__init() 666 dso->load_errno = DSO_LOAD_ERRNO__INVALID_ELF; symsrc__init() 671 if (dso__swap_init(dso, ehdr.e_ident[EI_DATA])) { symsrc__init() 672 dso->load_errno = DSO_LOAD_ERRNO__INTERNAL_ERROR; symsrc__init() 677 if (dso->has_build_id) { symsrc__init() 681 dso->load_errno = DSO_LOAD_ERRNO__CANNOT_READ_BUILDID; symsrc__init() 685 if (!dso__build_id_equal(dso, build_id)) { symsrc__init() 687 dso->load_errno = DSO_LOAD_ERRNO__MISMATCHING_BUILDID; symsrc__init() 711 if (dso->kernel == DSO_TYPE_USER) { symsrc__init() 715 dso__is_vdso(dso) || symsrc__init() 725 dso->load_errno = errno; symsrc__init() 781 int dso__load_sym(struct dso *dso, struct map *map, dso__load_sym() argument 785 struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL; dso__load_sym() 788 struct dso *curr_dso = dso; dso__load_sym() 805 dso->symtab_type = syms_ss->type; dso__load_sym() 806 dso->is_64_bit = syms_ss->is_64_bit; dso__load_sym() 807 dso->rel = syms_ss->ehdr.e_type == ET_REL; dso__load_sym() 811 * have the wrong values for the dso maps, so remove them. dso__load_sym() 814 symbols__delete(&dso->symbols[map->type]); dso__load_sym() 822 if (dso->kernel) dso__load_sym() 882 if (dso__is_vdso(dso)) { 889 dso->adjust_symbols = runtime_ss->adjust_symbols || ref_reloc(kmap); 891 * Initial kernel and module mappings do not map to the dso. For 894 if (map->type == MAP__FUNCTION && (dso->kernel || kmodule)) { 896 adjust_kernel_syms = dso->adjust_symbols; 921 sym.st_value = DSO__SWAP(dso, u64, *opd); elf_symtab__for_each_symbol() 958 if (dso->kernel || kmodule) { elf_symtab__for_each_symbol() 967 dso->short_name_len)) == 0) elf_symtab__for_each_symbol() 974 * map to the kernel dso. elf_symtab__for_each_symbol() 976 if (remap_kernel && dso->kernel) { elf_symtab__for_each_symbol() 996 * Overwrite it to map to the module dso. elf_symtab__for_each_symbol() 1004 curr_dso = dso; elf_symtab__for_each_symbol() 1012 "%s%s", dso->short_name, section_name); elf_symtab__for_each_symbol() 1024 curr_dso->kernel = dso->kernel; elf_symtab__for_each_symbol() 1025 curr_dso->long_name = dso->long_name; elf_symtab__for_each_symbol() 1026 curr_dso->long_name_len = dso->long_name_len; elf_symtab__for_each_symbol() 1043 curr_dso->symtab_type = dso->symtab_type; elf_symtab__for_each_symbol() 1048 curr_dso = curr_map->dso; elf_symtab__for_each_symbol() 1067 if (want_demangle(dso->kernel || kmodule)) { elf_symtab__for_each_symbol() 1095 symbols__fixup_duplicate(&dso->symbols[map->type]); 1096 symbols__fixup_end(&dso->symbols[map->type]);
|
H A D | machine.c | 88 struct dso *pos, *n; dsos__purge() 506 static struct dso *machine__findnew_module_dso(struct machine *machine, machine__findnew_module_dso() 510 struct dso *dso; machine__findnew_module_dso() local 514 dso = __dsos__find(&machine->dsos, m->name, true); machine__findnew_module_dso() 515 if (!dso) { machine__findnew_module_dso() 516 dso = __dsos__addnew(&machine->dsos, m->name); machine__findnew_module_dso() 517 if (dso == NULL) machine__findnew_module_dso() 521 dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE; machine__findnew_module_dso() 523 dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE; machine__findnew_module_dso() 527 dso->symtab_type++; machine__findnew_module_dso() 529 dso__set_short_name(dso, strdup(m->name), true); machine__findnew_module_dso() 530 dso__set_long_name(dso, strdup(filename), true); machine__findnew_module_dso() 533 dso__get(dso); machine__findnew_module_dso() 536 return dso; machine__findnew_module_dso() 567 struct dso *dso; machine__findnew_module_map() local 578 dso = machine__findnew_module_dso(machine, &m, filename); machine__findnew_module_map() 579 if (dso == NULL) machine__findnew_module_map() 582 map = map__new2(start, dso, MAP__FUNCTION); machine__findnew_module_map() 607 bool (skip)(struct dso *dso, int parm), int parm) machine__fprintf_dsos_buildid() 613 bool (skip)(struct dso *dso, int parm), int parm) machines__fprintf_dsos_buildid() 629 struct dso *kdso = machine__kernel_map(machine)->dso; machine__fprintf_vmlinux_path() 662 static struct dso *machine__get_kernel(struct machine *machine) machine__get_kernel() 665 struct dso *kernel; machine__get_kernel() 738 int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) __machine__create_kernel_maps() 873 int ret = dso__load_kallsyms(map->dso, filename, map, filter); machine__load_kallsyms() 876 dso__set_loaded(map->dso, type); machine__load_kallsyms() 892 int ret = dso__load_vmlinux_path(map->dso, map, filter); machine__load_vmlinux_path() 895 dso__set_loaded(map->dso, type); machine__load_vmlinux_path() 934 static bool is_kmod_dso(struct dso *dso) is_kmod_dso() argument 936 return dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE || is_kmod_dso() 937 dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE; is_kmod_dso() 954 dso__set_long_name(map->dso, long_name, true); map_groups__set_module_path() 955 dso__kernel_module_get_build_id(map->dso, ""); map_groups__set_module_path() 961 if (m->comp && is_kmod_dso(map->dso)) map_groups__set_module_path() 962 map->dso->symtab_type++; map_groups__set_module_path() 1051 dso__kernel_module_get_build_id(map->dso, machine->root_dir); machine__create_module() 1084 struct dso *kernel = machine__get_kernel(machine); machine__create_kernel_maps() 1137 struct dso *dso; machine__uses_kcore() local 1139 list_for_each_entry(dso, &machine->dsos.head, node) { machine__uses_kcore() 1140 if (dso__is_kcore(dso)) machine__uses_kcore() 1183 struct dso *kernel = NULL; machine__process_kernel_mmap_event() 1184 struct dso *dso; machine__process_kernel_mmap_event() local 1188 list_for_each_entry(dso, &machine->dsos.head, node) { machine__process_kernel_mmap_event() 1194 * record the cpumode when we adding this dso to the machine__process_kernel_mmap_event() 1206 if (!dso->kernel || machine__process_kernel_mmap_event() 1207 is_kernel_module(dso->long_name, machine__process_kernel_mmap_event() 1212 kernel = dso; machine__process_kernel_mmap_event() 1247 * preload dso of guest kernel and modules machine__process_kernel_mmap_event() 2021 struct dso *machine__findnew_dso(struct machine *machine, const char *filename) machine__findnew_dso() 2035 *modp = __map__is_kmodule(map) ? (char *)map->dso->short_name : NULL; machine__resolve_kernel_addr() 606 machine__fprintf_dsos_buildid(struct machine *m, FILE *fp, bool (skip)(struct dso *dso, int parm), int parm) machine__fprintf_dsos_buildid() argument 612 machines__fprintf_dsos_buildid(struct machines *machines, FILE *fp, bool (skip)(struct dso *dso, int parm), int parm) machines__fprintf_dsos_buildid() argument
|
H A D | map.h | 22 struct dso; 47 /* ip -> dso rip */ 49 /* dso rip -> ip */ 52 struct dso *dso; member in struct:map 119 * Note: caller must ensure map->dso is not NULL (map is loaded). 122 dso__for_each_symbol(map->dso, pos, n, map->type) 144 u64 start, u64 end, u64 pgoff, struct dso *dso); 149 struct map *map__new2(u64 start, struct dso *dso, enum map_type type);
|
H A D | symbol-minimal.c | 249 int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, symsrc__init() argument 267 dso->load_errno = errno; symsrc__init() 288 int dso__synthesize_plt_symbols(struct dso *dso __maybe_unused, dso__synthesize_plt_symbols() 334 int dso__load_sym(struct dso *dso, struct map *map __maybe_unused, dso__load_sym() argument 345 dso->is_64_bit = ret; dso__load_sym() 348 dso__set_build_id(dso, build_id); dso__load_sym()
|
H A D | machine.h | 7 #include "dso.h" 168 struct dso *machine__findnew_dso(struct machine *machine, const char *filename); 210 bool (skip)(struct dso *dso, int parm), int parm); 213 bool (skip)(struct dso *dso, int parm), int parm); 216 int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel);
|
H A D | annotate.c | 1077 struct dso *dso = map->dso; symbol__annotate() local 1078 char *filename = dso__build_id_filename(dso, NULL, 0); symbol__annotate() 1093 if (dso->has_build_id) { symbol__annotate() 1099 } else if (dso__is_kcore(dso)) { symbol__annotate() 1111 filename = (char *)dso->long_name; symbol__annotate() 1116 if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && symbol__annotate() 1117 !dso__is_kcore(dso)) { symbol__annotate() 1121 if (dso->annotate_warned) symbol__annotate() 1124 if (dso->has_build_id) { symbol__annotate() 1125 build_id__sprintf(dso->build_id, symbol__annotate() 1126 sizeof(dso->build_id), bf + 15); symbol__annotate() 1130 dso->annotate_warned = 1; symbol__annotate() 1147 dso, dso->long_name, sym, sym->name); symbol__annotate() 1149 if (dso__is_kcore(dso)) { symbol__annotate() 1164 } else if (dso__needs_decompress(dso)) { symbol__annotate() 1235 if (dso__is_kcore(dso)) symbol__annotate() 1241 if (dso__needs_decompress(dso)) symbol__annotate() 1403 src_line->path = get_srcline(map->dso, offset, NULL, false); symbol__get_source_line() 1469 struct dso *dso = map->dso; symbol__annotate_printf() local 1482 filename = strdup(dso->long_name); symbol__annotate_printf() 1613 struct dso *dso = map->dso; symbol__tty_annotate() local 1625 print_summary(&source_line, dso->long_name); symbol__tty_annotate()
|
H A D | session.h | 99 bool (fn)(struct dso *dso, int parm), int parm);
|
H A D | util.h | 312 struct dso; 316 char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, 318 char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
|
H A D | intel-pt.c | 37 #include "dso.h" 336 static unsigned int intel_pt_cache_size(struct dso *dso, intel_pt_cache_size() argument 341 size = dso__data_size(dso, machine); intel_pt_cache_size() 350 static struct auxtrace_cache *intel_pt_cache(struct dso *dso, intel_pt_cache() argument 356 if (dso->auxtrace_cache) intel_pt_cache() 357 return dso->auxtrace_cache; intel_pt_cache() 359 bits = intel_pt_cache_size(dso, machine); intel_pt_cache() 364 dso->auxtrace_cache = c; intel_pt_cache() 369 static int intel_pt_cache_add(struct dso *dso, struct machine *machine, intel_pt_cache_add() argument 373 struct auxtrace_cache *c = intel_pt_cache(dso, machine); intel_pt_cache_add() 399 intel_pt_cache_lookup(struct dso *dso, struct machine *machine, u64 offset) intel_pt_cache_lookup() argument 401 struct auxtrace_cache *c = intel_pt_cache(dso, machine); intel_pt_cache_lookup() 406 return auxtrace_cache__lookup(dso->auxtrace_cache, offset); intel_pt_cache_lookup() 446 if (!al.map || !al.map->dso) intel_pt_walk_next_insn() 449 if (al.map->dso->data.status == DSO_DATA_STATUS_ERROR && intel_pt_walk_next_insn() 450 dso__data_status_seen(al.map->dso, intel_pt_walk_next_insn() 459 e = intel_pt_cache_lookup(al.map->dso, machine, offset); intel_pt_walk_next_insn() 476 /* Load maps to ensure dso->is_64_bit has been updated */ intel_pt_walk_next_insn() 479 x86_64 = al.map->dso->is_64_bit; intel_pt_walk_next_insn() 482 len = dso__data_read_offset(al.map->dso, machine, intel_pt_walk_next_insn() 525 e = intel_pt_cache_lookup(al.map->dso, machine, start_offset); intel_pt_walk_next_insn() 531 intel_pt_cache_add(al.map->dso, machine, start_offset, insn_cnt, intel_pt_walk_next_insn() 1278 start = dso__first_symbol(map->dso, MAP__FUNCTION); intel_pt_switch_ip()
|
H A D | event.c | 385 size = PERF_ALIGN(pos->dso->long_name_len + 1, sizeof(u64)); perf_event__synthesize_modules() 395 memcpy(event->mmap.filename, pos->dso->long_name, perf_event__synthesize_modules() 396 pos->dso->long_name_len + 1); perf_event__synthesize_modules() 949 * address, try to look it up in the kernel dso, as it might be thread__find_addr_map() 953 * "[vdso]" dso, but for now lets use the old trick of looking thread__find_addr_map() 1015 dump_printf(" ...... dso: %s\n", perf_event__preprocess_sample() 1016 al->map ? al->map->dso->long_name : perf_event__preprocess_sample() 1034 struct dso *dso = al->map->dso; perf_event__preprocess_sample() local 1037 (!dso || !(strlist__has_entry(symbol_conf.dso_list, perf_event__preprocess_sample() 1038 dso->short_name) || perf_event__preprocess_sample() 1039 (dso->short_name != dso->long_name && perf_event__preprocess_sample() 1041 dso->long_name))))) { perf_event__preprocess_sample()
|
H A D | sort.c | 11 const char default_sort_order[] = "comm,dso,symbol"; 13 const char default_mem_sort_order[] = "local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked"; 14 const char default_top_sort_order[] = "dso,symbol"; 15 const char default_diff_sort_order[] = "dso,symbol"; 124 /* --sort dso */ 128 struct dso *dso_l = map_l ? map_l->dso : NULL; _sort__dso_cmp() 129 struct dso *dso_r = map_r ? map_r->dso : NULL; _sort__dso_cmp() 155 if (map && map->dso) { _hist_entry__dso_snprintf() 156 const char *dso_name = !verbose ? map->dso->short_name : _hist_entry__dso_snprintf() 157 map->dso->long_name; _hist_entry__dso_snprintf() 208 * relative address within a dso. sort__sym_cmp() 235 char o = map ? dso__symtab_origin(map->dso) : '!'; _hist_entry__sym_snprintf() 292 left->srcline = get_srcline(map->dso, sort__srcline_cmp() 302 right->srcline = get_srcline(map->dso, sort__srcline_cmp() 332 sf = __get_srcline(map->dso, map__rip_2objdump(map, e->ip), get_srcfile() 1305 DIM(SORT_DSO, "dso", sort_dso), 1794 return __get_elide(symbol_conf.dso_list, "dso", output); get_elide()
|
H A D | header.h | 119 struct dso *pos, u16 misc,
|
H A D | thread-stack.h | 28 struct dso;
|
H A D | probe-event.c | 176 if (strncmp(pos->dso->short_name + 1, module, kernel_get_module_map() 177 pos->dso->short_name_len - 2) == 0) { kernel_get_module_map() 270 static int kernel_get_module_dso(const char *module, struct dso **pdso) kernel_get_module_dso() 272 struct dso *dso; kernel_get_module_dso() local 283 dso = map->dso; kernel_get_module_dso() 291 dso = map->dso; kernel_get_module_dso() 294 dso->load_errno = 0; kernel_get_module_dso() 296 ret = dso__load_vmlinux(dso, map, vmlinux_name, false, NULL); kernel_get_module_dso() 298 ret = dso__load_vmlinux_path(dso, map, NULL); kernel_get_module_dso() 300 *pdso = dso; kernel_get_module_dso() 408 struct dso *dso = NULL; open_debuginfo() local 412 err = kernel_get_module_dso(module, &dso); open_debuginfo() 414 if (!dso || dso->load_errno == 0) { open_debuginfo() 418 dso__strerror_load(dso, reason, STRERR_BUFSIZE); open_debuginfo() 424 path = dso->long_name; open_debuginfo() 2914 if (!dso__sorted_by_name(map->dso, map->type)) show_available_funcs() 2915 dso__sort_by_name(map->dso, map->type); show_available_funcs() 2919 dso__fprintf_symbols_by_name(map->dso, map->type, stdout); show_available_funcs()
|
H A D | hist.c | 48 static void hists__set_unres_dso_col_len(struct hists *hists, int dso) hists__set_unres_dso_col_len() argument 52 if (hists__col_len(hists, dso) < unresolved_col_width && hists__set_unres_dso_col_len() 55 hists__set_col_len(hists, dso, unresolved_col_width); hists__set_unres_dso_col_len() 85 len = dso__name_len(h->ms.map->dso); hists__calc_col_len() 99 symlen = dso__name_len(h->branch_info->from.map->dso); hists__calc_col_len() 113 symlen = dso__name_len(h->branch_info->to.map->dso); hists__calc_col_len() 148 symlen = dso__name_len(h->mem_info->daddr.map->dso); hists__calc_col_len() 1223 (he->ms.map == NULL || he->ms.map->dso != hists->dso_filter)) { hists__filter_entry_by_dso()
|
H A D | intel-bts.c | 335 if (!al.map || !al.map->dso) intel_bts_get_next_insn() 338 len = dso__data_read_addr(al.map->dso, al.map, machine, ip, buf, bufsz); intel_bts_get_next_insn() 342 /* Load maps to ensure dso->is_64_bit has been updated */ intel_bts_get_next_insn() 345 x86_64 = al.map->dso->is_64_bit; intel_bts_get_next_insn()
|
H A D | header.c | 1231 struct dso *dso; __event_process_build_id() local 1255 dso = machine__findnew_dso(machine, filename); __event_process_build_id() 1256 if (dso != NULL) { __event_process_build_id() 1259 dso__set_build_id(dso, &bev->build_id); __event_process_build_id() 1262 dso->kernel = dso_type; __event_process_build_id() 1264 build_id__sprintf(dso->build_id, sizeof(dso->build_id), __event_process_build_id() 1267 dso->long_name, sbuild_id); __event_process_build_id() 1268 dso__put(dso); __event_process_build_id() 2835 struct dso *pos, u16 misc, perf_event__synthesize_build_id()
|
H A D | hist.h | 59 struct dso; 69 const struct dso *dso_filter;
|
H A D | probe-finder.c | 36 #include "dso.h" 120 struct dso *dso; debuginfo__new() local 124 dso = dso__new(path); debuginfo__new() 125 if (!dso) debuginfo__new() 131 if (dso__read_binary_type_filename(dso, *type, &nil, debuginfo__new() 136 dso__put(dso); debuginfo__new()
|
H A D | callchain.c | 781 cl->srcline = get_srcline(cl->ms.map->dso, callchain_list__sym_name() 796 cl->ms.map->dso->short_name : callchain_list__sym_name()
|
H A D | session.c | 1745 bool (skip)(struct dso *dso, int parm), int parm) perf_session__fprintf_dsos_buildid() 1744 perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp, bool (skip)(struct dso *dso, int parm), int parm) perf_session__fprintf_dsos_buildid() argument
|
/linux-4.4.14/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/ |
H A D | EventClass.py | 24 def create_event(name, comm, dso, symbol, raw_buf): 26 event = PebsEvent(name, comm, dso, symbol, raw_buf) 28 event = PebsNHM(name, comm, dso, symbol, raw_buf) 30 event = PerfEvent(name, comm, dso, symbol, raw_buf) 36 def __init__(self, name, comm, dso, symbol, raw_buf, ev_type=EVTYPE_GENERIC): 39 self.dso = dso 46 print "PMU event: name=%12s, symbol=%24s, comm=%8s, dso=%12s" % (self.name, self.symbol, self.comm, self.dso) 55 def __init__(self, name, comm, dso, symbol, raw_buf, ev_type=EVTYPE_PEBS): 69 PerfEvent.__init__(self, name, comm, dso, symbol, raw_buf, ev_type) 84 def __init__(self, name, comm, dso, symbol, raw_buf, ev_type=EVTYPE_PEBS_LL): 92 PebsEvent.__init__(self, name, comm, dso, symbol, raw_buf, ev_type)
|
/linux-4.4.14/tools/perf/tests/ |
H A D | dso-data.c | 102 /* move it from util/dso.c for compatibility */ dso__data_fd() 103 static int dso__data_fd(struct dso *dso, struct machine *machine) dso__data_fd() argument 105 int fd = dso__data_get_fd(dso, machine); dso__data_fd() 108 dso__data_put_fd(dso); dso__data_fd() 116 struct dso *dso; test__dso_data() local 124 dso = dso__new((const char *)file); test__dso_data() 126 TEST_ASSERT_VAL("Failed to access to dso", test__dso_data() 127 dso__data_fd(dso, &machine) >= 0); test__dso_data() 136 size = dso__data_read_offset(dso, &machine, data->offset, test__dso_data() 155 size = dso__data_read_offset(dso, &machine, 10, test__dso_data() 169 dso__put(dso); test__dso_data() 199 static struct dso **dsos; 212 TEST_ASSERT_VAL("failed to get dso file", file); dsos__create() 215 TEST_ASSERT_VAL("failed to get dso", dsos[i]); dsos__create() 226 struct dso *dso = dsos[i]; dsos__delete() local 228 unlink(dso->name); dsos__delete() 229 dso__put(dso); dsos__delete() 260 /* and this is now our dso open FDs limit */ test__dso_data_cache() 266 struct dso *dso = dsos[i]; test__dso_data_cache() local 272 fd = dso__data_fd(dso, &machine); test__dso_data_cache() 280 n = dso__data_read_offset(dso, &machine, 0, buf, BUFSIZE); test__dso_data_cache() 281 TEST_ASSERT_VAL("failed to read dso", n == BUFSIZE); test__dso_data_cache() 288 /* open +1 dso to reach the allowed limit */ test__dso_data_cache() 319 * - create 3 dso objects test__dso_data_reopen() 322 * - test that the first dso gets closed when we test__dso_data_reopen()
|
H A D | hists_common.c | 122 struct dso *dso; setup_fake_machine() local 124 dso = machine__findnew_dso(machine, fake_symbols[i].dso_name); setup_fake_machine() 125 if (dso == NULL) setup_fake_machine() 129 dso__set_loaded(dso, MAP__FUNCTION); setup_fake_machine() 138 dso__put(dso); setup_fake_machine() 142 symbols__insert(&dso->symbols[MAP__FUNCTION], sym); setup_fake_machine() 145 dso__put(dso); setup_fake_machine() 178 he->ms.map->dso->short_name, print_hists_in() 205 he->ms.map->dso->short_name, print_hists_out()
|
H A D | hists_filter.c | 124 /* default sort order (comm,dso,sym) will be used */ test__hists_filter() 130 /* setup threads/dso/map/symbols also */ test__hists_filter() 198 /* now applying dso filter for 'kernel' */ evlist__for_each() 199 hists->dso_filter = fake_samples[0].map->dso; evlist__for_each() 203 pr_info("Histogram for dso filter\n"); evlist__for_each() 216 TEST_ASSERT_VAL("Unmatched nr samples for dso filter", evlist__for_each() 218 TEST_ASSERT_VAL("Unmatched nr hist entries for dso filter", evlist__for_each() 220 TEST_ASSERT_VAL("Unmatched total period for dso filter", evlist__for_each() 223 /* remove dso filter first */ evlist__for_each() 293 hists->dso_filter = fake_samples[1].map->dso; evlist__for_each()
|
H A D | vmlinux-kallsyms.c | 108 * in the kallsyms dso. For the ones that are in both, check its names and test__vmlinux_matches_kallsyms() 111 for (nd = rb_first(&vmlinux_map->dso->symbols[type]); nd; nd = rb_next(nd)) { test__vmlinux_matches_kallsyms() 197 (map->dso->kernel ? test__vmlinux_matches_kallsyms() 198 map->dso->short_name : test__vmlinux_matches_kallsyms() 199 map->dso->name)); test__vmlinux_matches_kallsyms() 221 map->start, map->end, map->pgoff, map->dso->name); test__vmlinux_matches_kallsyms() 225 pr_info(" %s\n", pair->dso->name); test__vmlinux_matches_kallsyms()
|
H A D | code-reading.c | 190 if (!al.map || !al.map->dso) { read_object_code() 195 pr_debug("File is: %s\n", al.map->dso->long_name); read_object_code() 197 if (al.map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && read_object_code() 198 !dso__is_kcore(al.map->dso)) { read_object_code() 213 ret_len = dso__data_read_offset(al.map->dso, thread->mg->machine, read_object_code() 228 if (dso__is_kcore(al.map->dso)) { read_object_code() 247 ret = read_via_objdump(al.map->dso->long_name, objdump_addr, buf2, len); read_object_code() 258 } else if (dso__is_kcore(al.map->dso)) { read_object_code() 279 pr_debug("buf1 (dso):\n"); read_object_code() 482 have_vmlinux = dso__is_vmlinux(map->dso); do_test_code_reading() 483 have_kcore = dso__is_kcore(map->dso); do_test_code_reading()
|
H A D | hists_cumulate.c | 154 #define DSO(he) (he->ms.map->dso->short_name) 159 #define CDSO(cl) (cl->ms.map->dso->short_name) 166 const char *dso; member in struct:result 173 const char *dso; member in struct:callchain_result::__anon15684 213 !strcmp(DSO(he), expected[i].dso) && do_test() 233 !strcmp(CDSO(clist), expected_callchain[i].node[c].dso) && do_test() 712 /* setup threads/dso/map/symbols also */ test__hists_cumulate()
|
H A D | hists_output.c | 120 #define DSO(he) (he->ms.map->dso->short_name) 135 sort_order = NULL; /* equivalent to sort_order = "comm,dso,sym" */ test1() 292 field_order = "comm,overhead,dso"; test3() 357 /* handle duplicate 'dso' field */ test4() 366 field_order = "dso,sym,comm,overhead,dso"; test4() 468 field_order = "cpu,pid,comm,dso,sym"; test5() 469 sort_order = "dso,pid"; test5() 603 /* setup threads/dso/map/symbols also */ test__hists_output()
|
H A D | builtin-test.c | 53 .desc = "Test dso data read", 57 .desc = "Test dso data cache", 61 .desc = "Test dso data reopen",
|
H A D | hists_link.c | 296 /* default sort order (comm,dso,sym) will be used */ test__hists_link() 302 /* setup threads/dso/map/symbols also */ test__hists_link()
|
H A D | kmod-path.c | 3 #include "dso.h"
|
/linux-4.4.14/tools/perf/scripts/python/ |
H A D | event_analyzing_sample.py | 50 dso text 57 dso text, 77 # Symbol and dso info are not always resolved 78 if (param_dict.has_key("dso")): 79 dso = param_dict["dso"] 81 dso = "Unknown_dso" 89 event = create_event(name, comm, dso, symbol, raw_buf) 95 (event.name, event.symbol, event.comm, event.dso)) 100 (event.name, event.symbol, event.comm, event.dso, event.flags, 129 print "Statistics about the general events grouped by thread/symbol/dso: \n" 143 # Group by dso 144 print "\n%40s %8s %16s\n%s" % ("dso", "number", "histogram", "="*74) 145 dsoq = con.execute("select dso, count(dso) from gen_events group by dso order by -count(dso)")
|
H A D | call-graph-from-postgresql.py | 136 def addChild(self, call_path_id, name, dso, count, time, branch_count): 144 if dso == "[kernel.kallsyms]": 145 dso = "[kernel]" 146 child_item.data[1] = dso 168 dso = "" 181 self.addChild(last_call_path_id, name, dso, count, time, branch_count) 184 dso = query.value(6) 191 self.addChild(last_call_path_id, name, dso, count, time, branch_count)
|
H A D | export-to-postgresql.py | 405 '(SELECT short_name FROM dsos WHERE id=dso_id) AS dso,' 439 '(SELECT dso FROM symbols_view WHERE id = c.symbol_id) AS dso_short_name,' 445 '(SELECT dso FROM symbols_view WHERE id = p.symbol_id) AS parent_dso_short_name'
|
/linux-4.4.14/tools/perf/arch/powerpc/util/ |
H A D | skip-callchain-idx.c | 148 static int check_return_addr(struct dso *dso, u64 map_start, Dwarf_Addr pc) check_return_addr() argument 158 const char *exec_file = dso->long_name; check_return_addr() 160 dwfl = dso->dwfl; check_return_addr() 182 dso->dwfl = dwfl; check_return_addr() 241 struct dso *dso = NULL; arch_skip_callchain_idx() local 255 dso = al.map->dso; arch_skip_callchain_idx() 257 if (!dso) { arch_skip_callchain_idx() 258 pr_debug("%" PRIx64 " dso is NULL\n", ip); arch_skip_callchain_idx() 262 rc = check_return_addr(dso, al.map->start, ip); arch_skip_callchain_idx() 265 dso->long_name, al.sym->name, ip, rc); arch_skip_callchain_idx()
|
H A D | sym-handling.c | 77 if (!pev->uprobes && map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) { arch__fix_tev_from_maps()
|
/linux-4.4.14/tools/perf/ |
H A D | builtin-buildid-list.c | 44 static bool dso__skip_buildid(struct dso *dso, int with_hits) dso__skip_buildid() argument 46 return with_hits && !dso->hit; dso__skip_buildid()
|
H A D | builtin-inject.c | 313 static int dso__read_build_id(struct dso *dso) dso__read_build_id() argument 315 if (dso->has_build_id) dso__read_build_id() 318 if (filename__read_build_id(dso->long_name, dso->build_id, dso__read_build_id() 319 sizeof(dso->build_id)) > 0) { dso__read_build_id() 320 dso->has_build_id = true; dso__read_build_id() 327 static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool, dso__inject_build_id() argument 333 if (dso__read_build_id(dso) < 0) { dso__inject_build_id() 334 pr_debug("no build_id found for %s\n", dso->long_name); dso__inject_build_id() 338 if (dso->kernel) dso__inject_build_id() 341 err = perf_event__synthesize_build_id(tool, dso, misc, perf_event__repipe, dso__inject_build_id() 344 pr_err("Can't synthesize build_id event for %s\n", dso->long_name); dso__inject_build_id() 373 if (!al.map->dso->hit) { perf_event__inject_buildid() 374 al.map->dso->hit = 1; perf_event__inject_buildid() 376 dso__inject_build_id(al.map->dso, tool, machine); perf_event__inject_buildid() 385 al.map->dso->long_name); perf_event__inject_buildid()
|
H A D | builtin-buildid-cache.c | 239 static bool dso__missing_buildid_cache(struct dso *dso, int parm __maybe_unused) dso__missing_buildid_cache() argument 244 if (dso__build_id_filename(dso, filename, sizeof(filename)) && dso__missing_buildid_cache() 252 } else if (memcmp(dso->build_id, build_id, sizeof(dso->build_id))) { dso__missing_buildid_cache()
|
H A D | builtin-mem.c | 80 al.map->dso->hit = 1; dump_raw_samples() 104 al.map ? (al.map->dso ? al.map->dso->long_name : "???") : "???", dump_raw_samples() 176 rep_argv[i++] = "--sort=mem,sym,dso,symbol_daddr," report_events()
|
H A D | builtin-annotate.c | 68 &al->map->dso->symbols[al->map->type]); perf_evsel__add_sample() 70 dso__reset_find_symbol_cache(al->map->dso); perf_evsel__add_sample() 132 if (he->ms.sym == NULL || he->ms.map->dso->annotate_warned) hists__find_annotations() 301 OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", cmd_annotate()
|
H A D | builtin-top.c | 106 if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && perf_top__parse_source() 107 !dso__is_kcore(map->dso)) { perf_top__parse_source() 161 ip, map->dso->long_name, dso__symtab_origin(map->dso), ui__warn_map_erange() 571 const char *help = "For a higher level overview, try: perf top --sort comm,dso"; display_thread_tui() 747 al.map && !RB_EMPTY_ROOT(&al.map->dso->symbols[MAP__FUNCTION]) ? perf_event__process_sample() 769 RB_EMPTY_ROOT(&al.map->dso->symbols[MAP__FUNCTION])) { perf_event__process_sample() 772 dso__strerror_load(al.map->dso, serr, sizeof(serr)); perf_event__process_sample() 1167 "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..." cmd_top() 1189 OPT_STRING(0, "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", cmd_top()
|
H A D | builtin-report.c | 183 al.map->dso->hit = 1; process_sample_event() 394 (kernel_map->dso->hit && report__warn_kptr_restrict() 402 const struct dso *kdso = kernel_map->dso; report__warn_kptr_restrict() 437 const char *help = "For a higher level overview, try: perf report --sort comm,dso"; report__browse_hists() 698 "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..." cmd_report() 725 OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", cmd_report() 873 sort_order = "srcline,symbol,dso"; cmd_report()
|
H A D | builtin-diff.c | 804 OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", 811 "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..."
|
H A D | builtin-record.c | 356 * dso->long_name to a real pathname it found. In this case process_buildids() 375 *a preload dso because default guest module symbols are loaded perf_event__synthesize_guest_os()
|
H A D | builtin-script.c | 71 {.str = "dso", .field = PERF_OUTPUT_DSO}, 1763 "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso," cmd_script()
|
H A D | builtin-trace.c | 2208 fprintf(f, "%s@", al->map->dso->long_name); print_location()
|
/linux-4.4.14/tools/perf/ui/browsers/ |
H A D | map.c | 74 if (ui_browser__show(&browser->b, browser->map->dso->long_name, map_browser__run() 104 .entries = &map->dso->symbols[map->type], map__browse()
|
H A D | hists.c | 1273 const struct dso *dso = hists->dso_filter; hists__browser_title() local 1326 if (dso) 1328 ", DSO: %s", dso->short_name); 1483 if (sym == NULL || map->dso->annotate_warned) add_annotate_opt() 1551 __map__is_kernel(map) ? "the Kernel" : map->dso->short_name); do_zoom_dso() 1552 browser->hists->dso_filter = map->dso; do_zoom_dso() 1571 __map__is_kernel(map) ? "the Kernel" : map->dso->short_name) < 0) add_dso_opt() 1869 browser->selection->map->dso->annotate_warned) 1966 * No need to set actions->dso here since
|
H A D | annotate.c | 480 return snprintf(title, sz, "%s %s", sym->name, map->dso->long_name); sym_title() 1039 if (map->dso->annotate_warned) symbol__tui_annotate()
|
/linux-4.4.14/tools/perf/util/scripting-engines/ |
H A D | trace-event-python.c | 363 if (map && map->dso && (map->dso->name || map->dso->long_name)) { python_process_callchain() 364 if (symbol_conf.show_kernel_path && map->dso->long_name) python_process_callchain() 365 dsoname = map->dso->long_name; python_process_callchain() 366 else if (map->dso->name) python_process_callchain() 367 dsoname = map->dso->name; python_process_callchain() 369 pydict_set_item_string_decref(pyelem, "dso", python_process_callchain() 607 static int python_export_dso(struct db_export *dbe, struct dso *dso, python_export_dso() argument 614 build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); python_export_dso() 618 tuple_set_u64(t, 0, dso->db_id); python_export_dso() 620 tuple_set_string(t, 2, dso->short_name); python_export_dso() 621 tuple_set_string(t, 3, dso->long_name); python_export_dso() 632 struct dso *dso) python_export_symbol() 641 tuple_set_u64(t, 1, dso->db_id); python_export_symbol() 820 pydict_set_item_string_decref(dict, "dso", python_process_general_event() 821 PyString_FromString(al->map->dso->name)); python_process_general_event() 943 SET_TABLE_HANDLER(dso); set_table_handlers() 631 python_export_symbol(struct db_export *dbe, struct symbol *sym, struct dso *dso) python_export_symbol() argument
|
/linux-4.4.14/tools/perf/ui/gtk/ |
H A D | annotate.c | 166 if (map->dso->annotate_warned) symbol__gtk_annotate()
|