linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Anton Blanchard <anton@au1.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>,
	Wang Nan <wangnan0@huawei.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf symbols: Fix annotation of objects with debuginfo files
Date: Fri, 12 Aug 2016 22:17:03 +0530	[thread overview]
Message-ID: <20160812164703.GB12782@naverao1-tp.localdomain> (raw)
In-Reply-To: <20160812163505.4fa6a699@kryten>

On 2016/08/12 04:35PM, Anton Blanchard wrote:
> From: Anton Blanchard <anton@samba.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@vger.kernel.org # v4.6+
> Fixes: 73cdf0c6ea9c ("perf symbols: Record text offset in dso to calculate objdump address")
> Signed-off-by: Anton Blanchard <anton@samba.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

  parent reply	other threads:[~2016-08-12 16:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12  6:35 [PATCH] perf symbols: Fix annotation of objects with debuginfo files Anton Blanchard
2016-08-12 13:00 ` Arnaldo Carvalho de Melo
2016-08-12 16:47 ` Naveen N. Rao [this message]
2016-08-13  1:55 ` [PATCH v2] " Anton Blanchard
2016-08-14 16:56   ` Naveen N. Rao
2016-08-15  7:13   ` Wangnan (F)
2016-08-15 16:46     ` Naveen N. Rao
2016-08-15 19:48     ` Arnaldo Carvalho de Melo
2016-08-16 18:15   ` [tip:perf/urgent] " tip-bot for Anton Blanchard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160812164703.GB12782@naverao1-tp.localdomain \
    --to=naveen.n.rao@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=anton@au1.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@linux.vnet.ibm.com \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).