public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Aaron Merey <amerey@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: Aaron Merey via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 7/7] gdb/debuginfod: Add .debug_line downloading
Date: Wed, 8 Mar 2023 19:26:22 -0500	[thread overview]
Message-ID: <CAJDtP-Sway7RbbXvGgQ8TX4Ud=d+iAWC5HuLfb-tLnAmYUwYMg@mail.gmail.com> (raw)
In-Reply-To: <87ilfcqoxn.fsf@tromey.com>

On Tue, Mar 7, 2023 at 3:36 PM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Aaron" == Aaron Merey via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Aaron> This patch adds functions read_formatted_entries_separate and
> Aaron> dwarf_decode_line_header_separate.  They are similar to
> Aaron> read_formatted_entries and dwarf_decode_line_header except that they are
> Aaron> able to work with .debug_line sections originating from separately
> Aaron> downloaded files.
>
> I think there has to be some other refactoring to avoid duplicating code
> in this patch.  Copying ~300 lines like that seems bad, especially
> considering they'll need parallel updates whenever we find bugs, when
> DWARF changes, etc.

Will do.

>
> Aaron> +  gdb::unique_xmalloc_ptr<char> line_path;
> Aaron> +  scoped_fd line_fd = debuginfod_section_query (build_id->data,
> Aaron> +                                                build_id->size,
> Aaron> +                                                bfd_get_filename
> Aaron> +                                                  (objfile->obfd.get ()),
> Aaron> +                                                ".debug_line",
> Aaron> +                                                &line_path);
>
> For gdb's purposes, it's a shame debuginfod works explicitly on sections
> and not as more of a locally-caching filesystem-like API.  With the
> latter we would perhaps have very little or nothing to do to make this
> work, provided we were careful to keep the gdb-index code lazy about
> reading sections.  Also, inside gdb, all the sharing across inferiors
> and such would automatically work.  The cost would be whatever BFD
> requests when identifying a file, not sure how much data that is.

That's an interesting idea.  Though I wonder if the extra latency from
possibly many more small, frequent transfers outweighs the benefits
over downloading just .gdb_index and maybe .debug_line and the
full debuginfo.

>
> Anyway, back to current reality -- the DWARF reader already does try to
> lazily map section data.  So I think one big question is, why can't this
> be the mechanism for all the sections with debuginfod?  That is, stick
> the debuginfod calls into dwarf2_section_info::read.  I don't know what
> the debuginfod client does under the hood, but if it doesn't cache this
> data somewhere, perhaps gdb could.

Debuginfod does cache sections.  But before the full debuginfo is downloaded
gdb only knows about sections present in the solib binary.  This won't
include any .debug_* sections (otherwise gdb wouldn't be using debuginfod
here).  I think to make this work debuginfod would have to provide the
section header table too?

Since .debug_info is so connected to the other .debug_* sections do we
have much to gain by downloading sections separately once we know we'll
need the .debug_info?  At that point we might as well just download the
whole file.

Thanks for reviewing these patches.

Aaron


  reply	other threads:[~2023-03-09  0:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 19:42 [PATCH 1/7] gdb/debuginfod: Add debuginfod_section_query Aaron Merey
2023-02-27 19:42 ` [PATCH 2/7] gdb: add 'lazy' setting for command 'set debuginfod enabled' Aaron Merey
2023-02-27 19:54   ` Eli Zaretskii
2023-05-24  9:31   ` Andrew Burgess
2023-02-27 19:42 ` [PATCH 3/7] gdb/debuginfod: disable pagination during downloads Aaron Merey
2023-03-03 21:33   ` Tom Tromey
2023-03-06 23:07     ` Aaron Merey
2023-05-24  9:38   ` Andrew Burgess
2023-05-24 18:57     ` Aaron Merey
2023-02-27 19:42 ` [PATCH 4/7] gdb/ui-file: Add newline tracking Aaron Merey
2023-03-07 19:33   ` Tom Tromey
2023-03-07 20:30     ` Aaron Merey
2023-03-07 20:47       ` Tom Tromey
2023-02-27 19:42 ` [PATCH 5/7] gdb/debuginfod: Support on-demand debuginfo downloading Aaron Merey
2023-03-07 20:20   ` Tom Tromey
2023-03-09  0:22     ` Aaron Merey
2023-02-27 19:42 ` [PATCH 6/7] gdb/testsuite/gdb.debuginfod: Add lazy downloading tests Aaron Merey
2023-05-02 15:48   ` Andrew Burgess
2023-05-02 16:24     ` Aaron Merey
2023-05-24 10:12   ` Andrew Burgess
2023-02-27 19:42 ` [PATCH 7/7] gdb/debuginfod: Add .debug_line downloading Aaron Merey
2023-03-07 20:36   ` Tom Tromey
2023-03-09  0:26     ` Aaron Merey [this message]
2023-02-28 11:11 ` [PATCH 1/7] gdb/debuginfod: Add debuginfod_section_query Alexandra Petlanova Hajkova
2023-05-24  9:01 ` Andrew Burgess

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='CAJDtP-Sway7RbbXvGgQ8TX4Ud=d+iAWC5HuLfb-tLnAmYUwYMg@mail.gmail.com' \
    --to=amerey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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).