mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-07 10:02:22 +00:00
[lldb/DWARF] Don't automatically search dwo unit attributes
This patch removes the code (deep inside DWARFDebugInfoEntry) which automagically returned the attributes of the dwo unit DIE when asking for the attributes of the skeleton unit. This is fairly hacky, and not consistent with how llvm DWARF parser operates. Instead, I change the code the explicitly request (via GetNonSkeletonUnit) the right unit to search (there were just two places that needed this). If it turns out we need this more often, we can create a utility function (external to DWARFUnit) for doing this.
This commit is contained in:
parent
5b7612792a
commit
e65282deca
@ -645,25 +645,7 @@ dw_offset_t DWARFDebugInfoEntry::GetAttributeValue(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we're a unit DIE, also check the attributes of the dwo unit (if any).
|
||||
if (GetParent())
|
||||
return 0;
|
||||
SymbolFileDWARFDwo *dwo_symbol_file = cu->GetDwoSymbolFile();
|
||||
if (!dwo_symbol_file)
|
||||
return 0;
|
||||
|
||||
DWARFCompileUnit *dwo_cu = dwo_symbol_file->GetCompileUnit();
|
||||
if (!dwo_cu)
|
||||
return 0;
|
||||
|
||||
DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
|
||||
if (!dwo_cu_die.IsValid())
|
||||
return 0;
|
||||
|
||||
return dwo_cu_die.GetDIE()->GetAttributeValue(
|
||||
dwo_cu, attr, form_value, end_attr_offset_ptr,
|
||||
check_specification_or_abstract_origin);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// GetAttributeValueAsString
|
||||
|
@ -790,7 +790,8 @@ void DWARFUnit::ComputeAbsolutePath() {
|
||||
m_file_spec->MakeAbsolute(GetCompilationDirectory());
|
||||
}
|
||||
|
||||
SymbolFileDWARFDwo *DWARFUnit::GetDwoSymbolFile() const {
|
||||
SymbolFileDWARFDwo *DWARFUnit::GetDwoSymbolFile() {
|
||||
ExtractUnitDIEIfNeeded();
|
||||
return m_dwo_symbol_file.get();
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ public:
|
||||
lldb_private::FileSpec GetFile(size_t file_idx);
|
||||
lldb_private::FileSpec::Style GetPathStyle();
|
||||
|
||||
SymbolFileDWARFDwo *GetDwoSymbolFile() const;
|
||||
SymbolFileDWARFDwo *GetDwoSymbolFile();
|
||||
|
||||
die_iterator_range dies() {
|
||||
ExtractDIEsIfNeeded();
|
||||
|
@ -693,7 +693,8 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFCompileUnit &dwarf_cu) {
|
||||
} else {
|
||||
ModuleSP module_sp(m_objfile_sp->GetModule());
|
||||
if (module_sp) {
|
||||
const DWARFDIE cu_die = dwarf_cu.DIE();
|
||||
const DWARFBaseDIE cu_die =
|
||||
dwarf_cu.GetNonSkeletonUnit().GetUnitDIEOnly();
|
||||
if (cu_die) {
|
||||
FileSpec cu_file_spec(cu_die.GetName(), dwarf_cu.GetPathStyle());
|
||||
if (cu_file_spec) {
|
||||
@ -711,7 +712,7 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFCompileUnit &dwarf_cu) {
|
||||
LanguageType cu_language = DWARFUnit::LanguageTypeFromDWARF(
|
||||
cu_die.GetAttributeValueAsUnsigned(DW_AT_language, 0));
|
||||
|
||||
bool is_optimized = dwarf_cu.GetIsOptimized();
|
||||
bool is_optimized = dwarf_cu.GetNonSkeletonUnit().GetIsOptimized();
|
||||
BuildCuTranslationTable();
|
||||
cu_sp = std::make_shared<CompileUnit>(
|
||||
module_sp, &dwarf_cu, cu_file_spec,
|
||||
|
Loading…
x
Reference in New Issue
Block a user