Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
DWARFDebugInfo.cpp
DWARFDebugInfoEntry.cpp
DWARFDebugMacro.cpp
DWARFDebugRanges.cpp
DWARFDeclContext.cpp
DWARFDefines.cpp
DWARFDIE.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "DWARFCompileUnit.h"
#include "DWARFDebugAranges.h"
#include "DWARFDebugInfo.h"
#include "DWARFDebugRanges.h"
#include "DWARFDeclContext.h"
#include "DWARFFormValue.h"
#include "DWARFUnit.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include "DWARFAttribute.h"
#include "DWARFBaseDIE.h"
#include "DWARFDebugRanges.h"
#include <map>
#include <optional>
#include <set>
Expand Down
56 changes: 0 additions & 56 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp

This file was deleted.

34 changes: 0 additions & 34 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h

This file was deleted.

74 changes: 41 additions & 33 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
#include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/Object/Error.h"

#include "DWARFCompileUnit.h"
Expand Down Expand Up @@ -1029,43 +1031,49 @@ DWARFUnit::GetStringOffsetSectionItem(uint32_t index) const {

llvm::Expected<DWARFRangeList>
DWARFUnit::FindRnglistFromOffset(dw_offset_t offset) {
llvm::DWARFAddressRangesVector llvm_ranges;
if (GetVersion() <= 4) {
const DWARFDebugRanges *debug_ranges = m_dwarf.GetDebugRanges();
if (!debug_ranges)
return llvm::make_error<llvm::object::GenericBinaryError>(
"No debug_ranges section");
return debug_ranges->FindRanges(this, offset);
llvm::DWARFDataExtractor data =
m_dwarf.GetDWARFContext().getOrLoadRangesData().GetAsLLVMDWARF();
data.setAddressSize(m_header.getAddressByteSize());

llvm::DWARFDebugRangeList list;
if (llvm::Error e = list.extract(data, &offset))
return e;
llvm_ranges = list.getAbsoluteRanges(
llvm::object::SectionedAddress{GetBaseAddress()});
} else {
if (!GetRnglistTable())
return llvm::createStringError(std::errc::invalid_argument,
"missing or invalid range list table");

llvm::DWARFDataExtractor data = GetRnglistData().GetAsLLVMDWARF();

// As DW_AT_rnglists_base may be missing we need to call setAddressSize.
data.setAddressSize(m_header.getAddressByteSize());
auto range_list_or_error = GetRnglistTable()->findList(data, offset);
if (!range_list_or_error)
return range_list_or_error.takeError();

llvm::Expected<llvm::DWARFAddressRangesVector> expected_llvm_ranges =
range_list_or_error->getAbsoluteRanges(
llvm::object::SectionedAddress{GetBaseAddress()},
GetAddressByteSize(), [&](uint32_t index) {
uint32_t index_size = GetAddressByteSize();
dw_offset_t addr_base = GetAddrBase();
lldb::offset_t offset =
addr_base + static_cast<lldb::offset_t>(index) * index_size;
return llvm::object::SectionedAddress{
m_dwarf.GetDWARFContext().getOrLoadAddrData().GetMaxU64(
&offset, index_size)};
});
if (!expected_llvm_ranges)
return expected_llvm_ranges.takeError();
llvm_ranges = std::move(*expected_llvm_ranges);
}

if (!GetRnglistTable())
return llvm::createStringError(std::errc::invalid_argument,
"missing or invalid range list table");

llvm::DWARFDataExtractor data = GetRnglistData().GetAsLLVMDWARF();

// As DW_AT_rnglists_base may be missing we need to call setAddressSize.
data.setAddressSize(m_header.getAddressByteSize());
auto range_list_or_error = GetRnglistTable()->findList(data, offset);
if (!range_list_or_error)
return range_list_or_error.takeError();

llvm::Expected<llvm::DWARFAddressRangesVector> llvm_ranges =
range_list_or_error->getAbsoluteRanges(
llvm::object::SectionedAddress{GetBaseAddress()},
GetAddressByteSize(), [&](uint32_t index) {
uint32_t index_size = GetAddressByteSize();
dw_offset_t addr_base = GetAddrBase();
lldb::offset_t offset =
addr_base + static_cast<lldb::offset_t>(index) * index_size;
return llvm::object::SectionedAddress{
m_dwarf.GetDWARFContext().getOrLoadAddrData().GetMaxU64(
&offset, index_size)};
});
if (!llvm_ranges)
return llvm_ranges.takeError();

DWARFRangeList ranges;
for (const llvm::DWARFAddressRange &llvm_range : *llvm_ranges) {
for (const llvm::DWARFAddressRange &llvm_range : llvm_ranges) {
ranges.Append(DWARFRangeList::Entry(llvm_range.LowPC,
llvm_range.HighPC - llvm_range.LowPC));
}
Expand Down
14 changes: 0 additions & 14 deletions lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
#include "DWARFDebugAranges.h"
#include "DWARFDebugInfo.h"
#include "DWARFDebugMacro.h"
#include "DWARFDebugRanges.h"
#include "DWARFDeclContext.h"
#include "DWARFFormValue.h"
#include "DWARFTypeUnit.h"
Expand Down Expand Up @@ -737,19 +736,6 @@ DWARFCompileUnit *SymbolFileDWARF::GetDWARFCompileUnit(CompileUnit *comp_unit) {
return llvm::cast_or_null<DWARFCompileUnit>(dwarf_cu);
}

DWARFDebugRanges *SymbolFileDWARF::GetDebugRanges() {
if (!m_ranges) {
LLDB_SCOPED_TIMER();

if (m_context.getOrLoadRangesData().GetByteSize() > 0)
m_ranges = std::make_unique<DWARFDebugRanges>();

if (m_ranges)
m_ranges->Extract(m_context);
}
return m_ranges.get();
}

/// Make an absolute path out of \p file_spec and remap it using the
/// module's source remapping dictionary.
static void MakeAbsoluteAndRemap(FileSpec &file_spec, DWARFUnit &dwarf_cu,
Expand Down
4 changes: 0 additions & 4 deletions lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class DWARFDebugAranges;
class DWARFDebugInfo;
class DWARFDebugInfoEntry;
class DWARFDebugLine;
class DWARFDebugRanges;
class DWARFDeclContext;
class DWARFFormValue;
class DWARFTypeUnit;
Expand Down Expand Up @@ -212,8 +211,6 @@ class SymbolFileDWARF : public SymbolFileCommon {

DWARFDebugInfo &DebugInfo();

DWARFDebugRanges *GetDebugRanges();

static bool SupportedVersion(uint16_t version);

DWARFDIE
Expand Down Expand Up @@ -531,7 +528,6 @@ class SymbolFileDWARF : public SymbolFileCommon {
typedef std::set<DIERef> DIERefSet;
typedef llvm::StringMap<DIERefSet> NameToOffsetMap;
NameToOffsetMap m_function_scope_qualified_name_map;
std::unique_ptr<DWARFDebugRanges> m_ranges;
UniqueDWARFASTTypeMap m_unique_ast_type_map;
// A map from DIE to lldb_private::Type. For record type, the key might be
// either declaration DIE or definition DIE.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# RUN: %lldb %t -o "image lookup -v -s lookup_ranges" -o exit 2>%t.error | FileCheck %s
# RUN: cat %t.error | FileCheck %s --check-prefix ERROR

# ERROR: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x0000000000000047) attribute, but range extraction failed (No debug_ranges section),
# ERROR: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x0000000000000047) attribute, but range extraction failed (invalid range list offset 0x47),
# CHECK: Function: id = {0x0000001c}, name = "ranges", range = [0x0000000000000000-0x0000000000000004)
# CHECK: Blocks: id = {0x0000001c}, range = [0x00000000-0x00000004)

Expand Down
Loading