perf annotate: Another fix for annotate_browser__callq()
The target address is provided by objdump and is not necessary a memory address. Add a helper to get the correct address. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1381747424-3557-8-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
fc1b691d76
commit
1d5077bdd9
@@ -252,10 +252,16 @@ size_t map__fprintf_dsoname(struct map *map, FILE *fp)
|
||||
return fprintf(fp, "%s", dsoname);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* map__rip_2objdump - convert symbol start address to objdump address.
|
||||
* @map: memory map
|
||||
* @rip: symbol start address
|
||||
*
|
||||
* objdump wants/reports absolute IPs for ET_EXEC, and RIPs for ET_DYN.
|
||||
* map->dso->adjust_symbols==1 for ET_EXEC-like cases except ET_REL which is
|
||||
* relative to section start.
|
||||
*
|
||||
* Return: Address suitable for passing to "objdump --start-address="
|
||||
*/
|
||||
u64 map__rip_2objdump(struct map *map, u64 rip)
|
||||
{
|
||||
@@ -268,6 +274,29 @@ u64 map__rip_2objdump(struct map *map, u64 rip)
|
||||
return map->unmap_ip(map, rip);
|
||||
}
|
||||
|
||||
/**
|
||||
* map__objdump_2mem - convert objdump address to a memory address.
|
||||
* @map: memory map
|
||||
* @ip: objdump address
|
||||
*
|
||||
* Closely related to map__rip_2objdump(), this function takes an address from
|
||||
* objdump and converts it to a memory address. Note this assumes that @map
|
||||
* contains the address. To be sure the result is valid, check it forwards
|
||||
* e.g. map__rip_2objdump(map->map_ip(map, map__objdump_2mem(map, ip))) == ip
|
||||
*
|
||||
* Return: Memory address.
|
||||
*/
|
||||
u64 map__objdump_2mem(struct map *map, u64 ip)
|
||||
{
|
||||
if (!map->dso->adjust_symbols)
|
||||
return map->unmap_ip(map, ip);
|
||||
|
||||
if (map->dso->rel)
|
||||
return map->unmap_ip(map, ip + map->pgoff);
|
||||
|
||||
return ip;
|
||||
}
|
||||
|
||||
void map_groups__init(struct map_groups *mg)
|
||||
{
|
||||
int i;
|
||||
|
Reference in New Issue
Block a user