Changeset View
Changeset View
Standalone View
Standalone View
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Show First 20 Lines • Show All 1,695 Lines • ▼ Show 20 Lines | SymbolFileDWARF *dwarf = *die_ref.dwo_num() == 0x3fffffff | ||||
->GetDwoSymbolFile(); | ->GetDwoSymbolFile(); | ||||
return dwarf->DebugInfo().GetDIE(die_ref); | return dwarf->DebugInfo().GetDIE(die_ref); | ||||
} | } | ||||
return DebugInfo().GetDIE(die_ref); | return DebugInfo().GetDIE(die_ref); | ||||
} | } | ||||
/// Return the DW_AT_(GNU_)dwo_id. | /// Return the DW_AT_(GNU_)dwo_id. | ||||
/// FIXME: Technically 0 is a valid hash. | static llvm::Optional<uint64_t> GetDWOId(DWARFCompileUnit &dwarf_cu, | ||||
static uint64_t GetDWOId(DWARFCompileUnit &dwarf_cu, | |||||
const DWARFDebugInfoEntry &cu_die) { | const DWARFDebugInfoEntry &cu_die) { | ||||
uint64_t dwo_id = | llvm::Optional<uint64_t> dwo_id = | ||||
cu_die.GetAttributeValueAsUnsigned(&dwarf_cu, DW_AT_GNU_dwo_id, 0); | cu_die.GetAttributeValueAsOptionalUnsigned(&dwarf_cu, DW_AT_GNU_dwo_id); | ||||
if (!dwo_id) | if (dwo_id) | ||||
dwo_id = cu_die.GetAttributeValueAsUnsigned(&dwarf_cu, DW_AT_dwo_id, 0); | |||||
return dwo_id; | return dwo_id; | ||||
return cu_die.GetAttributeValueAsOptionalUnsigned(&dwarf_cu, DW_AT_dwo_id); | |||||
} | } | ||||
llvm::Optional<uint64_t> SymbolFileDWARF::GetDWOId() { | llvm::Optional<uint64_t> SymbolFileDWARF::GetDWOId() { | ||||
if (GetNumCompileUnits() == 1) { | if (GetNumCompileUnits() == 1) { | ||||
if (auto comp_unit = GetCompileUnitAtIndex(0)) | if (auto comp_unit = GetCompileUnitAtIndex(0)) | ||||
if (DWARFCompileUnit *cu = GetDWARFCompileUnit(comp_unit.get())) | if (DWARFCompileUnit *cu = GetDWARFCompileUnit(comp_unit.get())) | ||||
if (DWARFDebugInfoEntry *cu_die = cu->DIE().GetDIE()) | if (DWARFDebugInfoEntry *cu_die = cu->DIE().GetDIE()) | ||||
if (uint64_t dwo_id = ::GetDWOId(*cu, *cu_die)) | return ::GetDWOId(*cu, *cu_die); | ||||
return dwo_id; | |||||
} | } | ||||
return {}; | return {}; | ||||
} | } | ||||
std::shared_ptr<SymbolFileDWARFDwo> | std::shared_ptr<SymbolFileDWARFDwo> | ||||
SymbolFileDWARF::GetDwoSymbolFileForCompileUnit( | SymbolFileDWARF::GetDwoSymbolFileForCompileUnit( | ||||
DWARFUnit &unit, const DWARFDebugInfoEntry &cu_die) { | DWARFUnit &unit, const DWARFDebugInfoEntry &cu_die) { | ||||
// If this is a Darwin-style debug map (non-.dSYM) symbol file, | // If this is a Darwin-style debug map (non-.dSYM) symbol file, | ||||
▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | if (!module_sp) { | ||||
"module files.", | "module files.", | ||||
die.GetOffset(), dwo_module_spec.GetFileSpec().GetPath().c_str(), | die.GetOffset(), dwo_module_spec.GetFileSpec().GetPath().c_str(), | ||||
error.AsCString("unknown error")); | error.AsCString("unknown error")); | ||||
continue; | continue; | ||||
} | } | ||||
// Verify the DWO hash. | // Verify the DWO hash. | ||||
// FIXME: Technically "0" is a valid hash. | // FIXME: Technically "0" is a valid hash. | ||||
uint64_t dwo_id = ::GetDWOId(*dwarf_cu, *die.GetDIE()); | llvm::Optional<uint64_t> dwo_id = ::GetDWOId(*dwarf_cu, *die.GetDIE()); | ||||
if (!dwo_id) | if (!dwo_id) | ||||
continue; | continue; | ||||
auto *dwo_symfile = | auto *dwo_symfile = | ||||
llvm::dyn_cast_or_null<SymbolFileDWARF>(module_sp->GetSymbolFile()); | llvm::dyn_cast_or_null<SymbolFileDWARF>(module_sp->GetSymbolFile()); | ||||
if (!dwo_symfile) | if (!dwo_symfile) | ||||
continue; | continue; | ||||
llvm::Optional<uint64_t> dwo_dwo_id = dwo_symfile->GetDWOId(); | llvm::Optional<uint64_t> dwo_dwo_id = dwo_symfile->GetDWOId(); | ||||
▲ Show 20 Lines • Show All 2,247 Lines • Show Last 20 Lines |