Skip to content

Commit 6754075

Browse files
milianwacmel
authored andcommitted
perf unwind: Use addr_location::addr instead of ip for entries
This fixes the srcline translation for call chains of user space applications. Before we got: perf report --stdio --no-children -s sym,srcline -g address 8.92% [.] main mandelbrot.h:41 | |--3.70%--main +8390240 | __libc_start_main +139950056726769 | _start +8388650 | |--2.74%--main +8390189 | --2.08%--main +8390296 __libc_start_main +139950056726769 _start +8388650 7.59% [.] main complex:1326 | |--4.79%--main +8390203 | __libc_start_main +139950056726769 | _start +8388650 | --2.80%--main +8390219 7.12% [.] __muldc3 libgcc2.c:1945 | |--3.76%--__muldc3 +139950060519490 | main +8390224 | __libc_start_main +139950056726769 | _start +8388650 | --3.32%--__muldc3 +139950060519512 main +8390224 With this patch applied, we instead get: perf report --stdio --no-children -s sym,srcline -g address 8.92% [.] main mandelbrot.h:41 | |--3.70%--main mandelbrot.h:41 | __libc_start_main +241 | _start +4194346 | |--2.74%--main mandelbrot.h:41 | --2.08%--main mandelbrot.h:41 __libc_start_main +241 _start +4194346 7.59% [.] main complex:1326 | |--4.79%--main complex:1326 | __libc_start_main +241 | _start +4194346 | --2.80%--main complex:1326 7.12% [.] __muldc3 libgcc2.c:1945 | |--3.76%--__muldc3 libgcc2.c:1945 | main mandelbrot.h:39 | __libc_start_main +241 | _start +4194346 | --3.32%--__muldc3 libgcc2.c:1945 main mandelbrot.h:39 Suggested-and-Acked-by: Namhyung Kim <[email protected]> Signed-off-by: Milian Wolff <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> LPU-Reference: [email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 3cace81 commit 6754075

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tools/perf/util/unwind-libdw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static int entry(u64 ip, struct unwind_info *ui)
6666
if (__report_module(&al, ip, ui))
6767
return -1;
6868

69-
e->ip = ip;
69+
e->ip = al.addr;
7070
e->map = al.map;
7171
e->sym = al.sym;
7272

tools/perf/util/unwind-libunwind-local.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ static int entry(u64 ip, struct thread *thread,
542542
thread__find_addr_location(thread, PERF_RECORD_MISC_USER,
543543
MAP__FUNCTION, ip, &al);
544544

545-
e.ip = ip;
545+
e.ip = al.addr;
546546
e.map = al.map;
547547
e.sym = al.sym;
548548

0 commit comments

Comments
 (0)