jankratochvil created this revision. Herald added a subscriber: JDevlieghere.
Code commonly checks if the parent DIE is DW_TAG_compile_unit. But DW_TAG_partial_unit also acts as DW_TAG_compile_unit for DWZ as DWZ is using DW_TAG_imported_unit only at the top unit level. All DWZ patches are also applied in: git clone -b dwz git://git.jankratochvil.net/lldb https://reviews.llvm.org/D40469 Files: source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp source/Plugins/SymbolFile/DWARF/DWARFDIE.h source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2031,7 +2031,9 @@ &global_index, &type_index, &namespace_index](size_t cu_idx) { DWARFCompileUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); - if (dwarf_cu) { + if (dwarf_cu + && dwarf_cu->GetCompileUnitDIEOnly().TagOrig() + == DW_TAG_compile_unit) { dwarf_cu->Index( function_basename_index[cu_idx], function_fullname_index[cu_idx], function_method_index[cu_idx], function_selector_index[cu_idx], Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h @@ -193,7 +193,11 @@ const DWARFCompileUnit *cu, lldb::offset_t &file_offset) const; - dw_tag_t Tag() const { return m_tag; } + dw_tag_t TagOrig() const { return m_tag; } + + dw_tag_t Tag() const { + return m_tag != DW_TAG_partial_unit ? m_tag : dw_tag_t(DW_TAG_compile_unit); + } bool IsNULL() const { return m_abbr_idx == 0; } Index: source/Plugins/SymbolFile/DWARF/DWARFDIE.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDIE.h +++ source/Plugins/SymbolFile/DWARF/DWARFDIE.h @@ -89,6 +89,8 @@ //---------------------------------------------------------------------- // Accessing information about a DIE //---------------------------------------------------------------------- + dw_tag_t TagOrig() const; + dw_tag_t Tag() const; const char *GetTagAsCString() const; Index: source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -39,6 +39,13 @@ return DIERef(cu_offset, m_die->GetOffset(m_cu)); } +dw_tag_t DWARFDIE::TagOrig() const { + if (m_die) + return m_die->TagOrig(); + else + return 0; +} + dw_tag_t DWARFDIE::Tag() const { if (m_die) return m_die->Tag();
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2031,7 +2031,9 @@ &global_index, &type_index, &namespace_index](size_t cu_idx) { DWARFCompileUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); - if (dwarf_cu) { + if (dwarf_cu + && dwarf_cu->GetCompileUnitDIEOnly().TagOrig() + == DW_TAG_compile_unit) { dwarf_cu->Index( function_basename_index[cu_idx], function_fullname_index[cu_idx], function_method_index[cu_idx], function_selector_index[cu_idx], Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h @@ -193,7 +193,11 @@ const DWARFCompileUnit *cu, lldb::offset_t &file_offset) const; - dw_tag_t Tag() const { return m_tag; } + dw_tag_t TagOrig() const { return m_tag; } + + dw_tag_t Tag() const { + return m_tag != DW_TAG_partial_unit ? m_tag : dw_tag_t(DW_TAG_compile_unit); + } bool IsNULL() const { return m_abbr_idx == 0; } Index: source/Plugins/SymbolFile/DWARF/DWARFDIE.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDIE.h +++ source/Plugins/SymbolFile/DWARF/DWARFDIE.h @@ -89,6 +89,8 @@ //---------------------------------------------------------------------- // Accessing information about a DIE //---------------------------------------------------------------------- + dw_tag_t TagOrig() const; + dw_tag_t Tag() const; const char *GetTagAsCString() const; Index: source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -39,6 +39,13 @@ return DIERef(cu_offset, m_die->GetOffset(m_cu)); } +dw_tag_t DWARFDIE::TagOrig() const { + if (m_die) + return m_die->TagOrig(); + else + return 0; +} + dw_tag_t DWARFDIE::Tag() const { if (m_die) return m_die->Tag();
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits