From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752802AbcHLNAy (ORCPT ); Fri, 12 Aug 2016 09:00:54 -0400 Received: from mail.kernel.org ([198.145.29.136]:49932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752768AbcHLNAw (ORCPT ); Fri, 12 Aug 2016 09:00:52 -0400 Date: Fri, 12 Aug 2016 10:00:39 -0300 From: Arnaldo Carvalho de Melo To: Wang Nan Cc: Anton Blanchard , Peter Zijlstra , Ingo Molnar , "Naveen N. Rao" , Ravi Bangoria , linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf symbols: Fix annotation of objects with debuginfo files Message-ID: <20160812130039.GI27651@kernel.org> References: <20160812163505.4fa6a699@kryten> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160812163505.4fa6a699@kryten> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Aug 12, 2016 at 04:35:05PM +1000, Anton Blanchard escreveu: > From: Anton Blanchard > > 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. > > Fix this by using runtime_ss->elf which should point at the executable > when parsing a debuginfo file. Wang, can I have your ack or reviewed-by? - Arnaldo > 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 > --- > > 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)) > dso->text_offset = tshdr.sh_addr - tshdr.sh_offset; > > if (runtime_ss->opdsec)