diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h @@ -30,7 +30,8 @@ size_t GetDWARFSizeofInitialLength() const { return 4; } size_t GetDWARFSizeOfOffset() const { return 4; } - llvm::DWARFDataExtractor GetAsLLVM() const; + llvm::DWARFDataExtractor GetAsLLVMDWARF() const; + llvm::DataExtractor GetAsLLVM() const; }; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp @@ -21,9 +21,14 @@ return GetMaxU64(offset_ptr, GetDWARFSizeOfOffset()); } -llvm::DWARFDataExtractor DWARFDataExtractor::GetAsLLVM() const { +llvm::DWARFDataExtractor DWARFDataExtractor::GetAsLLVMDWARF() const { return llvm::DWARFDataExtractor(llvm::ArrayRef(GetDataStart(), GetByteSize()), GetByteOrder() == lldb::eByteOrderLittle, GetAddressByteSize()); } +llvm::DataExtractor DWARFDataExtractor::GetAsLLVM() const { + return llvm::DataExtractor(llvm::ArrayRef(GetDataStart(), GetByteSize()), + GetByteOrder() == lldb::eByteOrderLittle, + GetAddressByteSize()); +} } // namespace lldb_private diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp @@ -16,7 +16,7 @@ void DWARFDebugRanges::Extract(DWARFContext &context) { llvm::DWARFDataExtractor extractor = - context.getOrLoadRangesData().GetAsLLVM(); + context.getOrLoadRangesData().GetAsLLVMDWARF(); llvm::DWARFDebugRangeList extracted_list; uint64_t current_offset = 0; auto extract_next_list = [&] { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -501,7 +501,7 @@ m_loclist_table_header.emplace(".debug_loclists", "locations"); offset += loclists_base - header_size; if (llvm::Error E = m_loclist_table_header->extract( - m_dwarf.GetDWARFContext().getOrLoadLocListsData().GetAsLLVM(), + m_dwarf.GetDWARFContext().getOrLoadLocListsData().GetAsLLVMDWARF(), &offset)) { GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError( "Failed to extract location list table at offset {0:x16} (location " @@ -564,7 +564,7 @@ m_rnglist_table_done = true; if (auto table_or_error = ParseListTableHeader( - GetRnglistData().GetAsLLVM(), m_ranges_base, DWARF32)) + GetRnglistData().GetAsLLVMDWARF(), m_ranges_base, DWARF32)) m_rnglist_table = std::move(table_or_error.get()); else GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError( @@ -1040,7 +1040,7 @@ return llvm::createStringError(std::errc::invalid_argument, "missing or invalid range list table"); - llvm::DWARFDataExtractor data = GetRnglistData().GetAsLLVM(); + llvm::DWARFDataExtractor data = GetRnglistData().GetAsLLVMDWARF(); // As DW_AT_rnglists_base may be missing we need to call setAddressSize. data.setAddressSize(m_header.GetAddressByteSize()); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -23,8 +23,8 @@ DebugNamesDWARFIndex::Create(Module &module, DWARFDataExtractor debug_names, DWARFDataExtractor debug_str, SymbolFileDWARF &dwarf) { - auto index_up = std::make_unique(debug_names.GetAsLLVM(), - debug_str.GetAsLLVM()); + auto index_up = std::make_unique(debug_names.GetAsLLVMDWARF(), + debug_str.GetAsLLVM()); if (llvm::Error E = index_up->extract()) return std::move(E); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -142,7 +142,7 @@ dw_offset_t unit_offset) { Log *log = GetLog(DWARFLog::DebugInfo); - llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVM(); + llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVMDWARF(); llvm::DWARFContext &ctx = context.GetAsLLVM(); llvm::Expected line_table = line.getOrParseLineTable( @@ -166,7 +166,7 @@ dw_offset_t unit_offset) { Log *log = GetLog(DWARFLog::DebugInfo); bool success = true; - llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVM(); + llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVMDWARF(); llvm::DWARFContext &ctx = context.GetAsLLVM(); uint64_t offset = line_offset; llvm::Error error = prologue.parse( @@ -1058,7 +1058,8 @@ FileSpecList &list = iter_bool.first->second; if (iter_bool.second) { uint64_t line_table_offset = offset; - llvm::DWARFDataExtractor data = m_context.getOrLoadLineData().GetAsLLVM(); + llvm::DWARFDataExtractor data = + m_context.getOrLoadLineData().GetAsLLVMDWARF(); llvm::DWARFContext &ctx = m_context.GetAsLLVM(); llvm::DWARFDebugLine::Prologue prologue; auto report = [](llvm::Error error) {