public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "tromey at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/23504] index cache: Produce and consume DWARF5 format
Date: Sun, 28 Mar 2021 16:15:25 +0000	[thread overview]
Message-ID: <bug-23504-4717-MaWjO80yOr@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-23504-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=23504

--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Mark Wielaard from comment #5)

> It is clear, I just don't know enough about the index cache to understand
> which design makes most sense. It seems for strings you need some way to
> tell which section they came from, either .debug_string [ ... ]

The issue is that .debug_names can only reference strings from .debug_str.
Quoting from DWARF 5:

  The string offsets in the first array refer to names in the .debug_str (or
.debug_str.dwo ) section.

So, if gdb tries to create a new index, and it needs a string that isn't in
.debug_str for some reason, then it must have a way to add a string to that
section.

Now, currently this happens a lot, because gdb puts the wrong names into the
index.
However, it's possible for this to happen even when gdb is changed to work
correctly,
because nothing guarantees that some DIE's name attribute will be in
.debug_str.

> These could be addressed using the length of the main .debug_str
> as a base, to make it easy to tell which section to consult.

It turns out gdb already does this.  Which Simon mentioned originally and
I somehow neglected to read and/or understand.

So I think what should probably happen is:

* Change the DWARF 5 index writer to use BFD to create a new file
  that has .debug_names and .debug_str (and maybe .debug_aranges) sections;
* Write only the newly-needed strings to .debug_str (what gdb already does,
essentially);
* Change the index cache reader to know to use the extended .debug_str when
  necessary

I think this would make DWARF 5 index cache management work the same as
.gdb_index.
It would require some tweaks to gdb-add-index and to the manual.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-03-28 16:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
2020-11-12 15:49 ` tromey at sourceware dot org
2021-02-21 22:33 ` tromey at sourceware dot org
2021-02-21 22:48 ` mark at klomp dot org
2021-02-22  2:27 ` tromey at sourceware dot org
2021-02-22  2:36 ` tromey at sourceware dot org
2021-02-24 14:22 ` mark at klomp dot org
2021-03-28 16:15 ` tromey at sourceware dot org [this message]
2021-03-28 19:41 ` tromey at sourceware dot org
2021-03-29 15:51 ` tromey at sourceware dot org
2022-04-22 18:36 ` tromey at sourceware dot org
2022-09-20 22:41 ` tromey at sourceware dot org
2023-12-10 15:17 ` tromey at sourceware dot org
2023-12-10 15:31 ` tromey at sourceware dot org
2023-12-10 15:51 ` tromey at sourceware dot org
2024-01-18 20:38 ` tromey at sourceware dot org
2024-02-09 20:04 ` tromey at sourceware dot org

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=bug-23504-4717-MaWjO80yOr@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).