public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Roland McGrath <mcgrathr@google.com>,
	Daniel Thornburgh <dthorn@google.com>
Cc: elfutils-devel@sourceware.org
Subject: Re: Local Build ID Directory Lookup (DEBUGINFOD_LOCAL_PATH)
Date: Wed, 14 Jun 2023 17:57:24 +0200	[thread overview]
Message-ID: <a600c48afae5040c821e3267f4d62c31d254d9c0.camel@klomp.org> (raw)
In-Reply-To: <CAB=4xhoxY=LrPVNxKpQm7kY3p8Vs0YX9GMsyYAMkj1TmJCzBJg@mail.gmail.com>

Hi Roland,

On Wed, 2023-05-31 at 16:44 -0700, Roland McGrath via Elfutils-devel
wrote:
> In elfutils, the libdwfl library is responsible for the "library for
> obtaining debug info writ large" stuff. It provides <argp.h> API parsers
> for command-line arguments that mesh with its library stuff like
> Dwfl_Callbacks that set the search path used equivalently to GDB's `set
> debug-file-directory` path. eu-* tools as well as things like systemtap use
> this to accept `--debuginfo-path=PATH`, but AFAIK none of them support
> environment variables.  In the binutils world outside of GDB itself, I
> think only objdump and readelf do .build-id/... lookup and those use common
> binutils-private code (binutils/dwarf.c) that just has a hard-coded
> directory list.  Some more uniformity here would be beneficial to everyone,
> I think.

One difference is that the elfutils and gdb traditional "search path"
mechanism is mainly based on path/file names (lookups through
.gnu_debuglink, possibly relative .debug dirs/files) while the primary
lookup method for libdebuginfod is based on build-id.

libdebuginfod kind of assumes you already know the traditional lookup
didn't work.

That is also how dwfl_standard_find_debuginfo uses libdebuginfod. It
first gets the build-id from the ELF file, looks for that in the
traditional way (/usr/lib/debug/.build-id/xx/yyyy.debug), if that fails
it does a path based search (using the file name, debuglink file name
and Dwfl_Callbacks debuginfo_path), and if that also fails then it
tries to use libdebuginfod.

Another difference is the lookup of .dwz files. Since they contain an
"artificial" build-id, libdebuginfod uses that to look them up as if a
"normal" .debug file. While the traditional lookup uses the (relative!)
path in the .gnu_debugaltlink section of the .debug file.

I wonder which parts of the "traditional" lookup are still
useful/relevant. Could we get away with pointing at a "traditional"
/usr/lib/debug/ like path that contains a .build-id and (optional) .dwz
subdir to make libdebuginfo that "uniform" debug file lookup library?

Cheers,

Mark

  reply	other threads:[~2023-06-14 15:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 22:17 Daniel Thornburgh
2023-05-31 22:35 ` Paul Smith
2023-05-31 22:35 ` Frank Ch. Eigler
2023-05-31 22:45   ` Daniel Thornburgh
2023-05-31 23:04     ` Frank Ch. Eigler
2023-06-01 14:58     ` Frank Ch. Eigler
2023-06-01 20:54       ` Daniel Thornburgh
2023-06-01 21:21         ` Frank Ch. Eigler
2023-06-01 23:51           ` Daniel Thornburgh
2023-05-31 23:44 ` Roland McGrath
2023-06-14 15:57   ` Mark Wielaard [this message]
2023-06-14 19:43     ` Roland McGrath
2023-06-19 11:53       ` Mark Wielaard

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=a600c48afae5040c821e3267f4d62c31d254d9c0.camel@klomp.org \
    --to=mark@klomp.org \
    --cc=dthorn@google.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mcgrathr@google.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).