forked from OSchip/llvm-project
DWARF: Port debug_addr over to DWARFContext
llvm-svn: 361232
This commit is contained in:
parent
ec767b0b4a
commit
f33f181678
|
@ -46,8 +46,10 @@ ReadAddressFromDebugAddrSection(const DWARFUnit *dwarf_cu,
|
|||
uint32_t index_size = dwarf_cu->GetAddressByteSize();
|
||||
dw_offset_t addr_base = dwarf_cu->GetAddrBase();
|
||||
lldb::offset_t offset = addr_base + index * index_size;
|
||||
return dwarf_cu->GetSymbolFileDWARF()->get_debug_addr_data().GetMaxU64(
|
||||
&offset, index_size);
|
||||
return dwarf_cu->GetSymbolFileDWARF()
|
||||
->GetDWARFContext()
|
||||
.getOrLoadAddrData()
|
||||
.GetMaxU64(&offset, index_size);
|
||||
}
|
||||
|
||||
// DWARFExpression constructor
|
||||
|
@ -2813,12 +2815,7 @@ bool DWARFExpression::Evaluate(
|
|||
return false;
|
||||
}
|
||||
uint64_t index = opcodes.GetULEB128(&offset);
|
||||
uint32_t index_size = dwarf_cu->GetAddressByteSize();
|
||||
dw_offset_t addr_base = dwarf_cu->GetAddrBase();
|
||||
lldb::offset_t offset = addr_base + index * index_size;
|
||||
uint64_t value =
|
||||
dwarf_cu->GetSymbolFileDWARF()->get_debug_addr_data().GetMaxU64(
|
||||
&offset, index_size);
|
||||
lldb::addr_t value = ReadAddressFromDebugAddrSection(dwarf_cu, index);
|
||||
stack.push_back(Scalar(value));
|
||||
stack.back().SetValueType(Value::eValueTypeFileAddress);
|
||||
} break;
|
||||
|
@ -2838,22 +2835,8 @@ bool DWARFExpression::Evaluate(
|
|||
return false;
|
||||
}
|
||||
uint64_t index = opcodes.GetULEB128(&offset);
|
||||
uint32_t index_size = dwarf_cu->GetAddressByteSize();
|
||||
dw_offset_t addr_base = dwarf_cu->GetAddrBase();
|
||||
lldb::offset_t offset = addr_base + index * index_size;
|
||||
const DWARFDataExtractor &debug_addr =
|
||||
dwarf_cu->GetSymbolFileDWARF()->get_debug_addr_data();
|
||||
switch (index_size) {
|
||||
case 4:
|
||||
stack.push_back(Scalar(debug_addr.GetU32(&offset)));
|
||||
break;
|
||||
case 8:
|
||||
stack.push_back(Scalar(debug_addr.GetU64(&offset)));
|
||||
break;
|
||||
default:
|
||||
assert(false && "Unhandled index size");
|
||||
return false;
|
||||
}
|
||||
lldb::addr_t value = ReadAddressFromDebugAddrSection(dwarf_cu, index);
|
||||
stack.push_back(Scalar(value));
|
||||
} break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -48,6 +48,11 @@ const DWARFDataExtractor &DWARFContext::getOrLoadArangesData() {
|
|||
m_data_debug_aranges);
|
||||
}
|
||||
|
||||
const DWARFDataExtractor &DWARFContext::getOrLoadAddrData() {
|
||||
return LoadOrGetSection(m_main_section_list, eSectionTypeDWARFDebugAddr,
|
||||
m_data_debug_addr);
|
||||
}
|
||||
|
||||
const DWARFDataExtractor &DWARFContext::getOrLoadDebugInfoData() {
|
||||
if (isDwo())
|
||||
return LoadOrGetSection(m_dwo_section_list, eSectionTypeDWARFDebugInfoDwo,
|
||||
|
|
|
@ -21,6 +21,7 @@ private:
|
|||
SectionList *m_dwo_section_list;
|
||||
|
||||
llvm::Optional<DWARFDataExtractor> m_data_debug_abbrev;
|
||||
llvm::Optional<DWARFDataExtractor> m_data_debug_addr;
|
||||
llvm::Optional<DWARFDataExtractor> m_data_debug_aranges;
|
||||
llvm::Optional<DWARFDataExtractor> m_data_debug_info;
|
||||
llvm::Optional<DWARFDataExtractor> m_data_debug_line;
|
||||
|
@ -38,6 +39,7 @@ public:
|
|||
m_dwo_section_list(dwo_section_list) {}
|
||||
|
||||
const DWARFDataExtractor &getOrLoadAbbrevData();
|
||||
const DWARFDataExtractor &getOrLoadAddrData();
|
||||
const DWARFDataExtractor &getOrLoadArangesData();
|
||||
const DWARFDataExtractor &getOrLoadDebugInfoData();
|
||||
const DWARFDataExtractor &getOrLoadLineData();
|
||||
|
|
|
@ -204,8 +204,10 @@ static uint64_t ReadAddressFromDebugAddrSection(const DWARFUnit *cu,
|
|||
uint32_t index_size = cu->GetAddressByteSize();
|
||||
dw_offset_t addr_base = cu->GetAddrBase();
|
||||
lldb::offset_t offset = addr_base + index * index_size;
|
||||
return cu->GetSymbolFileDWARF()->get_debug_addr_data().GetMaxU64(&offset,
|
||||
index_size);
|
||||
return cu->GetSymbolFileDWARF()
|
||||
->GetDWARFContext()
|
||||
.getOrLoadAddrData()
|
||||
.GetMaxU64(&offset, index_size);
|
||||
}
|
||||
|
||||
bool DWARFDebugRngLists::FindRanges(const DWARFUnit *cu,
|
||||
|
|
|
@ -549,7 +549,8 @@ dw_addr_t DWARFFormValue::Address() const {
|
|||
uint32_t index_size = m_unit->GetAddressByteSize();
|
||||
dw_offset_t addr_base = m_unit->GetAddrBase();
|
||||
lldb::offset_t offset = addr_base + m_value.value.uval * index_size;
|
||||
return symbol_file->get_debug_addr_data().GetMaxU64(&offset, index_size);
|
||||
return symbol_file->GetDWARFContext().getOrLoadAddrData().GetMaxU64(
|
||||
&offset, index_size);
|
||||
}
|
||||
|
||||
DWARFDIE DWARFFormValue::Reference() const {
|
||||
|
|
|
@ -549,10 +549,6 @@ void SymbolFileDWARF::LoadSectionData(lldb::SectionType sect_type,
|
|||
m_obj_file->ReadSectionData(section_sp.get(), data);
|
||||
}
|
||||
|
||||
const DWARFDataExtractor &SymbolFileDWARF::get_debug_addr_data() {
|
||||
return GetCachedSectionData(eSectionTypeDWARFDebugAddr, m_data_debug_addr);
|
||||
}
|
||||
|
||||
const DWARFDataExtractor &SymbolFileDWARF::DebugLocData() {
|
||||
const DWARFDataExtractor &debugLocData = get_debug_loc_data();
|
||||
if (debugLocData.GetByteSize() > 0)
|
||||
|
|
|
@ -212,7 +212,6 @@ public:
|
|||
|
||||
uint32_t GetPluginVersion() override;
|
||||
|
||||
virtual const lldb_private::DWARFDataExtractor &get_debug_addr_data();
|
||||
const lldb_private::DWARFDataExtractor &get_debug_loc_data();
|
||||
const lldb_private::DWARFDataExtractor &get_debug_loclists_data();
|
||||
const lldb_private::DWARFDataExtractor &get_debug_ranges_data();
|
||||
|
@ -451,7 +450,6 @@ protected:
|
|||
|
||||
lldb_private::DWARFContext m_context;
|
||||
|
||||
DWARFDataSegment m_data_debug_addr;
|
||||
DWARFDataSegment m_data_debug_loc;
|
||||
DWARFDataSegment m_data_debug_loclists;
|
||||
DWARFDataSegment m_data_debug_ranges;
|
||||
|
|
|
@ -112,19 +112,6 @@ DWARFUnit *SymbolFileDWARFDwo::GetBaseCompileUnit() {
|
|||
return m_base_dwarf_cu;
|
||||
}
|
||||
|
||||
const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_addr_data() {
|
||||
// For single file split dwarf case (when we have .dwo sections in a .o),
|
||||
// we do not want to use the .debug_addr section from .o file,
|
||||
// but want to get one from the final executable.
|
||||
// For regular split debug case, .dwo file does not contain the
|
||||
// .debug_addr, so we would always fall back to such lookup anyways.
|
||||
llvm::call_once(m_data_debug_addr.m_flag, [this] {
|
||||
SymbolFileDWARF::LoadSectionData(eSectionTypeDWARFDebugAddr,
|
||||
std::ref(m_data_debug_addr.m_data));
|
||||
});
|
||||
return m_data_debug_addr.m_data;
|
||||
}
|
||||
|
||||
SymbolFileDWARF *SymbolFileDWARFDwo::GetBaseSymbolFile() {
|
||||
return m_base_dwarf_cu->GetSymbolFileDWARF();
|
||||
}
|
||||
|
|
|
@ -45,8 +45,6 @@ public:
|
|||
|
||||
DWARFUnit *GetBaseCompileUnit() override;
|
||||
|
||||
const lldb_private::DWARFDataExtractor &get_debug_addr_data() override;
|
||||
|
||||
protected:
|
||||
void LoadSectionData(lldb::SectionType sect_type,
|
||||
lldb_private::DWARFDataExtractor &data) override;
|
||||
|
|
Loading…
Reference in New Issue