Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1467707
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH RFC RESEND] Perf: lookup dwarf unwind stack info in debug file pointed by .gnu_debuglink |
| Date | 2016-08-22 17:20 +0200 |
| Message-ID | <s8Zb4-7Xs-23@gated-at.bofh.it> (permalink) |
| References | <s8Zb4-7Xs-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Aug 22, 2016 at 02:32:04PM +0200, Matija Glavinic Pecotic wrote:
SNIP
> Signed-off-by: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@nokia.com>
> ---
> tools/perf/util/unwind-libunwind-local.c | 36 ++++++++++++++++++++++++++++----
> 1 file changed, 32 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
> index 97c0f8f..5d40acd 100644
> --- a/tools/perf/util/unwind-libunwind-local.c
> +++ b/tools/perf/util/unwind-libunwind-local.c
> @@ -35,6 +35,7 @@
> #include "util.h"
> #include "debug.h"
> #include "asm/bug.h"
> +#include "dso.h"
>
> extern int
> UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as,
> @@ -292,10 +293,13 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,
>
> #ifndef NO_LIBUNWIND_DEBUG_FRAME
> static int read_unwind_spec_debug_frame(struct dso *dso,
> - struct machine *machine, u64 *offset)
> + struct machine *machine, u64 *offset,
> + char **symfile)
> {
> int fd;
> u64 ofs = dso->data.debug_frame_offset;
> + char *debuglink = malloc(PATH_MAX);
> + int ret = 0;
>
> if (ofs == 0) {
> fd = dso__data_get_fd(dso, machine);
> @@ -312,6 +316,26 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
> if (*offset)
> return 0;
>
> + /* If not found, try to lookup in debuglink */
> + ret = dso__read_binary_type_filename(
> + dso, DSO_BINARY_TYPE__DEBUGLINK,
> + machine->root_dir, debuglink, PATH_MAX);
> + if (!ret) {
> + pr_debug("%s: dso: %s, ret: %d, debuglink: <%s>\n",
> + __func__, dso->short_name, ret, debuglink);
> +
> + fd = open(debuglink, O_RDONLY);
> + if (fd >= 0) {
> + ofs = elf_section_offset(fd, ".debug_frame");
> + close(fd);
should you also set following?
*offset = ofs
dso->debug_frame_offset = ofs;
I guess if we found the debuglink section with file having .debug_frame
section, we want to use it for this dso from now on..
I'd think let's have read_unwind_spec_debug_frame to find .debug_frame
and provide that info under dso object for subsequent reads
> +
> + if (ofs) {
> + *symfile = debuglink;
> + return 0;
> + }
> + }
> + }
> +
> return -EINVAL;
> }
> #endif
> @@ -343,6 +367,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
> unw_dyn_info_t di;
> u64 table_data, segbase, fde_count;
> int ret = -EINVAL;
> + char *symfile = NULL;
>
> map = find_map(ip, ui);
> if (!map || !map->dso)
> @@ -368,16 +393,19 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
> #ifndef NO_LIBUNWIND_DEBUG_FRAME
> /* Check the .debug_frame section for unwinding info */
> if (ret < 0 &&
> - !read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) {
> + !read_unwind_spec_debug_frame(
> + map->dso, ui->machine, &segbase, &symfile)) {
> int fd = dso__data_get_fd(map->dso, ui->machine);
> int is_exec = elf_is_exec(fd, map->dso->name);
> unw_word_t base = is_exec ? 0 : map->start;
> - const char *symfile;
>
> if (fd >= 0)
> dso__data_put_fd(map->dso);
>
> - symfile = map->dso->symsrc_filename ?: map->dso->name;
> + if (!symfile)
> + symfile = map->dso->symsrc_filename ?: map->dso->name;
so in case we find debuglink-ed file, it has precedence over the file
we found symtab in? assuming thats what dso->symsrc_filename is..
thanks,
jirka
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH RFC RESEND] Perf: lookup dwarf unwind stack info in debug file pointed by .gnu_debuglink Jiri Olsa <jolsa@redhat.com> - 2016-08-22 17:20 +0200
Re: [PATCH RFC RESEND] Perf: lookup dwarf unwind stack info in debug file pointed by .gnu_debuglink Jiri Olsa <jolsa@redhat.com> - 2016-08-23 13:30 +0200
Re: [PATCH RFC RESEND] Perf: lookup dwarf unwind stack info in debug file pointed by .gnu_debuglink Jiri Olsa <jolsa@redhat.com> - 2016-08-24 09:40 +0200
csiph-web