Changeset View
Changeset View
Standalone View
Standalone View
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
void DWARFUnit::ExtractUnitDIEIfNeeded() { | void DWARFUnit::ExtractUnitDIEIfNeeded() { | ||||
ExtractUnitDIENoDwoIfNeeded(); | ExtractUnitDIENoDwoIfNeeded(); | ||||
if (m_has_parsed_non_skeleton_unit) | if (m_has_parsed_non_skeleton_unit) | ||||
return; | return; | ||||
m_has_parsed_non_skeleton_unit = true; | m_has_parsed_non_skeleton_unit = true; | ||||
if (!m_dwo_id) | |||||
return; // No DWO file. | |||||
std::shared_ptr<SymbolFileDWARFDwo> dwo_symbol_file = | std::shared_ptr<SymbolFileDWARFDwo> dwo_symbol_file = | ||||
m_dwarf.GetDwoSymbolFileForCompileUnit(*this, m_first_die); | m_dwarf.GetDwoSymbolFileForCompileUnit(*this, m_first_die); | ||||
if (!dwo_symbol_file) | if (!dwo_symbol_file) | ||||
return; | return; | ||||
DWARFUnit *dwo_cu = dwo_symbol_file->GetDWOCompileUnitForHash(m_dwo_id); | DWARFUnit *dwo_cu = dwo_symbol_file->GetDWOCompileUnitForHash(*m_dwo_id); | ||||
if (!dwo_cu) | if (!dwo_cu) | ||||
return; // Can't fetch the compile unit from the dwo file. | return; // Can't fetch the compile unit from the dwo file. | ||||
dwo_cu->SetUserData(this); | dwo_cu->SetUserData(this); | ||||
DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); | DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); | ||||
if (!dwo_cu_die.IsValid()) | if (!dwo_cu_die.IsValid()) | ||||
return; // Can't fetch the compile unit DIE from the dwo file. | return; // Can't fetch the compile unit DIE from the dwo file. | ||||
▲ Show 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | if (GetVersion() >= 5) { | ||||
// Skip padding. | // Skip padding. | ||||
baseOffset += 2; | baseOffset += 2; | ||||
} | } | ||||
SetStrOffsetsBase(baseOffset); | SetStrOffsetsBase(baseOffset); | ||||
} | } | ||||
uint64_t DWARFUnit::GetDWOId() { | llvm::Optional<uint64_t> DWARFUnit::GetDWOId() { | ||||
ExtractUnitDIENoDwoIfNeeded(); | ExtractUnitDIENoDwoIfNeeded(); | ||||
return m_dwo_id; | return m_dwo_id; | ||||
} | } | ||||
// m_die_array_mutex must be already held as read/write. | // m_die_array_mutex must be already held as read/write. | ||||
void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) { | void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) { | ||||
DWARFAttributes attributes; | DWARFAttributes attributes; | ||||
size_t num_attributes = cu_die.GetAttributes(this, attributes); | size_t num_attributes = cu_die.GetAttributes(this, attributes); | ||||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | |||||
void DWARFUnit::SetLoclistsBase(dw_addr_t loclists_base) { | void DWARFUnit::SetLoclistsBase(dw_addr_t loclists_base) { | ||||
uint64_t offset = 0; | uint64_t offset = 0; | ||||
if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) { | if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) { | ||||
const auto *contribution = entry->getContribution(llvm::DW_SECT_LOCLISTS); | const auto *contribution = entry->getContribution(llvm::DW_SECT_LOCLISTS); | ||||
if (!contribution) { | if (!contribution) { | ||||
GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError( | GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError( | ||||
"Failed to find location list contribution for CU with DWO Id " | "Failed to find location list contribution for CU with DWO Id " | ||||
"0x%" PRIx64, | "0x%" PRIx64, | ||||
this->GetDWOId()); | *GetDWOId()); | ||||
return; | return; | ||||
} | } | ||||
offset += contribution->Offset; | offset += contribution->Offset; | ||||
} | } | ||||
m_loclists_base = loclists_base; | m_loclists_base = loclists_base; | ||||
uint64_t header_size = llvm::DWARFListTableHeader::getHeaderSize(DWARF32); | uint64_t header_size = llvm::DWARFListTableHeader::getHeaderSize(DWARF32); | ||||
if (loclists_base < header_size) | if (loclists_base < header_size) | ||||
▲ Show 20 Lines • Show All 405 Lines • ▼ Show 20 Lines | DWARFUnitHeader::extract(const DWARFDataExtractor &data, | ||||
if (context.isDwo()) { | if (context.isDwo()) { | ||||
const llvm::DWARFUnitIndex *Index; | const llvm::DWARFUnitIndex *Index; | ||||
if (header.IsTypeUnit()) { | if (header.IsTypeUnit()) { | ||||
Index = &context.GetAsLLVM().getTUIndex(); | Index = &context.GetAsLLVM().getTUIndex(); | ||||
if (*Index) | if (*Index) | ||||
header.m_index_entry = Index->getFromHash(header.m_type_hash); | header.m_index_entry = Index->getFromHash(header.m_type_hash); | ||||
} else { | } else { | ||||
Index = &context.GetAsLLVM().getCUIndex(); | Index = &context.GetAsLLVM().getCUIndex(); | ||||
if (*Index && header.m_version >= 5) | if (*Index && header.m_version >= 5 && header.m_dwo_id) | ||||
header.m_index_entry = Index->getFromHash(header.m_dwo_id); | header.m_index_entry = Index->getFromHash(*header.m_dwo_id); | ||||
} | } | ||||
if (!header.m_index_entry) | if (!header.m_index_entry) | ||||
header.m_index_entry = Index->getFromOffset(header.m_offset); | header.m_index_entry = Index->getFromOffset(header.m_offset); | ||||
} | } | ||||
if (header.m_index_entry) { | if (header.m_index_entry) { | ||||
if (header.m_abbr_offset) { | if (header.m_abbr_offset) { | ||||
return llvm::createStringError( | return llvm::createStringError( | ||||
▲ Show 20 Lines • Show All 158 Lines • Show Last 20 Lines |