This is an archive of the discontinued LLVM Phabricator instance.

DWARF: Add support for type units+split dwarf combo
ClosedPublic

Authored by labath on Jun 21 2019, 4:24 AM.

Details

Summary

With the last round of refactors, supporting type units in dwo files
becomes almost trivial. This patch contains a couple of small fixes,
which taken as a whole make type units work in the split dwarf scenario
(both DWARF4 and DWARF5):

  • DWARFContext: make sure we actually read the debug_types.dwo section
  • DWARFUnit: set string offsets base on all units in the dwo file, not just the main CU
  • ManualDWARFIndex: index all units in the file
  • SymbolFileDWARFDwo: Search for the single compile unit in the file, as we can no longer assume it will be the first one

The last part makes it obvious that there is still some work to be done
here, namely that we do not support dwo files with multiple compile
units. That is something that should be easier after the DIERef
refactors, but it still requires more work.

Tests are added for the type units+split dwarf + dwarf4/5 scenarios, as
well as a test that checks we behave reasonably in the presence of dwo
files with multiple CUs.

Event Timeline

labath created this revision.Jun 21 2019, 4:24 AM
JDevlieghere added inline comments.Jun 21 2019, 2:24 PM
source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
77

Is this here to ensure that there's no two candidates? Initially I was pretty confused by this, I think it's worth a comment.

labath marked 2 inline comments as done.Jun 24 2019, 2:04 AM
labath added inline comments.
source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
77

Yes, that's it. If you know of a nicer way to implement that search, I'd like to hear it. For now, I've just put some comments around this.

labath updated this revision to Diff 206168.Jun 24 2019, 2:04 AM
labath marked an inline comment as done.

Add some comments in SymbolFileDWARFDwo::ComputeCompileUnit

clayborg accepted this revision.Jun 24 2019, 8:33 AM
This revision is now accepted and ready to land.Jun 24 2019, 8:33 AM
JDevlieghere accepted this revision.Jun 24 2019, 12:32 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 25 2019, 12:01 AM