Re: [PATCH] perf symbols: Fix wrong symbol offset according to p_addr

From: Ingo Molnar
Date: Mon Jan 11 2016 - 06:25:44 EST



* He Kuang <hekuang@xxxxxxxxxx> wrote:

> Perf missed the 'VirtAddr' value in elf program_headers when adjusting
> symbol address for dynamic libraries. This patch considers the p_addr
> value and gets the right symbol offset.

s/gets/calculates

>
> Before this patch, some symbols can not be right parsed on android phone:

s/Before this patch, some symbols are not parsed correctly on android phones:

>
> init 369 [002] 339.970607: raw_syscalls:sys_enter: NR 22 (b, 7fd9e360a0, 10, ffffffff, 0, 8)
> ...
> 230ac [unknown] (/system/lib64/libsurfaceflinger.so)
> 11a0 main (/system/bin/surfaceflinger)
> 1c3fc __libc_init (/system/lib64/libc.so)
> fd0 _start (/system/bin/surfaceflinger)
> 29ec __dl__start (/system/bin/linker64)
>
> After this patch:
>
> init 369 [002] 339.970607: raw_syscalls:sys_enter: NR 22 (b, 7fd9e360a0, 10, ffffffff, 0, 8)
> ...
> 3a0ac _ZN7android14SurfaceFlinger3runEv (/system/lib64/libsurfaceflinger.so)
> 11a0 main (/system/bin/surfaceflinger)
> 1c3fc __libc_init (/system/lib64/libc.so)
> fd0 _start (/system/bin/surfaceflinger)
> 29ec __dl__start (/system/bin/linker64)

> --- a/tools/perf/util/dso.h
> +++ b/tools/perf/util/dso.h
> @@ -166,6 +166,7 @@ struct dso {
> const char *long_name;
> u16 long_name_len;
> u16 short_name_len;
> + u64 vaddr;
> void *dwfl; /* DWARF debug info */

btw., looks like there's some extra spaces in front of those other field
definitions.

Also, might make sense to describe what 'vaddr' stands for precisely, the naming
is pretty ambiguous.

Thanks,

Ingo