All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf symbols: Fix annotation of objects with debuginfo files
@ 2016-08-12  6:35 Anton Blanchard
  2016-08-12 13:00 ` Arnaldo Carvalho de Melo
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Anton Blanchard @ 2016-08-12  6:35 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Naveen N. Rao, Ravi Bangoria, Wang Nan, linux-kernel

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.

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))
 		dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;
 
 	if (runtime_ss->opdsec)

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-08-16 18:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.