perf tools: use map->map_ip to get srcline when listing symbol
PATCH 1/1 perf tools: use map->map_ip to get srcline when listing symbol
Revert 5550171b2a9f8df26ff483051d060db06376b26d and do the address mapping using map->map_ip instead of map__rip_2objdump when calling get_srcline
--- tools/perf/util/callchain.c | 4 ++-- tools/perf/util/machine.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/callchain.c +2 -2
@@ -830,8 +830,8 @@ char *callchain_list__sym_name(struct callchain_list *cl,if (callchain_param.key ==CCKEY_ADDRESS && cl->ms.map && !cl->srcline) cl->srcline =get_srcline (cl->ms.map->dso, -map__rip_2objdump (cl->ms.map, - cl->ip), + cl->ms.map->map_ip (cl->ms.map, + cl->ip), cl->ms.sym, false);if (cl->srcline) printed = scnprintf(bf, bfsize, "%s %s",
tools/perf/util/machine.c +1 -1
@@ -1580,7 +1580,7 @@ static int add_callchain_ip(struct thread *thread, } } -return callchain_cursor_append (&callchain_cursor, al.addr, al.map, al.sym); +return callchain_cursor_append (&callchain_cursor, ip, al.map, al.sym); } struct branch_info *sample__resolve_bstack(struct perf_sample *sample,
Signature · 1 line
2.1.4
Quoted 3 lines · Yannick Brosseau
Revert
5550171b2a9f8df26ff483051d060db06376b26dand do the address mapping usingmap->map_ipinstead ofmap__rip_2objdumpwhen callingget_srcline
With that change the source line is not correctly reported anymore:
with your patch:
# Children Self Source:Line Symbol Shared Object
# ........ ........ ........... ............................... ................
#
98.27% 0.00% f1+4194306 [.] f1 tcall
|Without:
# Children Self Source:Line Symbol Shared Object
# ........ ........ ........... ............................... ................
#
98.27% 0.00% f1+2 [.] f1 tcall and also the other way round when debug info is available the lines in --branch-history output are not correctly resolved anymore.
before:
99.35% 0.00% f1+19 [.] f1 tcall
|
---f1 tcall.c:12
f1 tcall.c:12
f2 tcall.c:7after
99.35% 5.87% /home/ak/hl [.] f2 tcall
|
|--94.09%-- f2 +27
| f2 +0
| |
| |--69.26%-- f1 +19
| | f1 +14
| | f2 +27So the source:line improved, but the callgraph entries regressed.
Probably these two cases need to be handled differently.
BTW the commit description is not very clear.
-Andi
Quoted 38 lines
Signed-off-by Yannick Brosseau <[email protected]>--- tools/perf/util/callchain.c | 4 ++-- tools/perf/util/machine.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)tools/perf/util/callchain.c +2
-2@@ -830,8 +830,8 @@ char *callchain_list__sym_name(struct callchain_list *cl,if (callchain_param.key ==CCKEY_ADDRESS && cl->ms.map && !cl->srcline) cl->srcline =get_srcline (cl->ms.map->dso, -map__rip_2objdump (cl->ms.map, - cl->ip), + cl->ms.map->map_ip (cl->ms.map, + cl->ip), cl->ms.sym, false);if (cl->srcline) printed = scnprintf(bf, bfsize, "%s %s",tools/perf/util/machine.c +1
-1@@ -1580,7 +1580,7 @@ static int add_callchain_ip(struct thread *thread, } } -return callchain_cursor_append (&callchain_cursor, al.addr, al.map, al.sym); +return callchain_cursor_append (&callchain_cursor, ip, al.map, al.sym); } struct branch_info *sample__resolve_bstack(struct perf_sample *sample,Signature · 1 line
2.1.4
Signature · 1 line
[email protected] -- Speaking for myself only