Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182447
b: refs/heads/master
c: 7a2b620
h: refs/heads/master
i:
  182445: 867d219
  182443: f03bf02
  182439: f5c3735
  182431: ab701cc
v: v3
  • Loading branch information
Kirill Smelkov authored and Ingo Molnar committed Feb 4, 2010
1 parent 8b74e69 commit 808fa5f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 29a9f66d703cb9464e24084e09edab5683e1b6b8
refs/heads/master: 7a2b6209863626cf8362e5ff4653491558f91e67
5 changes: 3 additions & 2 deletions trunk/tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static int parse_line(FILE *file, struct hist_entry *he, u64 len)
line_ip = -1;
}

start = he->map->unmap_ip(he->map, sym->start);
start = map__rip_2objdump(he->map, sym->start);

if (line_ip != -1) {
const char *path = NULL;
Expand Down Expand Up @@ -397,7 +397,8 @@ static void annotate_sym(struct hist_entry *he)
dso, dso->long_name, sym, sym->name);

sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s|grep -v %s",
map->unmap_ip(map, sym->start), map->unmap_ip(map, sym->end),
map__rip_2objdump(map, sym->start),
map__rip_2objdump(map, sym->end),
filename, filename);

if (verbose >= 3)
Expand Down
12 changes: 12 additions & 0 deletions trunk/tools/perf/util/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,15 @@ size_t map__fprintf(struct map *self, FILE *fp)
return fprintf(fp, " %Lx-%Lx %Lx %s\n",
self->start, self->end, self->pgoff, self->dso->name);
}

/*
* objdump wants/reports absolute IPs for ET_EXEC, and RIPs for ET_DYN.
* map->dso->adjust_symbols==1 for ET_EXEC-like cases.
*/
u64 map__rip_2objdump(struct map *map, u64 rip)
{
u64 addr = map->dso->adjust_symbols ?
map->unmap_ip(map, rip) : /* RIP -> IP */
rip;
return addr;
}
9 changes: 9 additions & 0 deletions trunk/tools/perf/util/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ struct map {
u64 end;
enum map_type type;
u64 pgoff;

/* ip -> dso rip */
u64 (*map_ip)(struct map *, u64);
/* dso rip -> ip */
u64 (*unmap_ip)(struct map *, u64);

struct dso *dso;
};

Expand Down Expand Up @@ -56,6 +60,11 @@ static inline u64 identity__map_ip(struct map *map __used, u64 ip)
return ip;
}


/* rip -> addr suitable for passing to `objdump --start-address=` */
u64 map__rip_2objdump(struct map *map, u64 rip);


struct symbol;
struct mmap_event;

Expand Down

0 comments on commit 808fa5f

Please sign in to comment.