diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 07642a7b9346dbea6abdcda088aeec6fa34f84a1..1fc0c628683eea5b90d4e14f7efb7026d40cf0a2 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1513,6 +1513,7 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event, printf(" "); if (print_symoffset) { al.addr = node->ip; + al.map = node->map; symbol__fprintf_symname_offs(node->sym, &al, stdout); } else symbol__fprintf_symname(node->sym, stdout); diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 77f3b95bb46df07a0a3f2e1fbf307a741a584c72..7eb0362f4ffd2468c81f6ae1a93686d00dfefe50 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -259,7 +259,10 @@ size_t symbol__fprintf_symname_offs(const struct symbol *sym, if (sym && sym->name) { length = fprintf(fp, "%s", sym->name); if (al) { - offset = al->addr - sym->start; + if (al->addr < sym->end) + offset = al->addr - sym->start; + else + offset = al->addr - al->map->start - sym->start; length += fprintf(fp, "+0x%lx", offset); } return length;