summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c228
1 files changed, 105 insertions, 123 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 68dbeae8d2..22646f0cca 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -27,6 +27,7 @@
#include "symbol.h"
#include "map_symbol.h"
#include "mem-events.h"
+#include "mem-info.h"
#include "symsrc.h"
#include "strlist.h"
#include "intlist.h"
@@ -532,52 +533,52 @@ static struct symbol *symbols__find_by_name(struct symbol *symbols[],
void dso__reset_find_symbol_cache(struct dso *dso)
{
- dso->last_find_result.addr = 0;
- dso->last_find_result.symbol = NULL;
+ dso__set_last_find_result_addr(dso, 0);
+ dso__set_last_find_result_symbol(dso, NULL);
}
void dso__insert_symbol(struct dso *dso, struct symbol *sym)
{
- __symbols__insert(&dso->symbols, sym, dso->kernel);
+ __symbols__insert(dso__symbols(dso), sym, dso__kernel(dso));
/* update the symbol cache if necessary */
- if (dso->last_find_result.addr >= sym->start &&
- (dso->last_find_result.addr < sym->end ||
+ if (dso__last_find_result_addr(dso) >= sym->start &&
+ (dso__last_find_result_addr(dso) < sym->end ||
sym->start == sym->end)) {
- dso->last_find_result.symbol = sym;
+ dso__set_last_find_result_symbol(dso, sym);
}
}
void dso__delete_symbol(struct dso *dso, struct symbol *sym)
{
- rb_erase_cached(&sym->rb_node, &dso->symbols);
+ rb_erase_cached(&sym->rb_node, dso__symbols(dso));
symbol__delete(sym);
dso__reset_find_symbol_cache(dso);
}
struct symbol *dso__find_symbol(struct dso *dso, u64 addr)
{
- if (dso->last_find_result.addr != addr || dso->last_find_result.symbol == NULL) {
- dso->last_find_result.addr = addr;
- dso->last_find_result.symbol = symbols__find(&dso->symbols, addr);
+ if (dso__last_find_result_addr(dso) != addr || dso__last_find_result_symbol(dso) == NULL) {
+ dso__set_last_find_result_addr(dso, addr);
+ dso__set_last_find_result_symbol(dso, symbols__find(dso__symbols(dso), addr));
}
- return dso->last_find_result.symbol;
+ return dso__last_find_result_symbol(dso);
}
struct symbol *dso__find_symbol_nocache(struct dso *dso, u64 addr)
{
- return symbols__find(&dso->symbols, addr);
+ return symbols__find(dso__symbols(dso), addr);
}
struct symbol *dso__first_symbol(struct dso *dso)
{
- return symbols__first(&dso->symbols);
+ return symbols__first(dso__symbols(dso));
}
struct symbol *dso__last_symbol(struct dso *dso)
{
- return symbols__last(&dso->symbols);
+ return symbols__last(dso__symbols(dso));
}
struct symbol *dso__next_symbol(struct symbol *sym)
@@ -587,11 +588,11 @@ struct symbol *dso__next_symbol(struct symbol *sym)
struct symbol *dso__next_symbol_by_name(struct dso *dso, size_t *idx)
{
- if (*idx + 1 >= dso->symbol_names_len)
+ if (*idx + 1 >= dso__symbol_names_len(dso))
return NULL;
++*idx;
- return dso->symbol_names[*idx];
+ return dso__symbol_names(dso)[*idx];
}
/*
@@ -599,27 +600,29 @@ struct symbol *dso__next_symbol_by_name(struct dso *dso, size_t *idx)
*/
struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name, size_t *idx)
{
- struct symbol *s = symbols__find_by_name(dso->symbol_names, dso->symbol_names_len,
- name, SYMBOL_TAG_INCLUDE__NONE, idx);
- if (!s)
- s = symbols__find_by_name(dso->symbol_names, dso->symbol_names_len,
- name, SYMBOL_TAG_INCLUDE__DEFAULT_ONLY, idx);
+ struct symbol *s = symbols__find_by_name(dso__symbol_names(dso),
+ dso__symbol_names_len(dso),
+ name, SYMBOL_TAG_INCLUDE__NONE, idx);
+ if (!s) {
+ s = symbols__find_by_name(dso__symbol_names(dso), dso__symbol_names_len(dso),
+ name, SYMBOL_TAG_INCLUDE__DEFAULT_ONLY, idx);
+ }
return s;
}
void dso__sort_by_name(struct dso *dso)
{
- mutex_lock(&dso->lock);
+ mutex_lock(dso__lock(dso));
if (!dso__sorted_by_name(dso)) {
size_t len;
- dso->symbol_names = symbols__sort_by_name(&dso->symbols, &len);
- if (dso->symbol_names) {
- dso->symbol_names_len = len;
+ dso__set_symbol_names(dso, symbols__sort_by_name(dso__symbols(dso), &len));
+ if (dso__symbol_names(dso)) {
+ dso__set_symbol_names_len(dso, len);
dso__set_sorted_by_name(dso);
}
}
- mutex_unlock(&dso->lock);
+ mutex_unlock(dso__lock(dso));
}
/*
@@ -746,7 +749,7 @@ static int map__process_kallsym_symbol(void *arg, const char *name,
{
struct symbol *sym;
struct dso *dso = arg;
- struct rb_root_cached *root = &dso->symbols;
+ struct rb_root_cached *root = dso__symbols(dso);
if (!symbol_type__filter(type))
return 0;
@@ -786,8 +789,8 @@ static int maps__split_kallsyms_for_kcore(struct maps *kmaps, struct dso *dso)
{
struct symbol *pos;
int count = 0;
- struct rb_root_cached old_root = dso->symbols;
- struct rb_root_cached *root = &dso->symbols;
+ struct rb_root_cached *root = dso__symbols(dso);
+ struct rb_root_cached old_root = *root;
struct rb_node *next = rb_first_cached(root);
if (!kmaps)
@@ -821,13 +824,13 @@ static int maps__split_kallsyms_for_kcore(struct maps *kmaps, struct dso *dso)
pos->end = map__end(curr_map);
if (pos->end)
pos->end -= map__start(curr_map) - map__pgoff(curr_map);
- symbols__insert(&curr_map_dso->symbols, pos);
+ symbols__insert(dso__symbols(curr_map_dso), pos);
++count;
map__put(curr_map);
}
/* Symbols have been adjusted */
- dso->adjust_symbols = 1;
+ dso__set_adjust_symbols(dso, true);
return count;
}
@@ -844,7 +847,7 @@ static int maps__split_kallsyms(struct maps *kmaps, struct dso *dso, u64 delta,
struct map *curr_map = map__get(initial_map);
struct symbol *pos;
int count = 0, moved = 0;
- struct rb_root_cached *root = &dso->symbols;
+ struct rb_root_cached *root = dso__symbols(dso);
struct rb_node *next = rb_first_cached(root);
int kernel_range = 0;
bool x86_64;
@@ -871,9 +874,9 @@ static int maps__split_kallsyms(struct maps *kmaps, struct dso *dso, u64 delta,
*module++ = '\0';
curr_map_dso = map__dso(curr_map);
- if (strcmp(curr_map_dso->short_name, module)) {
+ if (strcmp(dso__short_name(curr_map_dso), module)) {
if (!RC_CHK_EQUAL(curr_map, initial_map) &&
- dso->kernel == DSO_SPACE__KERNEL_GUEST &&
+ dso__kernel(dso) == DSO_SPACE__KERNEL_GUEST &&
machine__is_default_guest(machine)) {
/*
* We assume all symbols of a module are
@@ -896,7 +899,7 @@ static int maps__split_kallsyms(struct maps *kmaps, struct dso *dso, u64 delta,
goto discard_symbol;
}
curr_map_dso = map__dso(curr_map);
- if (curr_map_dso->loaded &&
+ if (dso__loaded(curr_map_dso) &&
!machine__is_default_guest(machine))
goto discard_symbol;
}
@@ -932,7 +935,7 @@ static int maps__split_kallsyms(struct maps *kmaps, struct dso *dso, u64 delta,
goto add_symbol;
}
- if (dso->kernel == DSO_SPACE__KERNEL_GUEST)
+ if (dso__kernel(dso) == DSO_SPACE__KERNEL_GUEST)
snprintf(dso_name, sizeof(dso_name),
"[guest.kernel].%d",
kernel_range++);
@@ -946,7 +949,7 @@ static int maps__split_kallsyms(struct maps *kmaps, struct dso *dso, u64 delta,
if (ndso == NULL)
return -1;
- ndso->kernel = dso->kernel;
+ dso__set_kernel(ndso, dso__kernel(dso));
curr_map = map__new2(pos->start, ndso);
if (curr_map == NULL) {
@@ -971,7 +974,7 @@ add_symbol:
struct dso *curr_map_dso = map__dso(curr_map);
rb_erase_cached(&pos->rb_node, root);
- symbols__insert(&curr_map_dso->symbols, pos);
+ symbols__insert(dso__symbols(curr_map_dso), pos);
++moved;
} else
++count;
@@ -983,7 +986,7 @@ discard_symbol:
}
if (!RC_CHK_EQUAL(curr_map, initial_map) &&
- dso->kernel == DSO_SPACE__KERNEL_GUEST &&
+ dso__kernel(dso) == DSO_SPACE__KERNEL_GUEST &&
machine__is_default_guest(maps__machine(kmaps))) {
dso__set_loaded(map__dso(curr_map));
}
@@ -1157,7 +1160,7 @@ static int do_validate_kcore_modules_cb(struct map *old_map, void *data)
dso = map__dso(old_map);
/* Module must be in memory at the same address */
- mi = find_module(dso->short_name, modules);
+ mi = find_module(dso__short_name(dso), modules);
if (!mi || mi->start != map__start(old_map))
return -EINVAL;
@@ -1326,7 +1329,7 @@ static int dso__load_kcore(struct dso *dso, struct map *map,
&is_64_bit);
if (err)
goto out_err;
- dso->is_64_bit = is_64_bit;
+ dso__set_is_64_bit(dso, is_64_bit);
if (list_empty(&md.maps)) {
err = -EINVAL;
@@ -1422,10 +1425,10 @@ static int dso__load_kcore(struct dso *dso, struct map *map,
* Set the data type and long name so that kcore can be read via
* dso__data_read_addr().
*/
- if (dso->kernel == DSO_SPACE__KERNEL_GUEST)
- dso->binary_type = DSO_BINARY_TYPE__GUEST_KCORE;
+ if (dso__kernel(dso) == DSO_SPACE__KERNEL_GUEST)
+ dso__set_binary_type(dso, DSO_BINARY_TYPE__GUEST_KCORE);
else
- dso->binary_type = DSO_BINARY_TYPE__KCORE;
+ dso__set_binary_type(dso, DSO_BINARY_TYPE__KCORE);
dso__set_long_name(dso, strdup(kcore_filename), true);
close(fd);
@@ -1486,13 +1489,13 @@ int __dso__load_kallsyms(struct dso *dso, const char *filename,
if (kallsyms__delta(kmap, filename, &delta))
return -1;
- symbols__fixup_end(&dso->symbols, true);
- symbols__fixup_duplicate(&dso->symbols);
+ symbols__fixup_end(dso__symbols(dso), true);
+ symbols__fixup_duplicate(dso__symbols(dso));
- if (dso->kernel == DSO_SPACE__KERNEL_GUEST)
- dso->symtab_type = DSO_BINARY_TYPE__GUEST_KALLSYMS;
+ if (dso__kernel(dso) == DSO_SPACE__KERNEL_GUEST)
+ dso__set_symtab_type(dso, DSO_BINARY_TYPE__GUEST_KALLSYMS);
else
- dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS;
+ dso__set_symtab_type(dso, DSO_BINARY_TYPE__KALLSYMS);
if (!no_kcore && !dso__load_kcore(dso, map, filename))
return maps__split_kallsyms_for_kcore(kmap->kmaps, dso);
@@ -1548,7 +1551,7 @@ static int dso__load_perf_map(const char *map_path, struct dso *dso)
if (sym == NULL)
goto out_delete_line;
- symbols__insert(&dso->symbols, sym);
+ symbols__insert(dso__symbols(dso), sym);
nr_syms++;
}
@@ -1604,7 +1607,7 @@ int dso__load_bfd_symbols(struct dso *dso, const char *debugfile)
if (!bfd_check_format(abfd, bfd_object)) {
pr_debug2("%s: cannot read %s bfd file.\n", __func__,
- dso->long_name);
+ dso__long_name(dso));
goto out_close;
}
@@ -1637,12 +1640,13 @@ int dso__load_bfd_symbols(struct dso *dso, const char *debugfile)
}
if (i < symbols_count) {
/* PE symbols can only have 4 bytes, so use .text high bits */
- dso->text_offset = section->vma - (u32)section->vma;
- dso->text_offset += (u32)bfd_asymbol_value(symbols[i]);
- dso->text_end = (section->vma - dso->text_offset) + section->size;
+ u64 text_offset = (section->vma - (u32)section->vma)
+ + (u32)bfd_asymbol_value(symbols[i]);
+ dso__set_text_offset(dso, text_offset);
+ dso__set_text_end(dso, (section->vma - text_offset) + section->size);
} else {
- dso->text_offset = section->vma - section->filepos;
- dso->text_end = section->filepos + section->size;
+ dso__set_text_offset(dso, section->vma - section->filepos);
+ dso__set_text_end(dso, section->filepos + section->size);
}
}
@@ -1668,21 +1672,21 @@ int dso__load_bfd_symbols(struct dso *dso, const char *debugfile)
else
len = section->size - sym->value;
- start = bfd_asymbol_value(sym) - dso->text_offset;
+ start = bfd_asymbol_value(sym) - dso__text_offset(dso);
symbol = symbol__new(start, len, bfd2elf_binding(sym), STT_FUNC,
bfd_asymbol_name(sym));
if (!symbol)
goto out_free;
- symbols__insert(&dso->symbols, symbol);
+ symbols__insert(dso__symbols(dso), symbol);
}
#ifdef bfd_get_section
#undef bfd_asymbol_section
#endif
- symbols__fixup_end(&dso->symbols, false);
- symbols__fixup_duplicate(&dso->symbols);
- dso->adjust_symbols = 1;
+ symbols__fixup_end(dso__symbols(dso), false);
+ symbols__fixup_duplicate(dso__symbols(dso));
+ dso__set_adjust_symbols(dso, true);
err = 0;
out_free:
@@ -1705,17 +1709,17 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,
case DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO:
case DSO_BINARY_TYPE__BUILDID_DEBUGINFO:
case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO:
- return !kmod && dso->kernel == DSO_SPACE__USER;
+ return !kmod && dso__kernel(dso) == DSO_SPACE__USER;
case DSO_BINARY_TYPE__KALLSYMS:
case DSO_BINARY_TYPE__VMLINUX:
case DSO_BINARY_TYPE__KCORE:
- return dso->kernel == DSO_SPACE__KERNEL;
+ return dso__kernel(dso) == DSO_SPACE__KERNEL;
case DSO_BINARY_TYPE__GUEST_KALLSYMS:
case DSO_BINARY_TYPE__GUEST_VMLINUX:
case DSO_BINARY_TYPE__GUEST_KCORE:
- return dso->kernel == DSO_SPACE__KERNEL_GUEST;
+ return dso__kernel(dso) == DSO_SPACE__KERNEL_GUEST;
case DSO_BINARY_TYPE__GUEST_KMODULE:
case DSO_BINARY_TYPE__GUEST_KMODULE_COMP:
@@ -1725,7 +1729,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,
* kernel modules know their symtab type - it's set when
* creating a module dso in machine__addnew_module_map().
*/
- return kmod && dso->symtab_type == type;
+ return kmod && dso__symtab_type(dso) == type;
case DSO_BINARY_TYPE__BUILD_ID_CACHE:
case DSO_BINARY_TYPE__BUILD_ID_CACHE_DEBUGINFO:
@@ -1793,18 +1797,20 @@ int dso__load(struct dso *dso, struct map *map)
struct build_id bid;
struct nscookie nsc;
char newmapname[PATH_MAX];
- const char *map_path = dso->long_name;
+ const char *map_path = dso__long_name(dso);
+
+ mutex_lock(dso__lock(dso));
+ perfmap = is_perf_pid_map_name(map_path);
- mutex_lock(&dso->lock);
- perfmap = strncmp(dso->name, "/tmp/perf-", 10) == 0;
if (perfmap) {
- if (dso->nsinfo && (dso__find_perf_map(newmapname,
- sizeof(newmapname), &dso->nsinfo) == 0)) {
+ if (dso__nsinfo(dso) &&
+ (dso__find_perf_map(newmapname, sizeof(newmapname),
+ dso__nsinfo_ptr(dso)) == 0)) {
map_path = newmapname;
}
}
- nsinfo__mountns_enter(dso->nsinfo, &nsc);
+ nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
/* check again under the dso->lock */
if (dso__loaded(dso)) {
@@ -1812,15 +1818,15 @@ int dso__load(struct dso *dso, struct map *map)
goto out;
}
- kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ||
- dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
- dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE ||
- dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
+ kmod = dso__symtab_type(dso) == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ||
+ dso__symtab_type(dso) == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
+ dso__symtab_type(dso) == DSO_BINARY_TYPE__GUEST_KMODULE ||
+ dso__symtab_type(dso) == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
- if (dso->kernel && !kmod) {
- if (dso->kernel == DSO_SPACE__KERNEL)
+ if (dso__kernel(dso) && !kmod) {
+ if (dso__kernel(dso) == DSO_SPACE__KERNEL)
ret = dso__load_kernel_sym(dso, map);
- else if (dso->kernel == DSO_SPACE__KERNEL_GUEST)
+ else if (dso__kernel(dso) == DSO_SPACE__KERNEL_GUEST)
ret = dso__load_guest_kernel_sym(dso, map);
machine = maps__machine(map__kmaps(map));
@@ -1829,12 +1835,13 @@ int dso__load(struct dso *dso, struct map *map)
goto out;
}
- dso->adjust_symbols = 0;
+ dso__set_adjust_symbols(dso, false);
if (perfmap) {
ret = dso__load_perf_map(map_path, dso);
- dso->symtab_type = ret > 0 ? DSO_BINARY_TYPE__JAVA_JIT :
- DSO_BINARY_TYPE__NOT_FOUND;
+ dso__set_symtab_type(dso, ret > 0
+ ? DSO_BINARY_TYPE__JAVA_JIT
+ : DSO_BINARY_TYPE__NOT_FOUND);
goto out;
}
@@ -1849,9 +1856,9 @@ int dso__load(struct dso *dso, struct map *map)
* Read the build id if possible. This is required for
* DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
*/
- if (!dso->has_build_id &&
- is_regular_file(dso->long_name)) {
- __symbol__join_symfs(name, PATH_MAX, dso->long_name);
+ if (!dso__has_build_id(dso) &&
+ is_regular_file(dso__long_name(dso))) {
+ __symbol__join_symfs(name, PATH_MAX, dso__long_name(dso));
if (filename__read_build_id(name, &bid) > 0)
dso__set_build_id(dso, &bid);
}
@@ -1885,7 +1892,7 @@ int dso__load(struct dso *dso, struct map *map)
nsinfo__mountns_exit(&nsc);
is_reg = is_regular_file(name);
- if (!is_reg && errno == ENOENT && dso->nsinfo) {
+ if (!is_reg && errno == ENOENT && dso__nsinfo(dso)) {
char *new_name = dso__filename_with_chroot(dso, name);
if (new_name) {
is_reg = is_regular_file(new_name);
@@ -1902,7 +1909,7 @@ int dso__load(struct dso *dso, struct map *map)
sirc = symsrc__init(ss, dso, name, symtab_type);
if (nsexit)
- nsinfo__mountns_enter(dso->nsinfo, &nsc);
+ nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
if (bfdrc == 0) {
ret = 0;
@@ -1915,8 +1922,8 @@ int dso__load(struct dso *dso, struct map *map)
if (!syms_ss && symsrc__has_symtab(ss)) {
syms_ss = ss;
next_slot = true;
- if (!dso->symsrc_filename)
- dso->symsrc_filename = strdup(name);
+ if (!dso__symsrc_filename(dso))
+ dso__set_symsrc_filename(dso, strdup(name));
}
if (!runtime_ss && symsrc__possibly_runtime(ss)) {
@@ -1963,11 +1970,11 @@ int dso__load(struct dso *dso, struct map *map)
symsrc__destroy(&ss_[ss_pos - 1]);
out_free:
free(name);
- if (ret < 0 && strstr(dso->name, " (deleted)") != NULL)
+ if (ret < 0 && strstr(dso__name(dso), " (deleted)") != NULL)
ret = 0;
out:
dso__set_loaded(dso);
- mutex_unlock(&dso->lock);
+ mutex_unlock(dso__lock(dso));
nsinfo__mountns_exit(&nsc);
return ret;
@@ -1990,7 +1997,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
else
symbol__join_symfs(symfs_vmlinux, vmlinux);
- if (dso->kernel == DSO_SPACE__KERNEL_GUEST)
+ if (dso__kernel(dso) == DSO_SPACE__KERNEL_GUEST)
symtab_type = DSO_BINARY_TYPE__GUEST_VMLINUX;
else
symtab_type = DSO_BINARY_TYPE__VMLINUX;
@@ -2006,10 +2013,10 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
* an incorrect long name unless we set it here first.
*/
dso__set_long_name(dso, vmlinux, vmlinux_allocated);
- if (dso->kernel == DSO_SPACE__KERNEL_GUEST)
- dso->binary_type = DSO_BINARY_TYPE__GUEST_VMLINUX;
+ if (dso__kernel(dso) == DSO_SPACE__KERNEL_GUEST)
+ dso__set_binary_type(dso, DSO_BINARY_TYPE__GUEST_VMLINUX);
else
- dso->binary_type = DSO_BINARY_TYPE__VMLINUX;
+ dso__set_binary_type(dso, DSO_BINARY_TYPE__VMLINUX);
err = dso__load_sym(dso, map, &ss, &ss, 0);
symsrc__destroy(&ss);
@@ -2101,7 +2108,7 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
bool is_host = false;
char path[PATH_MAX];
- if (!dso->has_build_id) {
+ if (!dso__has_build_id(dso)) {
/*
* Last resort, if we don't have a build-id and couldn't find
* any vmlinux file, try the running kernel kallsyms table.
@@ -2126,7 +2133,7 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
goto proc_kallsyms;
}
- build_id__sprintf(&dso->bid, sbuild_id);
+ build_id__sprintf(dso__bid(dso), sbuild_id);
/* Find kallsyms in build-id cache with kcore */
scnprintf(path, sizeof(path), "%s/%s/%s",
@@ -2218,7 +2225,7 @@ do_kallsyms:
free(kallsyms_allocated_filename);
if (err > 0 && !dso__is_kcore(dso)) {
- dso->binary_type = DSO_BINARY_TYPE__KALLSYMS;
+ dso__set_binary_type(dso, DSO_BINARY_TYPE__KALLSYMS);
dso__set_long_name(dso, DSO__NAME_KALLSYMS, false);
map__fixup_start(map);
map__fixup_end(map);
@@ -2261,7 +2268,7 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map)
if (err > 0)
pr_debug("Using %s for symbols\n", kallsyms_filename);
if (err > 0 && !dso__is_kcore(dso)) {
- dso->binary_type = DSO_BINARY_TYPE__GUEST_KALLSYMS;
+ dso__set_binary_type(dso, DSO_BINARY_TYPE__GUEST_KALLSYMS);
dso__set_long_name(dso, machine->mmap_name, false);
map__fixup_start(map);
map__fixup_end(map);
@@ -2575,31 +2582,6 @@ int symbol__config_symfs(const struct option *opt __maybe_unused,
return 0;
}
-struct mem_info *mem_info__get(struct mem_info *mi)
-{
- if (mi)
- refcount_inc(&mi->refcnt);
- return mi;
-}
-
-void mem_info__put(struct mem_info *mi)
-{
- if (mi && refcount_dec_and_test(&mi->refcnt)) {
- addr_map_symbol__exit(&mi->iaddr);
- addr_map_symbol__exit(&mi->daddr);
- free(mi);
- }
-}
-
-struct mem_info *mem_info__new(void)
-{
- struct mem_info *mi = zalloc(sizeof(*mi));
-
- if (mi)
- refcount_set(&mi->refcnt, 1);
- return mi;
-}
-
/*
* Checks that user supplied symbol kernel files are accessible because
* the default mechanism for accessing elf files fails silently. i.e. if