public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [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
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2020-11-12 15:49 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
I think gdb generates the DWARF 5 index incorrectly -- it fills in
the full (and canonicalized) names of symbols.  See PR 24820.

Anyway, if that is fixed, then I think the separate .debug_str problem
will go away -- because, IIUC, the index will only refer to strings
that are already present in the existing string section.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
  2020-11-12 15:49 ` [Bug gdb/23504] index cache: Produce and consume DWARF5 format 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
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2021-02-21 22:33 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Tom Tromey from comment #1)

> Anyway, if that is fixed, then I think the separate .debug_str problem
> will go away -- because, IIUC, the index will only refer to strings
> that are already present in the existing string section.

This is unfortunately mistaken.  If the .debug_info uses an inline
string, then it won't appear in .debug_str.

Maybe we can hack around this somehow.
One idea would be to collect these strings (they should be rare,
I'd imagine) and have a supplementary .debug_str in the index file.
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.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
  2020-11-12 15:49 ` [Bug gdb/23504] index cache: Produce and consume DWARF5 format 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
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: mark at klomp dot org @ 2021-02-21 22:48 UTC (permalink / raw)
  To: gdb-prs

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Tom Tromey from comment #2)
> (In reply to Tom Tromey from comment #1)
> 
> > Anyway, if that is fixed, then I think the separate .debug_str problem
> > will go away -- because, IIUC, the index will only refer to strings
> > that are already present in the existing string section.
> 
> This is unfortunately mistaken.  If the .debug_info uses an inline
> string, then it won't appear in .debug_str.

I might be missing some context why the string representation is important. But
if it is, then note that besides DW_FORM_strp, DW_FORM_string and
DW_FORM_strx[1234] (which will indirectly end up in .debug_str), there is also
DW_FORM_line_strp (which points to .debug_line_str) which is used for file/path
related strings (gcc 11 for example will make sure that the CU DIE name and
compdir end up there).

And of course there is DW_FORM_strp_sup and DW_FORM_GNU_strp_alt for shared
strings in the multi/sup file .debug_str.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  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
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2021-02-22  2:27 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
The context here is GDB generating an index and putting it into the index
cache.  .debug_names refers to symbol names using their index in .debug_str,
so if a string does not appear there, then how would GDB cope?
Currently I think it writes out a new .debug_str section, but of course
(see the other PR), what's currently done is wrong; and also this seemed
weird for the index cache, because in that scenario nobody is rewriting
the original object file.

Not sure if this is clear or not...

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  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
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2021-02-22  2:36 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |27453


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=27453
[Bug 27453] [meta] DWARF 5 support
-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: mark at klomp dot org @ 2021-02-24 14:22 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Tom Tromey from comment #4)
> The context here is GDB generating an index and putting it into the index
> cache.  .debug_names refers to symbol names using their index in .debug_str,
> so if a string does not appear there, then how would GDB cope?
> Currently I think it writes out a new .debug_str section, but of course
> (see the other PR), what's currently done is wrong; and also this seemed
> weird for the index cache, because in that scenario nobody is rewriting
> the original object file.
> 
> Not sure if this is clear or not...

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 default), .debug_info (for
DW_FORM_string, if the index already associates a DIE offset with that, maybe
just have a flag that it looks up the DW_AT_name there?) and .debug_line_str
(DW_FORM_line_str) for those symbols which have a name that also represents a
file/path (dunno how to easily represent that). And then there are the
DW_FORM_strp_sup/DW_FORM_GNU_strp_alt strings (then the .debug_strp is in
another file...).

I think the summary is that DWARF5 got a lot of ways to store a string :)

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-02-24 14:22 ` mark at klomp dot org
@ 2021-03-28 16:15 ` tromey at sourceware dot org
  2021-03-28 19:41 ` tromey at sourceware dot org
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2021-03-28 16:15 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2021-03-28 16:15 ` tromey at sourceware dot org
@ 2021-03-28 19:41 ` tromey at sourceware dot org
  2021-03-29 15:51 ` tromey at sourceware dot org
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2021-03-28 19:41 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
> * 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);

I've done this part.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (7 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2021-03-29 15:51 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #8 from Tom Tromey <tromey at sourceware dot org> ---
> It would require some tweaks to gdb-add-index and to the manual.

It occurs to me that the new single-file mode could be used by
the index cache, but the "save" command could continue to work
the current way, so that these changes aren't needed.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (8 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2022-04-22 18:36 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #9 from Tom Tromey <tromey at sourceware dot org> ---
If .debug_aranges is missing from the main file,
then the writer has to create that as well.
Otherwise, it won't work when reading the index.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (9 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2022-09-20 22:41 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #10 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Tom Tromey from comment #9)
> If .debug_aranges is missing from the main file,
> then the writer has to create that as well.
> Otherwise, it won't work when reading the index.

I tend to think now that this should be a separate bug.
It is pre-existing after all.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (10 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2023-12-10 15:17 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |24820


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=24820
[Bug 24820] .debug_names has incorrect contents
-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (11 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2023-12-10 15:31 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |31132


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=31132
[Bug 31132] .debug_names writer should create .debug_aranges
-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (12 preceding siblings ...)
  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
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2023-12-10 15:51 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #11 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Tom Tromey from comment #7)
> > * 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);
> 
> I've done this part.

I lost this patch somewhere but it's not difficult to rewrite.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (13 preceding siblings ...)
  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
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2024-01-18 20:38 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=23504
Bug 23504 depends on bug 24820, which changed state.

Bug 24820 Summary: .debug_names has incorrect contents
https://sourceware.org/bugzilla/show_bug.cgi?id=24820

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug gdb/23504] index cache: Produce and consume DWARF5 format
       [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2024-01-18 20:38 ` tromey at sourceware dot org
@ 2024-02-09 20:04 ` tromey at sourceware dot org
  15 siblings, 0 replies; 16+ messages in thread
From: tromey at sourceware dot org @ 2024-02-09 20:04 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |31363


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=31363
[Bug 31363] Remove support for .gdb_index
-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-02-09 20:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-23504-4717@http.sourceware.org/bugzilla/>
2020-11-12 15:49 ` [Bug gdb/23504] index cache: Produce and consume DWARF5 format 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
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

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).