From: Jiri Olsa <jolsa@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: "Frank Ch. Eigler" <fche@redhat.com>,
Mark Wielaard <mjw@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Milian Wolff <milian.wolff@kdab.com>,
John Levon <levon@movementarian.org>,
Namhyung Kim <namhyung@kernel.org>,
linux-perf-users@vger.kernel.org
Subject: Re: libdw dwarf unwind issue
Date: Wed, 2 Dec 2020 11:56:04 +0100 [thread overview]
Message-ID: <20201202105604.GA3433097@krava> (raw)
In-Reply-To: <20201202100646.GA1731774@host1.jankratochvil.net>
On Wed, Dec 02, 2020 at 11:06:46AM +0100, Jan Kratochvil wrote:
> On Tue, 01 Dec 2020 20:41:16 +0100, Jiri Olsa wrote:
> > the fix is working for me, would you mind send full patch?
> > or just provide me with changelog and I can do it for you
>
> I am not proficient with all the meta-tags there, I make no copyright claims
> to this patch.
>
>
> Regards,
> Jan
> perf libdw: Fix separte debug info files
>
> elfutils needs to be provided main binary and separate debug info file
> respectively. Providing separate debug info file instead of the main binary is
> not sufficient.
>
> One needs to try both supplied filename and its possible cache by its build-id
> depending on the use case.
it's great, I'll just add your's SOB if that's ok:
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
thanks,
jirka
>
> diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
> index 7a3dbc259cec..0ada907c60d4 100644
> --- a/tools/perf/util/unwind-libdw.c
> +++ b/tools/perf/util/unwind-libdw.c
> @@ -20,10 +20,24 @@
>
> static char *debuginfo_path;
>
> +static int __find_debuginfo(Dwfl_Module *mod __maybe_unused, void **userdata,
> + const char *modname __maybe_unused, Dwarf_Addr base __maybe_unused,
> + const char *file_name, const char *debuglink_file __maybe_unused,
> + GElf_Word debuglink_crc __maybe_unused, char **debuginfo_file_name)
> +{
> + const struct dso *dso = *userdata;
> +
> + assert(dso);
> + if (dso->symsrc_filename && strcmp (file_name, dso->symsrc_filename))
> + *debuginfo_file_name = strdup(dso->symsrc_filename);
> + return -1;
> +}
> +
> static const Dwfl_Callbacks offline_callbacks = {
> - .find_debuginfo = dwfl_standard_find_debuginfo,
> + .find_debuginfo = __find_debuginfo,
> .debuginfo_path = &debuginfo_path,
> .section_address = dwfl_offline_section_address,
> + // .find_elf is not set as we use dwfl_report_elf() instead.
> };
>
> static int __report_module(struct addr_location *al, u64 ip,
> @@ -46,16 +60,24 @@ static int __report_module(struct addr_location *al, u64 ip,
> mod = dwfl_addrmodule(ui->dwfl, ip);
> if (mod) {
> Dwarf_Addr s;
> + void **userdatap;
>
> - dwfl_module_info(mod, NULL, &s, NULL, NULL, NULL, NULL, NULL);
> + dwfl_module_info(mod, &userdatap, &s, NULL, NULL, NULL, NULL, NULL);
> + *userdatap = dso;
> if (s != al->map->start - al->map->pgoff)
> mod = 0;
> }
>
> if (!mod)
> - mod = dwfl_report_elf(ui->dwfl, dso->short_name,
> - (dso->symsrc_filename ? dso->symsrc_filename : dso->long_name), -1, al->map->start - al->map->pgoff,
> - false);
> + mod = dwfl_report_elf(ui->dwfl, dso->short_name, dso->long_name, -1,
> + al->map->start - al->map->pgoff, false);
> + if (!mod) {
> + char filename[PATH_MAX];
> +
> + if (dso__build_id_filename(dso, filename, sizeof(filename), false))
> + mod = dwfl_report_elf(ui->dwfl, dso->short_name, filename, -1,
> + al->map->start - al->map->pgoff, false);
> + }
>
> return mod && dwfl_addrmodule(ui->dwfl, ip) == mod ? 0 : -1;
> }
prev parent reply other threads:[~2020-12-02 10:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20201103221709.GL3597846@krava>
2020-11-22 22:27 ` libdw dwarf unwind issue Jan Kratochvil
2020-11-23 22:12 ` Jiri Olsa
2020-11-28 4:07 ` Jan Kratochvil
2020-12-01 19:41 ` Jiri Olsa
2020-12-02 10:06 ` Jan Kratochvil
2020-12-02 10:56 ` Jiri Olsa [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201202105604.GA3433097@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=fche@redhat.com \
--cc=jan.kratochvil@redhat.com \
--cc=levon@movementarian.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=mjw@redhat.com \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).