Author: tberghammer Date: Fri Aug 25 06:56:14 2017 New Revision: 311775 URL: http://llvm.org/viewvc/llvm-project?rev=311775&view=rev Log: Add support for the DWP debug info format
Summary: The DWP (DWARF package) format is used to pack multiple dwo files generated by split-dwarf into a single ELF file to make distributing them easier. It is part of the DWARFv5 spec and can be generated by dwp or llvm-dwp from a set of dwo files. Caviats: * Only the new version of the dwp format is supported (v2 in GNU numbering schema and v5 in the DWARF spec). The old version (v1) is already deprecated but binutils 2.24 still generates that one. * Combining DWP files with module debugging is not yet supported. Subscribers: emaste, mgorny, aprantl Differential Revision: https://reviews.llvm.org/D36062 Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h Modified: lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/source/Core/Section.cpp lldb/trunk/source/Expression/IRExecutionUnit.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp lldb/trunk/source/Symbol/ObjectFile.cpp Modified: lldb/trunk/include/lldb/lldb-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=311775&r1=311774&r2=311775&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-enumerations.h Fri Aug 25 06:56:14 2017 @@ -628,6 +628,7 @@ enum SectionType { eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr, eSectionTypeDWARFDebugAranges, + eSectionTypeDWARFDebugCuIndex, eSectionTypeDWARFDebugFrame, eSectionTypeDWARFDebugInfo, eSectionTypeDWARFDebugLine, Modified: lldb/trunk/source/Core/Section.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Section.cpp?rev=311775&r1=311774&r2=311775&view=diff ============================================================================== --- lldb/trunk/source/Core/Section.cpp (original) +++ lldb/trunk/source/Core/Section.cpp Fri Aug 25 06:56:14 2017 @@ -65,6 +65,8 @@ static const char *GetSectionTypeAsCStri return "dwarf-addr"; case eSectionTypeDWARFDebugAranges: return "dwarf-aranges"; + case eSectionTypeDWARFDebugCuIndex: + return "dwarf-cu-index"; case eSectionTypeDWARFDebugFrame: return "dwarf-frame"; case eSectionTypeDWARFDebugInfo: Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=311775&r1=311774&r2=311775&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original) +++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Fri Aug 25 06:56:14 2017 @@ -1110,6 +1110,7 @@ bool IRExecutionUnit::CommitOneAllocatio case lldb::eSectionTypeDWARFDebugAbbrev: case lldb::eSectionTypeDWARFDebugAddr: case lldb::eSectionTypeDWARFDebugAranges: + case lldb::eSectionTypeDWARFDebugCuIndex: case lldb::eSectionTypeDWARFDebugFrame: case lldb::eSectionTypeDWARFDebugInfo: case lldb::eSectionTypeDWARFDebugLine: Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=311775&r1=311774&r2=311775&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Fri Aug 25 06:56:14 2017 @@ -1835,6 +1835,7 @@ void ObjectFileELF::CreateSections(Secti static ConstString g_sect_name_dwarf_debug_abbrev(".debug_abbrev"); static ConstString g_sect_name_dwarf_debug_addr(".debug_addr"); static ConstString g_sect_name_dwarf_debug_aranges(".debug_aranges"); + static ConstString g_sect_name_dwarf_debug_cu_index(".debug_cu_index"); static ConstString g_sect_name_dwarf_debug_frame(".debug_frame"); static ConstString g_sect_name_dwarf_debug_info(".debug_info"); static ConstString g_sect_name_dwarf_debug_line(".debug_line"); @@ -1904,6 +1905,8 @@ void ObjectFileELF::CreateSections(Secti sect_type = eSectionTypeDWARFDebugAddr; else if (name == g_sect_name_dwarf_debug_aranges) sect_type = eSectionTypeDWARFDebugAranges; + else if (name == g_sect_name_dwarf_debug_cu_index) + sect_type = eSectionTypeDWARFDebugCuIndex; else if (name == g_sect_name_dwarf_debug_frame) sect_type = eSectionTypeDWARFDebugFrame; else if (name == g_sect_name_dwarf_debug_info) @@ -2017,13 +2020,14 @@ void ObjectFileELF::CreateSections(Secti if (m_sections_ap.get()) { if (GetType() == eTypeDebugInfo) { static const SectionType g_sections[] = { - eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr, - eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugFrame, - eSectionTypeDWARFDebugInfo, eSectionTypeDWARFDebugLine, - eSectionTypeDWARFDebugLoc, eSectionTypeDWARFDebugMacInfo, - eSectionTypeDWARFDebugPubNames, eSectionTypeDWARFDebugPubTypes, - eSectionTypeDWARFDebugRanges, eSectionTypeDWARFDebugStr, - eSectionTypeDWARFDebugStrOffsets, eSectionTypeELFSymbolTable, + eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr, + eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugCuIndex, + eSectionTypeDWARFDebugFrame, eSectionTypeDWARFDebugInfo, + eSectionTypeDWARFDebugLine, eSectionTypeDWARFDebugLoc, + eSectionTypeDWARFDebugMacInfo, eSectionTypeDWARFDebugPubNames, + eSectionTypeDWARFDebugPubTypes, eSectionTypeDWARFDebugRanges, + eSectionTypeDWARFDebugStr, eSectionTypeDWARFDebugStrOffsets, + eSectionTypeELFSymbolTable, }; SectionList *elf_section_list = m_sections_ap.get(); for (size_t idx = 0; idx < sizeof(g_sections) / sizeof(g_sections[0]); Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=311775&r1=311774&r2=311775&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Fri Aug 25 06:56:14 2017 @@ -1200,6 +1200,7 @@ AddressClass ObjectFileMachO::GetAddress case eSectionTypeDWARFDebugAbbrev: case eSectionTypeDWARFDebugAddr: case eSectionTypeDWARFDebugAranges: + case eSectionTypeDWARFDebugCuIndex: case eSectionTypeDWARFDebugFrame: case eSectionTypeDWARFDebugInfo: case eSectionTypeDWARFDebugLine: Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt?rev=311775&r1=311774&r2=311775&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt Fri Aug 25 06:56:14 2017 @@ -30,6 +30,8 @@ add_lldb_library(lldbPluginSymbolFileDWA NameToDIE.cpp SymbolFileDWARF.cpp SymbolFileDWARFDwo.cpp + SymbolFileDWARFDwoDwp.cpp + SymbolFileDWARFDwp.cpp SymbolFileDWARFDebugMap.cpp UniqueDWARFASTType.cpp @@ -47,5 +49,6 @@ add_lldb_library(lldbPluginSymbolFileDWA lldbPluginCPlusPlusLanguage lldbPluginExpressionParserClang LINK_COMPONENTS + DebugInfoDWARF Support ) Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=311775&r1=311774&r2=311775&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Aug 25 06:56:14 2017 @@ -71,6 +71,7 @@ #include "LogChannelDWARF.h" #include "SymbolFileDWARFDebugMap.h" #include "SymbolFileDWARFDwo.h" +#include "SymbolFileDWARFDwp.h" #include "llvm/Support/FileSystem.h" @@ -1568,6 +1569,16 @@ SymbolFileDWARF::GetDwoSymbolFileForComp if (!dwo_name) return nullptr; + SymbolFileDWARFDwp *dwp_symfile = GetDwpSymbolFile(); + if (dwp_symfile) { + uint64_t dwo_id = cu_die.GetAttributeValueAsUnsigned(this, &dwarf_cu, + DW_AT_GNU_dwo_id, 0); + std::unique_ptr<SymbolFileDWARFDwo> dwo_symfile = + dwp_symfile->GetSymbolFileForDwoId(&dwarf_cu, dwo_id); + if (dwo_symfile) + return dwo_symfile; + } + FileSpec dwo_file(dwo_name, true); if (dwo_file.IsRelative()) { const char *comp_dir = cu_die.GetAttributeValueAsString( @@ -4316,3 +4327,14 @@ DWARFExpression::LocationListFormat SymbolFileDWARF::GetLocationListFormat() const { return DWARFExpression::RegularLocationList; } + +SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() { + llvm::call_once(m_dwp_symfile_once_flag, [this]() { + FileSpec dwp_filespec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); + if (dwp_filespec.Exists()) { + m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), + dwp_filespec); + } + }); + return m_dwp_symfile.get(); +} Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=311775&r1=311774&r2=311775&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Aug 25 06:56:14 2017 @@ -61,6 +61,7 @@ class DWARFDIECollection; class DWARFFormValue; class SymbolFileDWARFDebugMap; class SymbolFileDWARFDwo; +class SymbolFileDWARFDwp; #define DIE_IS_BEING_PARSED ((lldb_private::Type *)1) @@ -464,8 +465,14 @@ protected: return m_forward_decl_clang_type_to_die; } + SymbolFileDWARFDwp *GetDwpSymbolFile(); + lldb::ModuleWP m_debug_map_module_wp; SymbolFileDWARFDebugMap *m_debug_map_symfile; + + llvm::once_flag m_dwp_symfile_once_flag; + std::unique_ptr<SymbolFileDWARFDwp> m_dwp_symfile; + lldb_private::DWARFDataExtractor m_dwarf_data; DWARFDataSegment m_data_debug_abbrev; Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp?rev=311775&view=auto ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp (added) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp Fri Aug 25 06:56:14 2017 @@ -0,0 +1,36 @@ +//===-- SymbolFileDWARFDwoDwp.cpp -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "SymbolFileDWARFDwoDwp.h" + +#include "lldb/Core/Section.h" +#include "lldb/Expression/DWARFExpression.h" +#include "lldb/Symbol/ObjectFile.h" +#include "lldb/Utility/LLDBAssert.h" + +#include "DWARFCompileUnit.h" +#include "DWARFDebugInfo.h" + +using namespace lldb; +using namespace lldb_private; + +SymbolFileDWARFDwoDwp::SymbolFileDWARFDwoDwp(SymbolFileDWARFDwp *dwp_symfile, + ObjectFileSP objfile, + DWARFCompileUnit *dwarf_cu, + uint64_t dwo_id) + : SymbolFileDWARFDwo(objfile, dwarf_cu), m_dwp_symfile(dwp_symfile), + m_dwo_id(dwo_id) {} + +void SymbolFileDWARFDwoDwp::LoadSectionData(lldb::SectionType sect_type, + DWARFDataExtractor &data) { + if (m_dwp_symfile->LoadSectionData(m_dwo_id, sect_type, data)) + return; + + SymbolFileDWARF::LoadSectionData(sect_type, data); +} Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h?rev=311775&view=auto ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h (added) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h Fri Aug 25 06:56:14 2017 @@ -0,0 +1,34 @@ +//===-- SymbolFileDWARFDwoDwp.h ---------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef SymbolFileDWARFDwoDwp_SymbolFileDWARFDwoDwp_h_ +#define SymbolFileDWARFDwoDwp_SymbolFileDWARFDwoDwp_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "SymbolFileDWARFDwo.h" +#include "SymbolFileDWARFDwp.h" + +class SymbolFileDWARFDwoDwp : public SymbolFileDWARFDwo { +public: + SymbolFileDWARFDwoDwp(SymbolFileDWARFDwp *dwp_symfile, + lldb::ObjectFileSP objfile, DWARFCompileUnit *dwarf_cu, + uint64_t dwo_id); + +protected: + void LoadSectionData(lldb::SectionType sect_type, + lldb_private::DWARFDataExtractor &data) override; + + SymbolFileDWARFDwp *m_dwp_symfile; + uint64_t m_dwo_id; +}; + +#endif // SymbolFileDWARFDwoDwp_SymbolFileDWARFDwoDwp_h_ Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp?rev=311775&view=auto ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp (added) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp Fri Aug 25 06:56:14 2017 @@ -0,0 +1,138 @@ +//===-- SymbolFileDWARFDwp.cpp ----------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "SymbolFileDWARFDwp.h" + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Core/Section.h" +#include "lldb/Symbol/ObjectFile.h" + +#include "SymbolFileDWARFDwoDwp.h" + +static llvm::DWARFSectionKind +lldbSectTypeToLlvmSectionKind(lldb::SectionType type) { + switch (type) { + case lldb::eSectionTypeDWARFDebugInfo: + return llvm::DW_SECT_INFO; + // case lldb::eSectionTypeDWARFDebugTypes: + // return llvm::DW_SECT_TYPES; + case lldb::eSectionTypeDWARFDebugAbbrev: + return llvm::DW_SECT_ABBREV; + case lldb::eSectionTypeDWARFDebugLine: + return llvm::DW_SECT_LINE; + case lldb::eSectionTypeDWARFDebugLoc: + return llvm::DW_SECT_LOC; + case lldb::eSectionTypeDWARFDebugStrOffsets: + return llvm::DW_SECT_STR_OFFSETS; + // case lldb::eSectionTypeDWARFDebugMacinfo: + // return llvm::DW_SECT_MACINFO; + case lldb::eSectionTypeDWARFDebugMacro: + return llvm::DW_SECT_MACRO; + default: + // Note: 0 is an invalid dwarf section kind. + return llvm::DWARFSectionKind(0); + } +} + +std::unique_ptr<SymbolFileDWARFDwp> +SymbolFileDWARFDwp::Create(lldb::ModuleSP module_sp, + const lldb_private::FileSpec &file_spec) { + const lldb::offset_t file_offset = 0; + lldb::DataBufferSP file_data_sp; + lldb::offset_t file_data_offset = 0; + lldb::ObjectFileSP obj_file = lldb_private::ObjectFile::FindPlugin( + module_sp, &file_spec, file_offset, file_spec.GetByteSize(), file_data_sp, + file_data_offset); + if (obj_file == nullptr) + return nullptr; + + std::unique_ptr<SymbolFileDWARFDwp> dwp_symfile( + new SymbolFileDWARFDwp(module_sp, obj_file)); + + lldb_private::DWARFDataExtractor debug_cu_index; + if (!dwp_symfile->LoadRawSectionData(lldb::eSectionTypeDWARFDebugCuIndex, + debug_cu_index)) + return nullptr; + + llvm::DataExtractor llvm_debug_cu_index( + llvm::StringRef(debug_cu_index.PeekCStr(0), debug_cu_index.GetByteSize()), + debug_cu_index.GetByteOrder() == lldb::eByteOrderLittle, + debug_cu_index.GetAddressByteSize()); + if (!dwp_symfile->m_debug_cu_index.parse(llvm_debug_cu_index)) + return nullptr; + return dwp_symfile; +} + +SymbolFileDWARFDwp::SymbolFileDWARFDwp(lldb::ModuleSP module_sp, + lldb::ObjectFileSP obj_file) + : m_obj_file(std::move(obj_file)), m_debug_cu_index(llvm::DW_SECT_INFO) { + for (const auto &entry : m_debug_cu_index.getRows()) { + m_debug_cu_index_map.emplace(entry.getSignature(), &entry); + } +} + +std::unique_ptr<SymbolFileDWARFDwo> +SymbolFileDWARFDwp::GetSymbolFileForDwoId(DWARFCompileUnit *dwarf_cu, + uint64_t dwo_id) { + return std::unique_ptr<SymbolFileDWARFDwo>( + new SymbolFileDWARFDwoDwp(this, m_obj_file, dwarf_cu, dwo_id)); +} + +bool SymbolFileDWARFDwp::LoadSectionData( + uint64_t dwo_id, lldb::SectionType sect_type, + lldb_private::DWARFDataExtractor &data) { + lldb_private::DWARFDataExtractor section_data; + if (!LoadRawSectionData(sect_type, section_data)) + return false; + + auto it = m_debug_cu_index_map.find(dwo_id); + if (it == m_debug_cu_index_map.end()) + return false; + + auto *offsets = + it->second->getOffset(lldbSectTypeToLlvmSectionKind(sect_type)); + if (offsets) { + data.SetData(section_data, offsets->Offset, offsets->Length); + } else { + data.SetData(section_data, 0, section_data.GetByteSize()); + } + return true; +} + +bool SymbolFileDWARFDwp::LoadRawSectionData( + lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data) { + std::lock_guard<std::mutex> lock(m_sections_mutex); + + auto it = m_sections.find(sect_type); + if (it != m_sections.end()) { + if (it->second.GetByteSize() == 0) + return false; + + data = it->second; + return true; + } + + const lldb_private::SectionList *section_list = + m_obj_file->GetSectionList(false /* update_module_section_list */); + if (section_list) { + lldb::SectionSP section_sp( + section_list->FindSectionByType(sect_type, true)); + if (section_sp) { + if (m_obj_file->ReadSectionData(section_sp.get(), data) != 0) { + m_sections[sect_type] = data; + return true; + } + } + } + m_sections[sect_type].Clear(); + return false; +} Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h?rev=311775&view=auto ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h (added) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h Fri Aug 25 06:56:14 2017 @@ -0,0 +1,53 @@ +//===-- SymbolFileDWARFDwp.h ------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef SymbolFileDWARFDwp_SymbolFileDWARFDwp_h_ +#define SymbolFileDWARFDwp_SymbolFileDWARFDwp_h_ + +// C Includes +// C++ Includes +#include <memory> + +// Other libraries and framework includes +#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h" + +// Project includes +#include "lldb/Core/Module.h" + +#include "DWARFDataExtractor.h" +#include "SymbolFileDWARFDwo.h" + +class SymbolFileDWARFDwp { +public: + static std::unique_ptr<SymbolFileDWARFDwp> + Create(lldb::ModuleSP module_sp, const lldb_private::FileSpec &file_spec); + + std::unique_ptr<SymbolFileDWARFDwo> + GetSymbolFileForDwoId(DWARFCompileUnit *dwarf_cu, uint64_t dwo_id); + + bool LoadSectionData(uint64_t dwo_id, lldb::SectionType sect_type, + lldb_private::DWARFDataExtractor &data); + +private: + explicit SymbolFileDWARFDwp(lldb::ModuleSP module_sp, + lldb::ObjectFileSP obj_file); + + bool LoadRawSectionData(lldb::SectionType sect_type, + lldb_private::DWARFDataExtractor &data); + + lldb::ObjectFileSP m_obj_file; + + std::mutex m_sections_mutex; + std::map<lldb::SectionType, lldb_private::DWARFDataExtractor> m_sections; + + llvm::DWARFUnitIndex m_debug_cu_index; + std::map<uint64_t, const llvm::DWARFUnitIndex::Entry *> m_debug_cu_index_map; +}; + +#endif // SymbolFileDWARFDwp_SymbolFileDWARFDwp_h_ Modified: lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp?rev=311775&r1=311774&r2=311775&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp Fri Aug 25 06:56:14 2017 @@ -127,13 +127,14 @@ SymbolVendorELF::CreateInstance(const ll SectionList *objfile_section_list = dsym_objfile_sp->GetSectionList(); static const SectionType g_sections[] = { - eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr, - eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugFrame, - eSectionTypeDWARFDebugInfo, eSectionTypeDWARFDebugLine, - eSectionTypeDWARFDebugLoc, eSectionTypeDWARFDebugMacInfo, - eSectionTypeDWARFDebugPubNames, eSectionTypeDWARFDebugPubTypes, - eSectionTypeDWARFDebugRanges, eSectionTypeDWARFDebugStr, - eSectionTypeDWARFDebugStrOffsets, eSectionTypeELFSymbolTable, + eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr, + eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugCuIndex, + eSectionTypeDWARFDebugFrame, eSectionTypeDWARFDebugInfo, + eSectionTypeDWARFDebugLine, eSectionTypeDWARFDebugLoc, + eSectionTypeDWARFDebugMacInfo, eSectionTypeDWARFDebugPubNames, + eSectionTypeDWARFDebugPubTypes, eSectionTypeDWARFDebugRanges, + eSectionTypeDWARFDebugStr, eSectionTypeDWARFDebugStrOffsets, + eSectionTypeELFSymbolTable, }; for (size_t idx = 0; idx < sizeof(g_sections) / sizeof(g_sections[0]); ++idx) { Modified: lldb/trunk/source/Symbol/ObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=311775&r1=311774&r2=311775&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ObjectFile.cpp (original) +++ lldb/trunk/source/Symbol/ObjectFile.cpp Fri Aug 25 06:56:14 2017 @@ -348,6 +348,7 @@ AddressClass ObjectFile::GetAddressClass case eSectionTypeDWARFDebugAbbrev: case eSectionTypeDWARFDebugAddr: case eSectionTypeDWARFDebugAranges: + case eSectionTypeDWARFDebugCuIndex: case eSectionTypeDWARFDebugFrame: case eSectionTypeDWARFDebugInfo: case eSectionTypeDWARFDebugLine: _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits