linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf unwind: check symsrc ELF for .debug_frame
@ 2016-08-10 13:36 Rabin Vincent
  2016-08-10 14:00 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Rabin Vincent @ 2016-08-10 13:36 UTC (permalink / raw)
  To: acme; +Cc: linux-kernel, Rabin Vincent

From: Rabin Vincent <rabinv@axis.com>

When using split debug info, the file without debug info may not have a
.debug_frame section, so we need to check the symsrc ELF also, since
that's the file we actually read the unwind information from.

Signed-off-by: Rabin Vincent <rabinv@axis.com>
---
 tools/perf/util/unwind-libunwind-local.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index 97c0f8f..d492192 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -308,6 +308,20 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
 		dso__data_put_fd(dso);
 	}
 
+	/*
+	 * With split debug info, the file without debug info may not have a
+	 * .debug_frame, so check the symsrc too.
+	 */
+	if (ofs == 0 && dso->symsrc_filename) {
+		fd = open(dso->symsrc_filename, O_RDONLY);
+		if (fd < 0)
+			return -EINVAL;
+
+		ofs = elf_section_offset(fd, ".debug_frame");
+		dso->data.debug_frame_offset = ofs;
+		close(fd);
+	}
+
 	*offset = ofs;
 	if (*offset)
 		return 0;
-- 
2.1.4

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

* Re: [PATCH] perf unwind: check symsrc ELF for .debug_frame
  2016-08-10 13:36 [PATCH] perf unwind: check symsrc ELF for .debug_frame Rabin Vincent
@ 2016-08-10 14:00 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-10 14:00 UTC (permalink / raw)
  To: Rabin Vincent; +Cc: linux-kernel, Rabin Vincent, Jiri Olsa, He Kuang

Em Wed, Aug 10, 2016 at 03:36:16PM +0200, Rabin Vincent escreveu:
> From: Rabin Vincent <rabinv@axis.com>
> 
> When using split debug info, the file without debug info may not have a
> .debug_frame section, so we need to check the symsrc ELF also, since
> that's the file we actually read the unwind information from.

Thanks for your work, next time please also copy the persons that did
work on this file recently, like:

He Kuang <hekuang@huawei.com>

And people who acked or reviewed their patches, like:

Jiri Olsa <jolsa@kernel.org>

Guys, are you ok with these changes? 2/2 seems trivial enough.

- Arnaldo
 
> Signed-off-by: Rabin Vincent <rabinv@axis.com>
> ---
>  tools/perf/util/unwind-libunwind-local.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
> index 97c0f8f..d492192 100644
> --- a/tools/perf/util/unwind-libunwind-local.c
> +++ b/tools/perf/util/unwind-libunwind-local.c
> @@ -308,6 +308,20 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
>  		dso__data_put_fd(dso);
>  	}
>  
> +	/*
> +	 * With split debug info, the file without debug info may not have a
> +	 * .debug_frame, so check the symsrc too.
> +	 */
> +	if (ofs == 0 && dso->symsrc_filename) {
> +		fd = open(dso->symsrc_filename, O_RDONLY);
> +		if (fd < 0)
> +			return -EINVAL;
> +
> +		ofs = elf_section_offset(fd, ".debug_frame");
> +		dso->data.debug_frame_offset = ofs;
> +		close(fd);
> +	}
> +
>  	*offset = ofs;
>  	if (*offset)
>  		return 0;
> -- 
> 2.1.4

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-10 13:36 [PATCH] perf unwind: check symsrc ELF for .debug_frame Rabin Vincent
2016-08-10 14:00 ` Arnaldo Carvalho de Melo

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).