This is an archive of the discontinued LLVM Phabricator instance.

Make DWARFContext dwo-aware and port debug_info sections over
ClosedPublic

Authored by labath on May 16 2019, 8:09 AM.

Details

Summary

The previous attempt and moving section handling over to DWARFContext
(D59611) failed because it did not take into account the dwo sections
correctly. All DWARFContexts (even those in SymbolFileDWARFDwo) used the
main module for loading the sections, but in the dwo scenario some
sections should come from the dwo file.

This patch fixes that by making the DWARFContext aware of whether it a
dwo context or a regular one. A dwo context gets two sections lists, and
it knows where to look for a particular type of a section. This isn't
fully consistent with how the llvm DWARFContext behaves, because that
one leaves it up to the user to know whether it should ask for a dwo
section or not. However, for the time being, it seems useful to have a
single entity which knows how to peice together the debug info in dwo
and non-dwo scenarios. The rough roadmap for the future is:

  • port over the rest of the sections to DWARFContext
  • find a way to get rid of SymbolFileDWARFDwo/Dwp/DwpDwo. This will likely involve adding the ability for the DWARFContext to spawn dwo sub-contexts, similarly to how it's done in llvm.
  • get rid of the special handling of the "dwo" contexts by making sure everything knows whether it should ask for the .dwo version of the section or not (similarly to how llvm's DWARFUnits do that)

To demonstrate how the DWARFContext should behave in this new world, I
port the debug_info section (which is debug_info.dwo in the dwo file)
handling to DWARFContext. The rest of the sections will come in
subsequent patches.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.May 16 2019, 8:09 AM
aprantl accepted this revision.May 16 2019, 3:51 PM
This revision is now accepted and ready to land.May 16 2019, 3:51 PM
JDevlieghere added inline comments.May 16 2019, 5:35 PM
source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
47 ↗(On Diff #199833)

After the early return we can remove the else.

labath marked 2 inline comments as done.May 17 2019, 1:22 AM
labath added inline comments.
source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
47 ↗(On Diff #199833)

done.

This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptMay 17 2019, 1:27 AM