diff options
| author | Greg Clayton <gclayton@apple.com> | 2018-05-09 16:42:53 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2018-05-09 16:42:53 +0000 |
| commit | f56c30d13b2ea6546036234e0df1a7e7878efd88 (patch) | |
| tree | 20aa47b2a72b7b858cff6f5615d18cc5037bd9cb /lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp | |
| parent | e330071b4354f8cdd8908a143d0f225a7ad0fd67 (diff) | |
| download | bcm5719-llvm-f56c30d13b2ea6546036234e0df1a7e7878efd88.tar.gz bcm5719-llvm-f56c30d13b2ea6546036234e0df1a7e7878efd88.zip | |
General cleanup to minimize the .debug_types patch
This cleanup is designed to make the https://reviews.llvm.org/D32167 patch smaller and easier to read.
Cleanup in this patch:
Allow DWARFUnit subclasses to hand out the data that should be used when decoding data for a DIE. The information might be in .debug_info or could be in .debug_types. There is a new virtual function on DWARFUnit that each subclass must override:
virtual const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const;
This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different data to be used when decoding the DIE information.
Add a new pure virtual function to get the size of the DWARF unit header:
virtual uint32_t DWARFUnit::GetHeaderByteSize() const = 0;
This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different offsets where the first DIE starts when decoding DIE information from the unit.
Added a new function to DWARFDataExtractor to get the size of an offset:
size_t DWARFDataExtractor::GetDWARFSizeOfOffset() const;
Removed dead dumping and parsing code in the DWARFDebugInfo class.
Inlined a bunch of calls in DWARFUnit for accessors that were just returning integer member variables.
Renamed DWARFUnit::Size() to DWARFUnit::GetHeaderByteSize() as it clearly states what it is doing and makes more sense.
Differential Revision: https://reviews.llvm.org/D46606
llvm-svn: 331892
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index 4501e5acafc..84c421273c2 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -83,16 +83,16 @@ size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) { uint32_t depth = 0; // We are in our compile unit, parse starting at the offset we were told to // parse - const DWARFDataExtractor &debug_info_data = m_dwarf->get_debug_info_data(); + const DWARFDataExtractor &data = GetData(); std::vector<uint32_t> die_index_stack; die_index_stack.reserve(32); die_index_stack.push_back(0); bool prev_die_had_children = false; DWARFFormValue::FixedFormSizes fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize(GetAddressByteSize(), - m_is_dwarf64); + IsDWARF64()); while (offset < next_cu_offset && - die.FastExtract(debug_info_data, this, fixed_form_sizes, &offset)) { + die.FastExtract(data, this, fixed_form_sizes, &offset)) { // if (log) // log->Printf("0x%8.8x: %*.*s%s%s", // die.GetOffset(), @@ -276,19 +276,14 @@ lldb::user_id_t DWARFUnit::GetID() const { return local_id; } -uint32_t DWARFUnit::Size() const { return IsDWARF64() ? 23 : 11; } - dw_offset_t DWARFUnit::GetNextCompileUnitOffset() const { - return m_offset + (IsDWARF64() ? 12 : 4) + GetLength(); + return m_offset + GetLengthByteSize() + GetLength(); } size_t DWARFUnit::GetDebugInfoSize() const { - return (IsDWARF64() ? 12 : 4) + GetLength() - Size(); + return GetLengthByteSize() + GetLength() - GetHeaderByteSize(); } -uint32_t DWARFUnit::GetLength() const { return m_length; } -uint16_t DWARFUnit::GetVersion() const { return m_version; } - const DWARFAbbreviationDeclarationSet *DWARFUnit::GetAbbreviations() const { return m_abbrevs; } @@ -297,14 +292,6 @@ dw_offset_t DWARFUnit::GetAbbrevOffset() const { return m_abbrevs ? m_abbrevs->GetOffset() : DW_INVALID_OFFSET; } -uint8_t DWARFUnit::GetAddressByteSize() const { return m_addr_size; } - -dw_addr_t DWARFUnit::GetBaseAddress() const { return m_base_addr; } - -dw_addr_t DWARFUnit::GetAddrBase() const { return m_addr_base; } - -dw_addr_t DWARFUnit::GetRangesBase() const { return m_ranges_base; } - void DWARFUnit::SetAddrBase(dw_addr_t addr_base, dw_addr_t ranges_base, dw_offset_t base_obj_offset) { @@ -632,8 +619,6 @@ LanguageType DWARFUnit::GetLanguageType() { return m_language_type; } -bool DWARFUnit::IsDWARF64() const { return m_is_dwarf64; } - bool DWARFUnit::GetIsOptimized() { if (m_is_optimized == eLazyBoolCalculate) { const DWARFDebugInfoEntry *die = GetUnitDIEPtrOnly(); @@ -1010,3 +995,4 @@ const DWARFDebugAranges &DWARFUnit::GetFunctionAranges() { } return *m_func_aranges_ap.get(); } + |

