[PATCH v2 00/32] Rewrite the DWARF "partial" reader

Tom Tromey tom@tromey.com
Wed Nov 10 19:56:00 GMT 2021


Simon> What I think I understand is that with the new indexer, we gather
Simon> essentially the same information that we gather today with partial
Simon> symbols (just the information needed for doing lookups and expanding
Simon> symtabs), but store it in a data structure that is better designed,
Simon> letting us do more in parallel.  Does that sounds right?  If not, can
Simon> you explain what's the main difference?

Yeah, the biggest gains are due to parallelism.  The single largest
user-visible change comes from pushing the necessary post-processing
into a background thread.

However there are various smaller gains in the series as well:

* Abbrevs are analyzed statically, so we can skip many more DIEs without
  examining their contents.
* The partial DIE cache is eliminated.
* Name canonicalization is done just on the name in the DIE,
  rather than constructing a full name and then canonicalizing the
  entire thing.
* The abbrev cache may also speed up DWARF scanning in some scenarios.

Simon> What sounds nice with partial symtabs is that they are re-used by
Simon> different debug formats, so each format doesn't need to implement its
Simon> own data structures to manage symtab lookups and expansion.

True, but this is also a drawback, because psymtabs weren't really
designed for DWARF.  I tried many times to speed up the existing reader,
and couldn't make it work...

Also, another way to look at this is that the new approach shares more
code with the existing DWARF index readers.  It also provides the
possibility of making the .debug_names writer work correctly (currently
it is far from what the standard requires).

Simon> How much is
Simon> that new DWARF indexer really DWARF-specific (the part that parses the
Simon> DWARF obviously is, but the part that holds names and stuff)?  Could it
Simon> one day be used by other debug formats?

Not readily, because AFAIK the other debug formats aren't hierarchical
in nature.  Except for Ada (which as always works in its own way), the
new reader uses the hierarchical nature of DWARF to simplify the
resulting data structure.  (For Ada, this same thing is done, but in a
post-processing step.)

Tom


More information about the Gdb-patches mailing list