diff options
| author | Pavel Labath <pavel@labath.sk> | 2019-05-17 08:26:58 +0000 |
|---|---|---|
| committer | Pavel Labath <pavel@labath.sk> | 2019-05-17 08:26:58 +0000 |
| commit | ff9b4263f975704f7c13983f7469adad09e2d179 (patch) | |
| tree | 12e21fbb3f8b4f9a0566d8ff6d7a43bf29d85d1f /lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp | |
| parent | eb4cbf885c1d9df229817b0ebec48412408c575e (diff) | |
| download | bcm5719-llvm-ff9b4263f975704f7c13983f7469adad09e2d179.tar.gz bcm5719-llvm-ff9b4263f975704f7c13983f7469adad09e2d179.zip | |
Make DWARFContext dwo-aware and port debug_info sections over
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.
Reviewers: aprantl, clayborg, JDevlieghere
Subscribers: zturner, lldb-commits
Differential Revision: https://reviews.llvm.org/D62012
llvm-svn: 361000
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp index aba2979383d..425d6e296d6 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp @@ -13,9 +13,8 @@ using namespace lldb; using namespace lldb_private; -static DWARFDataExtractor LoadSection(Module &module, +static DWARFDataExtractor LoadSection(SectionList *section_list, SectionType section_type) { - SectionList *section_list = module.GetSectionList(); if (!section_list) return DWARFDataExtractor(); @@ -29,16 +28,22 @@ static DWARFDataExtractor LoadSection(Module &module, } static const DWARFDataExtractor & -LoadOrGetSection(Module &module, SectionType section_type, +LoadOrGetSection(SectionList *section_list, SectionType section_type, llvm::Optional<DWARFDataExtractor> &extractor) { if (!extractor) - extractor = LoadSection(module, section_type); + extractor = LoadSection(section_list, section_type); return *extractor; } -DWARFContext::DWARFContext(Module &module) : m_module(module) {} - const DWARFDataExtractor &DWARFContext::getOrLoadArangesData() { - return LoadOrGetSection(m_module, eSectionTypeDWARFDebugAranges, + return LoadOrGetSection(m_main_section_list, eSectionTypeDWARFDebugAranges, m_data_debug_aranges); } + +const DWARFDataExtractor &DWARFContext::getOrLoadDebugInfoData() { + if (isDwo()) + return LoadOrGetSection(m_dwo_section_list, eSectionTypeDWARFDebugInfoDwo, + m_data_debug_info); + return LoadOrGetSection(m_main_section_list, eSectionTypeDWARFDebugInfo, + m_data_debug_info); +} |

