diff options
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h index 217f9bb89ace..affad286a490 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -6,12 +6,13 @@ // //===----------------------------------------------------------------------===// -#ifndef SymbolFileDWARF_DWARFUnit_h_ -#define SymbolFileDWARF_DWARFUnit_h_ +#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFUNIT_H +#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFUNIT_H #include "DWARFDIE.h" #include "DWARFDebugInfoEntry.h" #include "lldb/lldb-enumerations.h" +#include "lldb/Utility/XcodeSDK.h" #include "llvm/Support/RWMutex.h" #include <atomic> @@ -39,6 +40,9 @@ class DWARFUnitHeader { dw_offset_t m_length = 0; uint16_t m_version = 0; dw_offset_t m_abbr_offset = 0; + + const llvm::DWARFUnitIndex::Entry *m_index_entry = nullptr; + uint8_t m_unit_type = 0; uint8_t m_addr_size = 0; @@ -56,6 +60,9 @@ public: dw_offset_t GetLength() const { return m_length; } dw_offset_t GetAbbrOffset() const { return m_abbr_offset; } uint8_t GetUnitType() const { return m_unit_type; } + const llvm::DWARFUnitIndex::Entry *GetIndexEntry() const { + return m_index_entry; + } uint64_t GetTypeHash() const { return m_type_hash; } dw_offset_t GetTypeOffset() const { return m_type_offset; } bool IsTypeUnit() const { @@ -65,7 +72,7 @@ public: static llvm::Expected<DWARFUnitHeader> extract(const lldb_private::DWARFDataExtractor &data, DIERef::Section section, - lldb::offset_t *offset_ptr); + lldb::offset_t *offset_ptr, const llvm::DWARFUnitIndex *index); }; class DWARFUnit : public lldb_private::UserID { @@ -76,9 +83,12 @@ public: static llvm::Expected<DWARFUnitSP> extract(SymbolFileDWARF &dwarf2Data, lldb::user_id_t uid, const lldb_private::DWARFDataExtractor &debug_info, - DIERef::Section section, lldb::offset_t *offset_ptr); + DIERef::Section section, lldb::offset_t *offset_ptr, + const llvm::DWARFUnitIndex *index); virtual ~DWARFUnit(); + bool IsDWOUnit() { return m_is_dwo; } + void ExtractUnitDIEIfNeeded(); void ExtractDIEsIfNeeded(); @@ -88,7 +98,8 @@ public: bool m_clear_dies = false; ScopedExtractDIEs(DWARFUnit &cu); ~ScopedExtractDIEs(); - DISALLOW_COPY_AND_ASSIGN(ScopedExtractDIEs); + ScopedExtractDIEs(const ScopedExtractDIEs &) = delete; + const ScopedExtractDIEs &operator=(const ScopedExtractDIEs &) = delete; ScopedExtractDIEs(ScopedExtractDIEs &&rhs); ScopedExtractDIEs &operator=(ScopedExtractDIEs &&rhs); }; @@ -152,8 +163,6 @@ public: lldb::ByteOrder GetByteOrder() const; - llvm::Expected<lldb_private::TypeSystem &> GetTypeSystem(); - const DWARFDebugAranges &GetFunctionAranges(); void SetBaseAddress(dw_addr_t base_addr); @@ -190,9 +199,7 @@ public: uint32_t GetProducerVersionUpdate(); - static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val); - - lldb::LanguageType GetLanguageType(); + uint64_t GetDWARFLanguageType(); bool GetIsOptimized(); @@ -213,6 +220,8 @@ public: uint8_t GetUnitType() const { return m_header.GetUnitType(); } bool IsTypeUnit() const { return m_header.IsTypeUnit(); } + llvm::Optional<uint64_t> GetStringOffsetSectionItem(uint32_t index) const; + /// Return a list of address ranges resulting from a (possibly encoded) /// range list starting at a given offset in the appropriate ranges section. llvm::Expected<DWARFRangeList> FindRnglistFromOffset(dw_offset_t offset); @@ -248,7 +257,7 @@ public: std::unique_ptr<llvm::DWARFLocationTable> GetLocationTable(const lldb_private::DataExtractor &data) const; - const lldb_private::DWARFDataExtractor &GetLocationData() const; + lldb_private::DWARFDataExtractor GetLocationData() const; protected: DWARFUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid, @@ -279,7 +288,7 @@ protected: } SymbolFileDWARF &m_dwarf; - std::unique_ptr<SymbolFileDWARFDwo> m_dwo_symbol_file; + std::shared_ptr<DWARFUnit> m_dwo; DWARFUnitHeader m_header; const DWARFAbbreviationDeclarationSet *m_abbrevs = nullptr; void *m_user_data = nullptr; @@ -304,7 +313,7 @@ protected: uint32_t m_producer_version_major = 0; uint32_t m_producer_version_minor = 0; uint32_t m_producer_version_update = 0; - lldb::LanguageType m_language_type = lldb::eLanguageTypeUnknown; + llvm::Optional<uint64_t> m_language_type; lldb_private::LazyBool m_is_optimized = lldb_private::eLazyBoolCalculate; llvm::Optional<lldb_private::FileSpec> m_comp_dir; llvm::Optional<lldb_private::FileSpec> m_file_spec; @@ -329,11 +338,13 @@ private: void ClearDIEsRWLocked(); void AddUnitDIE(const DWARFDebugInfoEntry &cu_die); + void SetDwoStrOffsetsBase(); void ComputeCompDirAndGuessPathStyle(); void ComputeAbsolutePath(); - DISALLOW_COPY_AND_ASSIGN(DWARFUnit); + DWARFUnit(const DWARFUnit &) = delete; + const DWARFUnit &operator=(const DWARFUnit &) = delete; }; -#endif // SymbolFileDWARF_DWARFUnit_h_ +#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFUNIT_H |
