diff options
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 3b8c00506672..6f0dd90c36ce 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -2107,6 +2107,36 @@ int __machine__create_kernel_maps(struct machine *self, struct dso *kernel) | |||
2107 | return 0; | 2107 | return 0; |
2108 | } | 2108 | } |
2109 | 2109 | ||
2110 | void machine__destroy_kernel_maps(struct machine *self) | ||
2111 | { | ||
2112 | enum map_type type; | ||
2113 | |||
2114 | for (type = 0; type < MAP__NR_TYPES; ++type) { | ||
2115 | struct kmap *kmap; | ||
2116 | |||
2117 | if (self->vmlinux_maps[type] == NULL) | ||
2118 | continue; | ||
2119 | |||
2120 | kmap = map__kmap(self->vmlinux_maps[type]); | ||
2121 | map_groups__remove(&self->kmaps, self->vmlinux_maps[type]); | ||
2122 | if (kmap->ref_reloc_sym) { | ||
2123 | /* | ||
2124 | * ref_reloc_sym is shared among all maps, so free just | ||
2125 | * on one of them. | ||
2126 | */ | ||
2127 | if (type == MAP__FUNCTION) { | ||
2128 | free((char *)kmap->ref_reloc_sym->name); | ||
2129 | kmap->ref_reloc_sym->name = NULL; | ||
2130 | free(kmap->ref_reloc_sym); | ||
2131 | } | ||
2132 | kmap->ref_reloc_sym = NULL; | ||
2133 | } | ||
2134 | |||
2135 | map__delete(self->vmlinux_maps[type]); | ||
2136 | self->vmlinux_maps[type] = NULL; | ||
2137 | } | ||
2138 | } | ||
2139 | |||
2110 | int machine__create_kernel_maps(struct machine *self) | 2140 | int machine__create_kernel_maps(struct machine *self) |
2111 | { | 2141 | { |
2112 | struct dso *kernel = machine__create_kernel(self); | 2142 | struct dso *kernel = machine__create_kernel(self); |
@@ -2351,6 +2381,19 @@ failure: | |||
2351 | return ret; | 2381 | return ret; |
2352 | } | 2382 | } |
2353 | 2383 | ||
2384 | void machines__destroy_guest_kernel_maps(struct rb_root *self) | ||
2385 | { | ||
2386 | struct rb_node *next = rb_first(self); | ||
2387 | |||
2388 | while (next) { | ||
2389 | struct machine *pos = rb_entry(next, struct machine, rb_node); | ||
2390 | |||
2391 | next = rb_next(&pos->rb_node); | ||
2392 | rb_erase(&pos->rb_node, self); | ||
2393 | machine__delete(pos); | ||
2394 | } | ||
2395 | } | ||
2396 | |||
2354 | int machine__load_kallsyms(struct machine *self, const char *filename, | 2397 | int machine__load_kallsyms(struct machine *self, const char *filename, |
2355 | enum map_type type, symbol_filter_t filter) | 2398 | enum map_type type, symbol_filter_t filter) |
2356 | { | 2399 | { |