From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753220AbcHPSQ2 (ORCPT ); Tue, 16 Aug 2016 14:16:28 -0400 Received: from terminus.zytor.com ([198.137.202.10]:38634 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbcHPSQ1 (ORCPT ); Tue, 16 Aug 2016 14:16:27 -0400 Date: Tue, 16 Aug 2016 11:15:46 -0700 From: tip-bot for Anton Blanchard Message-ID: Cc: peterz@infradead.org, acme@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org, naveen.n.rao@linux.vnet.ibm.com, hpa@zytor.com, wangnan0@huawei.com, ravi.bangoria@linux.vnet.ibm.com, tglx@linutronix.de, anton@samba.org Reply-To: linux-kernel@vger.kernel.org, mingo@kernel.org, acme@redhat.com, peterz@infradead.org, wangnan0@huawei.com, ravi.bangoria@linux.vnet.ibm.com, anton@samba.org, tglx@linutronix.de, hpa@zytor.com, naveen.n.rao@linux.vnet.ibm.com In-Reply-To: <20160813115533.6de17912@kryten> References: <20160813115533.6de17912@kryten> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf symbols: Fix annotation of objects with debuginfo files Git-Commit-ID: 50de1a0c54cdbc69a6dbcbc323f53daf95a4050e X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 50de1a0c54cdbc69a6dbcbc323f53daf95a4050e Gitweb: http://git.kernel.org/tip/50de1a0c54cdbc69a6dbcbc323f53daf95a4050e Author: Anton Blanchard AuthorDate: Sat, 13 Aug 2016 11:55:33 +1000 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 15 Aug 2016 16:49:57 -0300 perf symbols: Fix annotation of objects with debuginfo files 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. Signed-off-by: Anton Blanchard Reviewed-by: Naveen N. Rao Tested-by: Wang Nan Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: stable@vger.kernel.org # v4.6+ Fixes: 73cdf0c6ea9c ("perf symbols: Record text offset in dso to calculate objdump address") Link: http://lkml.kernel.org/r/20160813115533.6de17912@kryten Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/symbol-elf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index a34321e..a811c13 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -837,7 +837,8 @@ 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, &runtime_ss->ehdr, &tshdr, + ".text", NULL)) dso->text_offset = tshdr.sh_addr - tshdr.sh_offset; if (runtime_ss->opdsec)