diff options
author | Pavel Labath <pavel@labath.sk> | 2019-12-23 16:31:36 +0100 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2020-01-14 15:19:29 +0100 |
commit | 4b5bc38802dcc7d2c6d7f5af1eca1755bd0fd9cb (patch) | |
tree | eebb48f4226cdb36d524868ae534c408780b1f78 /lldb/source | |
parent | e1f524ea43f920767259c47e201405091d7e76fd (diff) | |
download | bcm5719-llvm-4b5bc38802dcc7d2c6d7f5af1eca1755bd0fd9cb.tar.gz bcm5719-llvm-4b5bc38802dcc7d2c6d7f5af1eca1755bd0fd9cb.zip |
[lldb/DWARF] Move location list sections into DWARFContext
These are the last sections not managed by the DWARFContext object. I
also introduce separate SectionType enums for dwo section variants, as
this is necessary for proper handling of single-file split dwarf.
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Core/Section.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp | 11 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h | 4 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp | 13 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 9 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h | 3 | ||||
-rw-r--r-- | lldb/source/Symbol/ObjectFile.cpp | 2 |
9 files changed, 35 insertions, 19 deletions
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index b1d7eee108b..1697f1f7a5d 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -80,8 +80,12 @@ const char *Section::GetTypeAsCString() const { return "dwarf-line-str"; case eSectionTypeDWARFDebugLoc: return "dwarf-loc"; + case eSectionTypeDWARFDebugLocDwo: + return "dwarf-loc-dwo"; case eSectionTypeDWARFDebugLocLists: return "dwarf-loclists"; + case eSectionTypeDWARFDebugLocListsDwo: + return "dwarf-loclists-dwo"; case eSectionTypeDWARFDebugMacInfo: return "dwarf-macinfo"; case eSectionTypeDWARFDebugMacro: diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 893d294c0fa..8b62afa18cd 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1572,8 +1572,10 @@ static SectionType GetSectionTypeFromName(llvm::StringRef Name) { .Case("info.dwo", eSectionTypeDWARFDebugInfoDwo) .Cases("line", "line.dwo", eSectionTypeDWARFDebugLine) .Cases("line_str", "line_str.dwo", eSectionTypeDWARFDebugLineStr) - .Cases("loc", "loc.dwo", eSectionTypeDWARFDebugLoc) - .Cases("loclists", "loclists.dwo", eSectionTypeDWARFDebugLocLists) + .Case("loc", eSectionTypeDWARFDebugLoc) + .Case("loc.dwo", eSectionTypeDWARFDebugLocDwo) + .Case("loclists", eSectionTypeDWARFDebugLocLists) + .Case("loclists.dwo", eSectionTypeDWARFDebugLocListsDwo) .Case("macinfo", eSectionTypeDWARFDebugMacInfo) .Cases("macro", "macro.dwo", eSectionTypeDWARFDebugMacro) .Case("names", eSectionTypeDWARFDebugNames) diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index e730aafbd3e..3f9b68aad89 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1133,7 +1133,9 @@ AddressClass ObjectFileMachO::GetAddressClass(lldb::addr_t file_addr) { case eSectionTypeDWARFDebugLine: case eSectionTypeDWARFDebugLineStr: case eSectionTypeDWARFDebugLoc: + case eSectionTypeDWARFDebugLocDwo: case eSectionTypeDWARFDebugLocLists: + case eSectionTypeDWARFDebugLocListsDwo: case eSectionTypeDWARFDebugMacInfo: case eSectionTypeDWARFDebugMacro: case eSectionTypeDWARFDebugNames: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp index db8d7b3747e..5052b825fea 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp @@ -70,6 +70,17 @@ const DWARFDataExtractor &DWARFContext::getOrLoadLineStrData() { m_data_debug_line_str); } +const DWARFDataExtractor &DWARFContext::getOrLoadLocData() { + return LoadOrGetSection(eSectionTypeDWARFDebugLoc, + eSectionTypeDWARFDebugLocDwo, m_data_debug_loc); +} + +const DWARFDataExtractor &DWARFContext::getOrLoadLocListsData() { + return LoadOrGetSection(eSectionTypeDWARFDebugLocLists, + eSectionTypeDWARFDebugLocListsDwo, + m_data_debug_loclists); +} + const DWARFDataExtractor &DWARFContext::getOrLoadMacroData() { return LoadOrGetSection(eSectionTypeDWARFDebugMacro, llvm::None, m_data_debug_macro); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h index 24baac90aa4..8691001b1b7 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h @@ -34,6 +34,8 @@ private: SectionData m_data_debug_info; SectionData m_data_debug_line; SectionData m_data_debug_line_str; + SectionData m_data_debug_loc; + SectionData m_data_debug_loclists; SectionData m_data_debug_macro; SectionData m_data_debug_ranges; SectionData m_data_debug_rnglists; @@ -58,6 +60,8 @@ public: const DWARFDataExtractor &getOrLoadDebugInfoData(); const DWARFDataExtractor &getOrLoadLineData(); const DWARFDataExtractor &getOrLoadLineStrData(); + const DWARFDataExtractor &getOrLoadLocData(); + const DWARFDataExtractor &getOrLoadLocListsData(); const DWARFDataExtractor &getOrLoadMacroData(); const DWARFDataExtractor &getOrLoadRangesData(); const DWARFDataExtractor &getOrLoadRngListsData(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index 142de7fb0eb..22e3e40dac9 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -380,8 +380,9 @@ void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) { .GetByteSize() > 0) dwo_cu->SetRangesBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32)); - if (GetVersion() >= 5 && - m_dwo_symbol_file->get_debug_loclists_data().GetByteSize() > 0) + if (GetVersion() >= 5 && m_dwo_symbol_file->GetDWARFContext() + .getOrLoadLocListsData() + .GetByteSize() > 0) dwo_cu->SetLoclistsBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32)); dwo_cu->SetBaseAddress(GetBaseAddress()); @@ -455,7 +456,8 @@ void DWARFUnit::SetLoclistsBase(dw_addr_t loclists_base) { m_loclist_table_header.emplace(".debug_loclists", "locations"); uint64_t offset = loclists_base - header_size; if (llvm::Error E = m_loclist_table_header->extract( - m_dwarf.get_debug_loclists_data().GetAsLLVM(), &offset)) { + m_dwarf.GetDWARFContext().getOrLoadLocListsData().GetAsLLVM(), + &offset)) { GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError( "Failed to extract location list table at offset 0x%" PRIx64 ": %s", loclists_base, toString(std::move(E)).c_str()); @@ -474,8 +476,9 @@ DWARFUnit::GetLocationTable(const DataExtractor &data) const { } const DWARFDataExtractor &DWARFUnit::GetLocationData() const { - return GetVersion() >= 5 ? GetSymbolFileDWARF().get_debug_loclists_data() - : GetSymbolFileDWARF().get_debug_loc_data(); + DWARFContext &Ctx = GetSymbolFileDWARF().GetDWARFContext(); + return GetVersion() >= 5 ? Ctx.getOrLoadLocListsData() + : Ctx.getOrLoadLocData(); } void DWARFUnit::SetRangesBase(dw_addr_t ranges_base) { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 533af5f4e83..d45a8b56efe 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -597,15 +597,6 @@ void SymbolFileDWARF::LoadSectionData(lldb::SectionType sect_type, m_objfile_sp->ReadSectionData(section_sp.get(), data); } -const DWARFDataExtractor &SymbolFileDWARF::get_debug_loc_data() { - return GetCachedSectionData(eSectionTypeDWARFDebugLoc, m_data_debug_loc); -} - -const DWARFDataExtractor &SymbolFileDWARF::get_debug_loclists_data() { - return GetCachedSectionData(eSectionTypeDWARFDebugLocLists, - m_data_debug_loclists); -} - DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() { if (m_abbr) return m_abbr.get(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index f816dd77800..23e26732453 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -222,9 +222,6 @@ public: uint32_t GetPluginVersion() override; - const lldb_private::DWARFDataExtractor &get_debug_loc_data(); - const lldb_private::DWARFDataExtractor &get_debug_loclists_data(); - DWARFDebugAbbrev *DebugAbbrev(); const DWARFDebugAbbrev *DebugAbbrev() const; diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index 4f6d74bbc75..8a72b5fe6f6 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -352,7 +352,9 @@ AddressClass ObjectFile::GetAddressClass(addr_t file_addr) { case eSectionTypeDWARFDebugLine: case eSectionTypeDWARFDebugLineStr: case eSectionTypeDWARFDebugLoc: + case eSectionTypeDWARFDebugLocDwo: case eSectionTypeDWARFDebugLocLists: + case eSectionTypeDWARFDebugLocListsDwo: case eSectionTypeDWARFDebugMacInfo: case eSectionTypeDWARFDebugMacro: case eSectionTypeDWARFDebugNames: |