[Lldb-commits] [PATCH] D40466: DWZ 01/11: DWARFUnit split out of DWARFCompileUnit
This revision was automatically updated to reflect the committed changes. Closed by commit rL327809: DWARFUnit split out of DWARFCompileUnit (authored by jankratochvil, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D40466?vs=137961=138863#toc Repository: rL LLVM https://reviews.llvm.org/D40466 Files: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt @@ -23,6 +23,7 @@ DWARFDIE.cpp DWARFDIECollection.cpp DWARFFormValue.cpp + DWARFUnit.cpp HashedNameToDIE.cpp LogChannelDWARF.cpp NameToDIE.cpp Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -9,7 +9,6 @@ #include "DWARFCompileUnit.h" -#include "Plugins/Language/ObjC/ObjCLanguage.h" #include "lldb/Core/DumpDataExtractor.h" #include "lldb/Core/Mangled.h" #include "lldb/Core/Module.h" @@ -41,8 +40,6 @@ DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data) : m_dwarf2Data(dwarf2Data) {} -DWARFCompileUnit::~DWARFCompileUnit() {} - DWARFCompileUnitSP DWARFCompileUnit::Extract(SymbolFileDWARF *dwarf2Data, lldb::offset_t *offset_ptr) { DWARFCompileUnitSP cu_sp(new DWARFCompileUnit(dwarf2Data)); @@ -344,28 +341,6 @@ GetNextCompileUnitOffset()); } -static uint8_t g_default_addr_size = 4; - -uint8_t DWARFCompileUnit::GetAddressByteSize(const DWARFCompileUnit *cu) { - if (cu) -return cu->GetAddressByteSize(); - return DWARFCompileUnit::GetDefaultAddressSize(); -} - -bool DWARFCompileUnit::IsDWARF64(const DWARFCompileUnit *cu) { - if (cu) -return cu->IsDWARF64(); - return false; -} - -uint8_t DWARFCompileUnit::GetDefaultAddressSize() { - return g_default_addr_size; -} - -void DWARFCompileUnit::SetDefaultAddressSize(uint8_t addr_size) { - g_default_addr_size = addr_size; -} - lldb::user_id_t DWARFCompileUnit::GetID() const { dw_offset_t local_id = m_base_obj_offset != DW_INVALID_OFFSET ? m_base_obj_offset : m_offset; @@ -516,47 +491,6 @@ return DWARFDIE(); } -//-- -// Compare function DWARFDebugAranges::Range structures -//-- -static bool CompareDIEOffset(const DWARFDebugInfoEntry , - const dw_offset_t die_offset) { - return die.GetOffset() < die_offset; -} - -//-- -// GetDIE() -// -// Get the DIE (Debug Information Entry) with the specified offset by -// first checking if the DIE is contained within this compile unit and -// grabbing the DIE from this compile unit. Otherwise we grab the DIE -// from the DWARF file. -//-- -DWARFDIE -DWARFCompileUnit::GetDIE(dw_offset_t die_offset) { - if (die_offset != DW_INVALID_OFFSET) { -if (m_dwo_symbol_file) - return m_dwo_symbol_file->GetCompileUnit()->GetDIE(die_offset); - -if (ContainsDIEOffset(die_offset)) { - ExtractDIEsIfNeeded(false); - DWARFDebugInfoEntry::iterator end = m_die_array.end(); - DWARFDebugInfoEntry::iterator pos = - lower_bound(m_die_array.begin(), end, die_offset, CompareDIEOffset); - if (pos != end) { -if (die_offset == (*pos).GetOffset()) - return DWARFDIE(this, &(*pos)); - } -} else { - // Don't specify the compile unit offset as we don't know it because the - // DIE belongs to - // a different compile unit in the same symbol file. - return m_dwarf2Data->DebugInfo()->GetDIEForDIEOffset(die_offset); -} - } - return DWARFDIE(); // Not found -} - size_t DWARFCompileUnit::AppendDIEsWithTag(const dw_tag_t tag, DWARFDIECollection , uint32_t depth) const { @@ -594,381 +528,6 @@ //m_global_die_indexes.push_back (die - first_die); //} -void DWARFCompileUnit::Index(NameToDIE _basenames, - NameToDIE _fullnames, NameToDIE _methods, - NameToDIE _selectors, - NameToDIE _class_selectors, - NameToDIE , NameToDIE , -
[Lldb-commits] [PATCH] D40466: DWZ 01/11: DWARFUnit split out of DWARFCompileUnit
jankratochvil added a comment. In https://reviews.llvm.org/D40466#1034875, @davide wrote: > This is No functional change, right (just code churn)? Right. https://reviews.llvm.org/D40466 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40466: DWZ 01/11: DWARFUnit split out of DWARFCompileUnit
davide accepted this revision. davide added a comment. This is No functional change, right (just code churn)? If so, LGTM. https://reviews.llvm.org/D40466 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40466: DWZ 01/11: DWARFUnit split out of DWARFCompileUnit
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. This is fine. Lets start with this and then worry about each next patch. 02/11 next. https://reviews.llvm.org/D40466 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40466: DWZ 01/11: DWARFUnit split out of DWARFCompileUnit
jankratochvil updated this revision to Diff 137961. jankratochvil added a comment. bugfix https://reviews.llvm.org/D40466 Files: source/Plugins/SymbolFile/DWARF/CMakeLists.txt source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFUnit.h Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h === --- /dev/null +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -0,0 +1,159 @@ +//===-- DWARFUnit.h -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef SymbolFileDWARF_DWARFUnit_h_ +#define SymbolFileDWARF_DWARFUnit_h_ + +#include "DWARFDIE.h" +#include "DWARFDebugInfoEntry.h" +#include "lldb/lldb-enumerations.h" + +class DWARFUnit; +class DWARFCompileUnit; +class NameToDIE; +class SymbolFileDWARF; +class SymbolFileDWARFDwo; + +typedef std::shared_ptr DWARFUnitSP; + +enum DWARFProducer { + eProducerInvalid = 0, + eProducerClang, + eProducerGCC, + eProducerLLVMGCC, + eProcucerOther +}; + +class DWARFUnit { +public: + virtual ~DWARFUnit(); + + size_t ExtractDIEsIfNeeded(bool cu_die_only); + DWARFDIE LookupAddress(const dw_addr_t address); + size_t AppendDIEsWithTag(const dw_tag_t tag, + DWARFDIECollection _dies, + uint32_t depth = UINT32_MAX) const; + bool Verify(lldb_private::Stream *s) const; + void Dump(lldb_private::Stream *s) const; + // Offset of the initial length field. + dw_offset_t GetOffset() const { return m_offset; } + lldb::user_id_t GetID() const; + // Size in bytes of the initial length + compile unit header. + uint32_t Size() const; + bool ContainsDIEOffset(dw_offset_t die_offset) const { +return die_offset >= GetFirstDIEOffset() && + die_offset < GetNextCompileUnitOffset(); + } + dw_offset_t GetFirstDIEOffset() const { return m_offset + Size(); } + dw_offset_t GetNextCompileUnitOffset() const; + // Size of the CU data (without initial length and without header). + size_t GetDebugInfoSize() const; + // Size of the CU data incl. header but without initial length. + uint32_t GetLength() const; + uint16_t GetVersion() const; + const DWARFAbbreviationDeclarationSet *GetAbbreviations() const; + dw_offset_t GetAbbrevOffset() const; + uint8_t GetAddressByteSize() const; + dw_addr_t GetBaseAddress() const; + dw_addr_t GetAddrBase() const; + dw_addr_t GetRangesBase() const; + void SetAddrBase(dw_addr_t addr_base, dw_addr_t ranges_base, dw_offset_t base_obj_offset); + void ClearDIEs(bool keep_compile_unit_die); + void BuildAddressRangeTable(SymbolFileDWARF *dwarf2Data, + DWARFDebugAranges *debug_aranges); + + lldb::ByteOrder GetByteOrder() const; + + lldb_private::TypeSystem *GetTypeSystem(); + + DWARFFormValue::FixedFormSizes GetFixedFormSizes(); + + void SetBaseAddress(dw_addr_t base_addr); + + DWARFDIE + GetCompileUnitDIEOnly(); + + DWARFDIE + DIE(); + + bool HasDIEsParsed() const; + + DWARFDIE GetDIE(dw_offset_t die_offset); + + static uint8_t GetAddressByteSize(const DWARFUnit *cu); + + static bool IsDWARF64(const DWARFUnit *cu); + + static uint8_t GetDefaultAddressSize(); + + static void SetDefaultAddressSize(uint8_t addr_size); + + void *GetUserData() const; + + void SetUserData(void *d); + + bool Supports_DW_AT_APPLE_objc_complete_type(); + + bool DW_AT_decl_file_attributes_are_invalid(); + + bool Supports_unnamed_objc_bitfields(); + + void Index(NameToDIE _basenames, NameToDIE _fullnames, + NameToDIE _methods, NameToDIE _selectors, + NameToDIE _class_selectors, NameToDIE , + NameToDIE , NameToDIE ); + + SymbolFileDWARF *GetSymbolFileDWARF() const; + + DWARFProducer GetProducer(); + + uint32_t GetProducerVersionMajor(); + + uint32_t GetProducerVersionMinor(); + + uint32_t GetProducerVersionUpdate(); + + static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val); + + lldb::LanguageType GetLanguageType(); + + bool IsDWARF64() const; + + bool GetIsOptimized(); + + SymbolFileDWARFDwo *GetDwoSymbolFile() const; + + dw_offset_t GetBaseObjOffset() const; + +protected: + virtual DWARFCompileUnit () = 0; + virtual const DWARFCompileUnit () const = 0; + + DWARFUnit(); + + static void + IndexPrivate(DWARFUnit *dwarf_cu, const lldb::LanguageType cu_language, + const DWARFFormValue::FixedFormSizes _form_sizes, + const dw_offset_t cu_offset, NameToDIE _basenames, + NameToDIE _fullnames, NameToDIE _methods, + NameToDIE _selectors, NameToDIE _class_selectors, +