Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182461
b: refs/heads/master
c: ee11b90
h: refs/heads/master
i:
  182459: 7c1daa3
v: v3
  • Loading branch information
Kirill Smelkov authored and Ingo Molnar committed Feb 7, 2010
1 parent 0cda364 commit c67bb87
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 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: 5ecaafdbf44b1ba400b746c60c401d54c7ee0863
refs/heads/master: ee11b90b12eb1ec25e1044bac861e90bfd19ec9e
18 changes: 9 additions & 9 deletions trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static void parse_source(struct sym_entry *syme)
while (!feof(file)) {
struct source_line *src;
size_t dummy = 0;
char *c;
char *c, *sep;

src = malloc(sizeof(struct source_line));
assert(src != NULL);
Expand All @@ -235,14 +235,11 @@ static void parse_source(struct sym_entry *syme)
*source->lines_tail = src;
source->lines_tail = &src->next;

if (strlen(src->line)>8 && src->line[8] == ':') {
src->eip = strtoull(src->line, NULL, 16);
src->eip = map->unmap_ip(map, src->eip);
}
if (strlen(src->line)>8 && src->line[16] == ':') {
src->eip = strtoull(src->line, NULL, 16);
src->eip = map->unmap_ip(map, src->eip);
}
src->eip = strtoull(src->line, &sep, 16);
if (*sep == ':')
src->eip = map__objdump_2ip(map, src->eip);
else /* this line has no ip info (e.g. source line) */
src->eip = 0;
}
pclose(file);
out_assign:
Expand Down Expand Up @@ -277,6 +274,9 @@ static void record_precise_ip(struct sym_entry *syme, int counter, u64 ip)
goto out_unlock;

for (line = syme->src->lines; line; line = line->next) {
/* skip lines without IP info */
if (line->eip == 0)
continue;
if (line->eip == ip) {
line->count[counter]++;
break;
Expand Down
8 changes: 8 additions & 0 deletions trunk/tools/perf/util/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,11 @@ u64 map__rip_2objdump(struct map *map, u64 rip)
rip;
return addr;
}

u64 map__objdump_2ip(struct map *map, u64 addr)
{
u64 ip = map->dso->adjust_symbols ?
addr :
map->unmap_ip(map, addr); /* RIP -> IP */
return ip;
}
4 changes: 2 additions & 2 deletions trunk/tools/perf/util/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ static inline u64 identity__map_ip(struct map *map __used, u64 ip)
}


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

u64 map__objdump_2ip(struct map *map, u64 addr);

struct symbol;
struct mmap_event;
Expand Down

0 comments on commit c67bb87

Please sign in to comment.