diff options
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-top.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index befa57e2284d..c72ab50d65ca 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -202,10 +202,9 @@ static void parse_source(struct sym_entry *syme) | |||
202 | len = sym->end - sym->start; | 202 | len = sym->end - sym->start; |
203 | 203 | ||
204 | sprintf(command, | 204 | sprintf(command, |
205 | "objdump --start-address=0x%016Lx " | 205 | "objdump --start-address=%#0*Lx --stop-address=%#0*Lx -dS %s", |
206 | "--stop-address=0x%016Lx -dS %s", | 206 | BITS_PER_LONG / 4, map__rip_2objdump(map, sym->start), |
207 | map__rip_2objdump(map, sym->start), | 207 | BITS_PER_LONG / 4, map__rip_2objdump(map, sym->end), path); |
208 | map__rip_2objdump(map, sym->end), path); | ||
209 | 208 | ||
210 | file = popen(command, "r"); | 209 | file = popen(command, "r"); |
211 | if (!file) | 210 | if (!file) |
@@ -292,13 +291,15 @@ static void lookup_sym_source(struct sym_entry *syme) | |||
292 | { | 291 | { |
293 | struct symbol *symbol = sym_entry__symbol(syme); | 292 | struct symbol *symbol = sym_entry__symbol(syme); |
294 | struct source_line *line; | 293 | struct source_line *line; |
295 | char pattern[PATH_MAX]; | 294 | const size_t pattern_len = BITS_PER_LONG / 4 + 2; |
295 | char pattern[pattern_len + 1]; | ||
296 | 296 | ||
297 | sprintf(pattern, "<%s>:", symbol->name); | 297 | sprintf(pattern, "%0*Lx <", BITS_PER_LONG / 4, |
298 | map__rip_2objdump(syme->map, symbol->start)); | ||
298 | 299 | ||
299 | pthread_mutex_lock(&syme->src->lock); | 300 | pthread_mutex_lock(&syme->src->lock); |
300 | for (line = syme->src->lines; line; line = line->next) { | 301 | for (line = syme->src->lines; line; line = line->next) { |
301 | if (strstr(line->line, pattern)) { | 302 | if (memcmp(line->line, pattern, pattern_len) == 0) { |
302 | syme->src->source = line; | 303 | syme->src->source = line; |
303 | break; | 304 | break; |
304 | } | 305 | } |