Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1460969 > unrolled thread
| Started by | Anton Blanchard <anton@au1.ibm.com> |
|---|---|
| First post | 2016-08-12 08:40 +0200 |
| Last post | 2016-08-16 20:20 +0200 |
| Articles | 9 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH] perf symbols: Fix annotation of objects with debuginfo files Anton Blanchard <anton@au1.ibm.com> - 2016-08-12 08:40 +0200
Re: [PATCH] perf symbols: Fix annotation of objects with debuginfo files Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-12 15:10 +0200
Re: [PATCH] perf symbols: Fix annotation of objects with debuginfo files "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-08-12 18:50 +0200
[PATCH v2] perf symbols: Fix annotation of objects with debuginfo files Anton Blanchard <anton@au1.ibm.com> - 2016-08-13 04:00 +0200
Re: [PATCH v2] perf symbols: Fix annotation of objects with debuginfo files "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-08-14 19:00 +0200
Re: [PATCH v2] perf symbols: Fix annotation of objects with debuginfo files "Wangnan (F)" <wangnan0@huawei.com> - 2016-08-15 09:20 +0200
Re: [PATCH v2] perf symbols: Fix annotation of objects with debuginfo files "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-08-15 18:50 +0200
Re: [PATCH v2] perf symbols: Fix annotation of objects with debuginfo files Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-15 21:50 +0200
[tip:perf/urgent] perf symbols: Fix annotation of objects with debuginfo files tip-bot for Anton Blanchard <tipbot@zytor.com> - 2016-08-16 20:20 +0200
| From | Anton Blanchard <anton@au1.ibm.com> |
|---|---|
| Date | 2016-08-12 08:40 +0200 |
| Subject | [PATCH] perf symbols: Fix annotation of objects with debuginfo files |
| Message-ID | <s5eil-6wT-1@gated-at.bofh.it> |
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)
[toc] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-08-12 15:10 +0200 |
| Message-ID | <s5knL-22z-13@gated-at.bofh.it> |
| In reply to | #1460969 |
Em Fri, Aug 12, 2016 at 04:35:05PM +1000, Anton Blanchard escreveu:
> 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.
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 <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)
[toc] | [prev] | [next] | [standalone]
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-08-12 18:50 +0200 |
| Message-ID | <s5nOF-489-13@gated-at.bofh.it> |
| In reply to | #1460969 |
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
[toc] | [prev] | [next] | [standalone]
| From | Anton Blanchard <anton@au1.ibm.com> |
|---|---|
| Date | 2016-08-13 04:00 +0200 |
| Subject | [PATCH v2] perf symbols: Fix annotation of objects with debuginfo files |
| Message-ID | <s5woV-1ni-1@gated-at.bofh.it> |
| In reply to | #1460969 |
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>
---
v2: Fix from Naveen
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)
[toc] | [prev] | [next] | [standalone]
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-08-14 19:00 +0200 |
| Subject | Re: [PATCH v2] perf symbols: Fix annotation of objects with debuginfo files |
| Message-ID | <s66Vs-265-25@gated-at.bofh.it> |
| In reply to | #1461569 |
On 2016/08/13 11:55AM, 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.
>
> 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>
> ---
>
> v2: Fix from Naveen
>
> 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)
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Thanks Anton!
- Naveen
[toc] | [prev] | [next] | [standalone]
| From | "Wangnan (F)" <wangnan0@huawei.com> |
|---|---|
| Date | 2016-08-15 09:20 +0200 |
| Subject | Re: [PATCH v2] perf symbols: Fix annotation of objects with debuginfo files |
| Message-ID | <s6klI-2uR-29@gated-at.bofh.it> |
| In reply to | #1461569 |
On 2016/8/13 9:55, 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.
>
> 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>
I don't quite understand the debuginfo problem. I tested
this patch follow steps recorded in commit 99e87f7 and
see no problem.
Tested-by: Wang Nan <wangnan0@huawei.com>
Thank you.
[toc] | [prev] | [next] | [standalone]
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-08-15 18:50 +0200 |
| Subject | Re: [PATCH v2] perf symbols: Fix annotation of objects with debuginfo files |
| Message-ID | <s6tfk-7Z5-15@gated-at.bofh.it> |
| In reply to | #1462591 |
On 2016/08/15 03:13PM, Wang Nan wrote:
>
>
> On 2016/8/13 9:55, 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.
> >
> > 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>
>
> I don't quite understand the debuginfo problem. I tested
Some distributions package debuginfo (DWARF, symbol table, ...) separate
from the actual binary. As an example, on RHEL, if you install both
findutils and findutils-debuginfo, you'll get /usr/bin/find (stripped
binary) and /usr/lib/debug/bin/find.debug, which contains the actual
symbol table and DWARF debug data.
> this patch follow steps recorded in commit 99e87f7 and
> see no problem.
>
> Tested-by: Wang Nan <wangnan0@huawei.com>
>
> Thank you.
Thanks,
- Naveen
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-08-15 21:50 +0200 |
| Subject | Re: [PATCH v2] perf symbols: Fix annotation of objects with debuginfo files |
| Message-ID | <s6w3v-1nS-5@gated-at.bofh.it> |
| In reply to | #1462591 |
Em Mon, Aug 15, 2016 at 03:13:47PM +0800, Wangnan (F) escreveu:
>
>
> On 2016/8/13 9:55, 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.
> >
> > 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>
>
> I don't quite understand the debuginfo problem. I tested
> this patch follow steps recorded in commit 99e87f7 and
> see no problem.
>
> Tested-by: Wang Nan <wangnan0@huawei.com>
Thanks, applied.
- Arnaldo
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Anton Blanchard <tipbot@zytor.com> |
|---|---|
| Date | 2016-08-16 20:20 +0200 |
| Subject | [tip:perf/urgent] perf symbols: Fix annotation of objects with debuginfo files |
| Message-ID | <s6R7Y-6tU-5@gated-at.bofh.it> |
| In reply to | #1461569 |
Commit-ID: 50de1a0c54cdbc69a6dbcbc323f53daf95a4050e
Gitweb: http://git.kernel.org/tip/50de1a0c54cdbc69a6dbcbc323f53daf95a4050e
Author: Anton Blanchard <anton@samba.org>
AuthorDate: Sat, 13 Aug 2016 11:55:33 +1000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
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 <anton@samba.org>
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Tested-by: Wang Nan <wangnan0@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
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 <acme@redhat.com>
---
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)
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web