perf tools: Add ->unmap_ip operation to struct map

We need this because we get section relative addresses when
reading the symtabs, but when a tool like 'perf annotate' needs
to match these address to what 'objdump -dS' produces we need
the address + section back again.

So in annotate now we look at the 'struct hist_entry' instances
(that weren't really being used) so that we iterate only over
the symbols that had some hit and get the map where that
particular hit happened so that we can get the right address to
match with annotate.

Verified that at least:

 perf annotate mmap_read_counter # Uses the ~/bin/perf binary
 perf annotate --vmlinux /home/acme/git/build/perf/vmlinux intel_pmu_enable_all

on a 'perf record perf top' session seems to work.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1255979877-12533-1-git-send-email-acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arnaldo Carvalho de Melo
2009-10-19 17:17:57 -02:00
committed by Ingo Molnar
parent bbe2987bea
commit ed52ce2e3c
4 changed files with 58 additions and 26 deletions

View File

@ -337,7 +337,7 @@ static int kernel_maps__split_kallsyms(symbol_filter_t filter, int use_modules)
return -1;
}
map->map_ip = vdso__map_ip;
map->map_ip = map->unmap_ip = identity__map_ip;
kernel_maps__insert(map);
++kernel_range;
}
@ -790,7 +790,8 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
dso__delete(curr_dso);
goto out_elf_end;
}
curr_map->map_ip = vdso__map_ip;
curr_map->map_ip = identity__map_ip;
curr_map->unmap_ip = identity__map_ip;
curr_dso->origin = DSO__ORIG_KERNEL;
kernel_maps__insert(curr_map);
dsos__add(curr_dso);
@ -1158,6 +1159,7 @@ static struct map *map__new2(u64 start, struct dso *dso)
self->pgoff = 0;
self->dso = dso;
self->map_ip = map__map_ip;
self->unmap_ip = map__unmap_ip;
RB_CLEAR_NODE(&self->rb_node);
}
return self;
@ -1259,7 +1261,7 @@ int dsos__load_kernel(const char *vmlinux, unsigned int sym_priv_size,
if (kernel_map == NULL)
goto out_delete_dso;
kernel_map->map_ip = vdso__map_ip;
kernel_map->map_ip = kernel_map->unmap_ip = identity__map_ip;
if (use_modules && dsos__load_modules(sym_priv_size) < 0) {
fprintf(stderr, "Failed to load list of modules in use! "