This is an archive of the discontinued LLVM Phabricator instance.

[lldb/DWARF] Don't index dwp file multiple times
ClosedPublic

Authored by labath on Feb 21 2020, 7:19 AM.

Details

Summary

When we added support for type units in dwo files, we changed the
"manual" dwarf index to index _all_ dwarf units in the dwo file instead
of just the split unit belonging to our skeleton unit. This was fine for
dwo files, as they contain only a single compile units and type units do
not have a split type unit which would point to them.

However, this does not work for dwp files because, these files do
contain multiple split compile units, and the current approach means
that each unit gets indexed multiple times (once for each split unit =>
n^2 complexity).

This patch teaches the manual dwarf index to treat dwp files specially.
Any type units in the dwp file added to the main list of compile units
and indexed with them in a single batch. Split compile units in dwp
files are still indexed as a part of their skeleton unit -- this is done
because we need the DW_AT_language attribute from the skeleton unit to
index them properly.

Handling of dwo files remains unchanged -- all units (type and skeleton)
are indexed when we reach the dwo file through the split unit.

Diff Detail

Event Timeline

labath created this revision.Feb 21 2020, 7:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2020, 7:19 AM
Herald added a subscriber: arphaman. · View Herald Transcript
JDevlieghere accepted this revision.Feb 21 2020, 4:36 PM

Seems straightforward.

lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
65–66

This seems inverted?

This revision is now accepted and ready to land.Feb 21 2020, 4:36 PM
clayborg accepted this revision.Feb 21 2020, 4:56 PM
This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
labath added inline comments.Feb 24 2020, 12:08 AM
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
65–66

Actually, it is correct, although somewhat confusing -- the member is set to nullptr once we finished indexing. I think I can rephrase that comment to be a bit clearer..

JDevlieghere added inline comments.Feb 24 2020, 9:42 AM
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
65–66

I see, thanks. I think that would help.