[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160812164703.GB12782@naverao1-tp.localdomain>
Date: Fri, 12 Aug 2016 22:17:03 +0530
From: "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
To: Anton Blanchard <anton@....ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>,
Wang Nan <wangnan0@...wei.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf symbols: Fix annotation of objects with debuginfo
files
On 2016/08/12 04:35PM, Anton Blanchard wrote:
> From: Anton Blanchard <anton@...ba.org>
>
> Commit 73cdf0c6ea9c ("perf symbols: Record text offset in dso
> to calculate objdump address") started storing the offset of
> the text section for all DSOs:
>
> if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
> dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;
>
> Unfortunately this breaks debuginfo files, because we need to calculate
> the offset of the text section in the associated executable file. As a
> result perf annotate returns junk for all debuginfo files.
I am able to reproduce this.
>
> Fix this by using runtime_ss->elf which should point at the executable
> when parsing a debuginfo file.
>
> Cc: stable@...r.kernel.org # v4.6+
> Fixes: 73cdf0c6ea9c ("perf symbols: Record text offset in dso to calculate objdump address")
> Signed-off-by: Anton Blanchard <anton@...ba.org>
> ---
>
> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
> index a34321e..9e36073 100644
> --- a/tools/perf/util/symbol-elf.c
> +++ b/tools/perf/util/symbol-elf.c
> @@ -837,7 +837,7 @@ int dso__load_sym(struct dso *dso, struct map *map,
> sec = syms_ss->symtab;
> shdr = syms_ss->symshdr;
>
> - if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
> + if (elf_section_by_name(runtime_ss->elf, &ehdr, &tshdr, ".text", NULL))
^^^^^
I suppose you missed updating ehdr to runtime_ss->ehdr?
With that change, perf annotate works for me.
- Naveen
Powered by blists - more mailing lists