[RFC] Improve Dwarf 5 .debug_names Type Lookup/Parsing Speed

ambiguity between an entry that has been emitted without any parent data, and an entry that has no parent/is at the root of the DIE tree?

IIUC we should never have a DIE that is at the root of the tree, since TAG_compile_unit and TAG_type_unit don’t fall under the description of:

The name index must contain an entry for each debugging information entry that
defines a named subprogram, label, variable, type, or namespace:

Even if root DIEs did show up, I think the important point is to not be ambiguous about:

  • Is this parentless because it has no indexed parent? (this includes the root DIE case, as well as top level functions, types, namespaces, etc)
  • Is this parentless because the table does not index parents?

We need to answer that question in order to know whether we can do a fast search or a slow search.

In the prototype implementation, I assumed that if a table has any IDX_parent in some abbreviation table, then the entire table was created with fully populated parents. Under this assumption, we would be able to consider entries that have no IDX_parent as entries whose parents are not indexed.

If we cannot make this assumption (e.g. because of a linker combining different kinds of accelerator tables), my suggestion to save data is to use a different kind of abbreviation entry for parentless nodes, i.e., something like {dwarf::DW_IDX_parent, dwarf::DW_FORM_flag_present}. This would mean: “the parent information is present but inexistent, i.e., this doesn’t have an indexed parent”, and it would cost zero bytes per entry.