Lines Matching refs:dso
44 static int dso__load_kernel_sym(struct dso *dso, struct map *map);
45 static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map);
517 void dso__reset_find_symbol_cache(struct dso *dso) in dso__reset_find_symbol_cache() argument
519 dso->last_find_result.addr = 0; in dso__reset_find_symbol_cache()
520 dso->last_find_result.symbol = NULL; in dso__reset_find_symbol_cache()
523 void dso__insert_symbol(struct dso *dso, struct symbol *sym) in dso__insert_symbol() argument
525 __symbols__insert(&dso->symbols, sym, dso->kernel); in dso__insert_symbol()
528 if (dso->last_find_result.addr >= sym->start && in dso__insert_symbol()
529 (dso->last_find_result.addr < sym->end || in dso__insert_symbol()
531 dso->last_find_result.symbol = sym; in dso__insert_symbol()
535 void dso__delete_symbol(struct dso *dso, struct symbol *sym) in dso__delete_symbol() argument
537 rb_erase_cached(&sym->rb_node, &dso->symbols); in dso__delete_symbol()
539 dso__reset_find_symbol_cache(dso); in dso__delete_symbol()
542 struct symbol *dso__find_symbol(struct dso *dso, u64 addr) in dso__find_symbol() argument
544 if (dso->last_find_result.addr != addr || dso->last_find_result.symbol == NULL) { in dso__find_symbol()
545 dso->last_find_result.addr = addr; in dso__find_symbol()
546 dso->last_find_result.symbol = symbols__find(&dso->symbols, addr); in dso__find_symbol()
549 return dso->last_find_result.symbol; in dso__find_symbol()
552 struct symbol *dso__first_symbol(struct dso *dso) in dso__first_symbol() argument
554 return symbols__first(&dso->symbols); in dso__first_symbol()
557 struct symbol *dso__last_symbol(struct dso *dso) in dso__last_symbol() argument
559 return symbols__last(&dso->symbols); in dso__last_symbol()
578 struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name) in dso__find_symbol_by_name() argument
580 struct symbol *s = symbols__find_by_name(&dso->symbol_names, name, in dso__find_symbol_by_name()
583 s = symbols__find_by_name(&dso->symbol_names, name, in dso__find_symbol_by_name()
588 void dso__sort_by_name(struct dso *dso) in dso__sort_by_name() argument
590 dso__set_sorted_by_name(dso); in dso__sort_by_name()
591 return symbols__sort_by_name(&dso->symbol_names, &dso->symbols); in dso__sort_by_name()
716 struct dso *dso = arg; in map__process_kallsym_symbol() local
717 struct rb_root_cached *root = &dso->symbols; in map__process_kallsym_symbol()
744 static int dso__load_all_kallsyms(struct dso *dso, const char *filename) in dso__load_all_kallsyms() argument
746 return kallsyms__parse(filename, dso, map__process_kallsym_symbol); in dso__load_all_kallsyms()
749 static int maps__split_kallsyms_for_kcore(struct maps *kmaps, struct dso *dso) in maps__split_kallsyms_for_kcore() argument
754 struct rb_root_cached old_root = dso->symbols; in maps__split_kallsyms_for_kcore()
755 struct rb_root_cached *root = &dso->symbols; in maps__split_kallsyms_for_kcore()
787 symbols__insert(&curr_map->dso->symbols, pos); in maps__split_kallsyms_for_kcore()
792 dso->adjust_symbols = 1; in maps__split_kallsyms_for_kcore()
802 static int maps__split_kallsyms(struct maps *kmaps, struct dso *dso, u64 delta, in maps__split_kallsyms() argument
809 struct rb_root_cached *root = &dso->symbols; in maps__split_kallsyms()
834 if (strcmp(curr_map->dso->short_name, module)) { in maps__split_kallsyms()
836 dso->kernel == DSO_SPACE__KERNEL_GUEST && in maps__split_kallsyms()
845 dso__set_loaded(curr_map->dso); in maps__split_kallsyms()
858 if (curr_map->dso->loaded && in maps__split_kallsyms()
880 struct dso *ndso; in maps__split_kallsyms()
893 if (dso->kernel == DSO_SPACE__KERNEL_GUEST) in maps__split_kallsyms()
906 ndso->kernel = dso->kernel; in maps__split_kallsyms()
925 symbols__insert(&curr_map->dso->symbols, pos); in maps__split_kallsyms()
937 dso->kernel == DSO_SPACE__KERNEL_GUEST && in maps__split_kallsyms()
939 dso__set_loaded(curr_map->dso); in maps__split_kallsyms()
1118 mi = find_module(old_map->dso->short_name, &modules); in do_validate_kcore_modules()
1195 struct dso *dso; member
1204 map = map__new2(start, md->dso); in kcore_mapfn()
1295 static int dso__load_kcore(struct dso *dso, struct map *map, in dso__load_kcore() argument
1324 md.dso = dso; in dso__load_kcore()
1339 dso->is_64_bit = is_64_bit; in dso__load_kcore()
1415 if (dso->kernel == DSO_SPACE__KERNEL_GUEST) in dso__load_kcore()
1416 dso->binary_type = DSO_BINARY_TYPE__GUEST_KCORE; in dso__load_kcore()
1418 dso->binary_type = DSO_BINARY_TYPE__KCORE; in dso__load_kcore()
1419 dso__set_long_name(dso, strdup(kcore_filename), true); in dso__load_kcore()
1458 int __dso__load_kallsyms(struct dso *dso, const char *filename, in __dso__load_kallsyms() argument
1470 if (dso__load_all_kallsyms(dso, filename) < 0) in __dso__load_kallsyms()
1476 symbols__fixup_end(&dso->symbols, true); in __dso__load_kallsyms()
1477 symbols__fixup_duplicate(&dso->symbols); in __dso__load_kallsyms()
1479 if (dso->kernel == DSO_SPACE__KERNEL_GUEST) in __dso__load_kallsyms()
1480 dso->symtab_type = DSO_BINARY_TYPE__GUEST_KALLSYMS; in __dso__load_kallsyms()
1482 dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS; in __dso__load_kallsyms()
1484 if (!no_kcore && !dso__load_kcore(dso, map, filename)) in __dso__load_kallsyms()
1485 return maps__split_kallsyms_for_kcore(kmap->kmaps, dso); in __dso__load_kallsyms()
1487 return maps__split_kallsyms(kmap->kmaps, dso, delta, map); in __dso__load_kallsyms()
1490 int dso__load_kallsyms(struct dso *dso, const char *filename, in dso__load_kallsyms() argument
1493 return __dso__load_kallsyms(dso, filename, map, false); in dso__load_kallsyms()
1496 static int dso__load_perf_map(const char *map_path, struct dso *dso) in dso__load_perf_map() argument
1538 symbols__insert(&dso->symbols, sym); in dso__load_perf_map()
1578 int dso__load_bfd_symbols(struct dso *dso, const char *debugfile) in dso__load_bfd_symbols() argument
1588 abfd = bfd_openr(dso->long_name, NULL); in dso__load_bfd_symbols()
1594 dso->long_name); in dso__load_bfd_symbols()
1603 dso->text_offset = section->vma - section->filepos; in dso__load_bfd_symbols()
1659 start = bfd_asymbol_value(sym) - dso->text_offset; in dso__load_bfd_symbols()
1665 symbols__insert(&dso->symbols, symbol); in dso__load_bfd_symbols()
1671 symbols__fixup_end(&dso->symbols, false); in dso__load_bfd_symbols()
1672 symbols__fixup_duplicate(&dso->symbols); in dso__load_bfd_symbols()
1673 dso->adjust_symbols = 1; in dso__load_bfd_symbols()
1684 static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod, in dso__is_compatible_symtab_type() argument
1696 return !kmod && dso->kernel == DSO_SPACE__USER; in dso__is_compatible_symtab_type()
1701 return dso->kernel == DSO_SPACE__KERNEL; in dso__is_compatible_symtab_type()
1706 return dso->kernel == DSO_SPACE__KERNEL_GUEST; in dso__is_compatible_symtab_type()
1716 return kmod && dso->symtab_type == type; in dso__is_compatible_symtab_type()
1769 int dso__load(struct dso *dso, struct map *map) in dso__load() argument
1784 const char *map_path = dso->long_name; in dso__load()
1786 perfmap = strncmp(dso->name, "/tmp/perf-", 10) == 0; in dso__load()
1788 if (dso->nsinfo && (dso__find_perf_map(newmapname, in dso__load()
1789 sizeof(newmapname), &dso->nsinfo) == 0)) { in dso__load()
1794 nsinfo__mountns_enter(dso->nsinfo, &nsc); in dso__load()
1795 pthread_mutex_lock(&dso->lock); in dso__load()
1798 if (dso__loaded(dso)) { in dso__load()
1803 kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE || in dso__load()
1804 dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP || in dso__load()
1805 dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE || in dso__load()
1806 dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; in dso__load()
1808 if (dso->kernel && !kmod) { in dso__load()
1809 if (dso->kernel == DSO_SPACE__KERNEL) in dso__load()
1810 ret = dso__load_kernel_sym(dso, map); in dso__load()
1811 else if (dso->kernel == DSO_SPACE__KERNEL_GUEST) in dso__load()
1812 ret = dso__load_guest_kernel_sym(dso, map); in dso__load()
1816 machine__map_x86_64_entry_trampolines(machine, dso); in dso__load()
1820 dso->adjust_symbols = 0; in dso__load()
1823 ret = dso__load_perf_map(map_path, dso); in dso__load()
1824 dso->symtab_type = ret > 0 ? DSO_BINARY_TYPE__JAVA_JIT : in dso__load()
1840 if (!dso->has_build_id && in dso__load()
1841 is_regular_file(dso->long_name)) { in dso__load()
1842 __symbol__join_symfs(name, PATH_MAX, dso->long_name); in dso__load()
1844 dso__set_build_id(dso, &bid); in dso__load()
1865 if (!dso__is_compatible_symtab_type(dso, kmod, symtab_type)) in dso__load()
1868 if (dso__read_binary_type_filename(dso, symtab_type, in dso__load()
1878 bfdrc = dso__load_bfd_symbols(dso, name); in dso__load()
1881 sirc = symsrc__init(ss, dso, name, symtab_type); in dso__load()
1884 nsinfo__mountns_enter(dso->nsinfo, &nsc); in dso__load()
1897 if (!dso->symsrc_filename) in dso__load()
1898 dso->symsrc_filename = strdup(name); in dso__load()
1929 ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); in dso__load()
1936 nr_plt = dso__synthesize_plt_symbols(dso, runtime_ss); in dso__load()
1945 if (ret < 0 && strstr(dso->name, " (deleted)") != NULL) in dso__load()
1948 dso__set_loaded(dso); in dso__load()
1949 pthread_mutex_unlock(&dso->lock); in dso__load()
1958 return strcmp(ma->dso->short_name, mb->dso->short_name); in map__strcmp()
1964 return strcmp(name, map->dso->short_name); in map__strcmp_name()
2011 if (maps->last_search_by_name && strcmp(maps->last_search_by_name->dso->short_name, name) == 0) { in maps__find_by_name()
2026 if (strcmp(map->dso->short_name, name) == 0) { in maps__find_by_name()
2038 int dso__load_vmlinux(struct dso *dso, struct map *map, in dso__load_vmlinux() argument
2051 if (dso->kernel == DSO_SPACE__KERNEL_GUEST) in dso__load_vmlinux()
2056 if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type)) in dso__load_vmlinux()
2059 err = dso__load_sym(dso, map, &ss, &ss, 0); in dso__load_vmlinux()
2063 if (dso->kernel == DSO_SPACE__KERNEL_GUEST) in dso__load_vmlinux()
2064 dso->binary_type = DSO_BINARY_TYPE__GUEST_VMLINUX; in dso__load_vmlinux()
2066 dso->binary_type = DSO_BINARY_TYPE__VMLINUX; in dso__load_vmlinux()
2067 dso__set_long_name(dso, vmlinux, vmlinux_allocated); in dso__load_vmlinux()
2068 dso__set_loaded(dso); in dso__load_vmlinux()
2075 int dso__load_vmlinux_path(struct dso *dso, struct map *map) in dso__load_vmlinux_path() argument
2084 err = dso__load_vmlinux(dso, map, vmlinux_path[i], false); in dso__load_vmlinux_path()
2090 filename = dso__build_id_filename(dso, NULL, 0, false); in dso__load_vmlinux_path()
2092 err = dso__load_vmlinux(dso, map, filename, true); in dso__load_vmlinux_path()
2148 static char *dso__find_kallsyms(struct dso *dso, struct map *map) in dso__find_kallsyms() argument
2155 if (!dso->has_build_id) { in dso__find_kallsyms()
2164 is_host = dso__build_id_equal(dso, &bid); in dso__find_kallsyms()
2180 build_id__sprintf(&dso->bid, sbuild_id); in dso__find_kallsyms()
2205 static int dso__load_kernel_sym(struct dso *dso, struct map *map) in dso__load_kernel_sym() argument
2231 return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name, false); in dso__load_kernel_sym()
2235 err = dso__load_vmlinux_path(dso, map); in dso__load_kernel_sym()
2244 kallsyms_allocated_filename = dso__find_kallsyms(dso, map); in dso__load_kernel_sym()
2251 err = dso__load_kallsyms(dso, kallsyms_filename, map); in dso__load_kernel_sym()
2256 if (err > 0 && !dso__is_kcore(dso)) { in dso__load_kernel_sym()
2257 dso->binary_type = DSO_BINARY_TYPE__KALLSYMS; in dso__load_kernel_sym()
2258 dso__set_long_name(dso, DSO__NAME_KALLSYMS, false); in dso__load_kernel_sym()
2266 static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map) in dso__load_guest_kernel_sym() argument
2280 err = dso__load_vmlinux(dso, map, in dso__load_guest_kernel_sym()
2294 err = dso__load_kallsyms(dso, kallsyms_filename, map); in dso__load_guest_kernel_sym()
2297 if (err > 0 && !dso__is_kcore(dso)) { in dso__load_guest_kernel_sym()
2298 dso->binary_type = DSO_BINARY_TYPE__GUEST_KALLSYMS; in dso__load_guest_kernel_sym()
2299 dso__set_long_name(dso, machine->mmap_name, false); in dso__load_guest_kernel_sym()