diff options
| author | Pavel Labath <pavel@labath.sk> | 2019-12-21 15:29:57 +0100 |
|---|---|---|
| committer | Pavel Labath <pavel@labath.sk> | 2020-01-10 13:29:24 +0100 |
| commit | e65282deca8455d1cc6d83b7016af9aa374f9f89 (patch) | |
| tree | f2a00ac27aefe675278c1124345b7907d05f1f5d | |
| parent | 5b7612792aeb5b161fdd69997db2a64b08f075b6 (diff) | |
| download | bcm5719-llvm-e65282deca8455d1cc6d83b7016af9aa374f9f89.tar.gz bcm5719-llvm-e65282deca8455d1cc6d83b7016af9aa374f9f89.zip | |
[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.
4 files changed, 7 insertions, 23 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp index 5b95912909e..320500fe608 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -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 diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index dcb38da3c43..142de7fb0eb 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -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(); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h index 6bee4ab8be8..217f9bb89ac 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -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(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 0792260e36f..533af5f4e83 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -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, |

