tberghammer created this revision. tberghammer added a reviewer: clayborg. tberghammer added a subscriber: lldb-commits.
Fix several issues around dwo symbol file handling This change all dwo related test failure on Linux x86_64 http://reviews.llvm.org/D12804 Files: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h @@ -51,6 +51,12 @@ ClangTypeToDIE& GetForwardDeclClangTypeToDie() override; + lldb::TypeSP + FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &die_decl_ctx) override; + + SymbolFileDWARF* + GetBaseSymbolFile(); + lldb::ObjectFileSP m_obj_file_sp; DWARFCompileUnit* m_base_dwarf_cu; }; Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp @@ -23,6 +23,7 @@ m_obj_file_sp(objfile), m_base_dwarf_cu(dwarf_cu) { + SetID(((lldb::user_id_t)dwarf_cu->GetOffset())<<32); } const lldb_private::DWARFDataExtractor& @@ -63,7 +64,7 @@ SymbolFileDWARFDwo::ParseCompileUnit(DWARFCompileUnit* dwarf_cu, uint32_t cu_idx) { assert(GetCompileUnit() == dwarf_cu && "SymbolFileDWARFDwo::ParseCompileUnit called with incompatible compile unit"); - return m_base_dwarf_cu->GetSymbolFileDWARF()->ParseCompileUnit(m_base_dwarf_cu, UINT32_MAX); + return GetBaseSymbolFile()->ParseCompileUnit(m_base_dwarf_cu, UINT32_MAX); } DWARFCompileUnit* @@ -82,23 +83,35 @@ SymbolFileDWARF::DIEToTypePtr& SymbolFileDWARFDwo::GetDIEToType() { - return m_base_dwarf_cu->GetSymbolFileDWARF()->GetDIEToType(); + return GetBaseSymbolFile()->GetDIEToType(); } SymbolFileDWARF::DIEToVariableSP& SymbolFileDWARFDwo::GetDIEToVariable() { - return m_base_dwarf_cu->GetSymbolFileDWARF()->GetDIEToVariable(); + return GetBaseSymbolFile()->GetDIEToVariable(); } SymbolFileDWARF::DIEToClangType& SymbolFileDWARFDwo::GetForwardDeclDieToClangType() { - return m_base_dwarf_cu->GetSymbolFileDWARF()->GetForwardDeclDieToClangType(); + return GetBaseSymbolFile()->GetForwardDeclDieToClangType(); } SymbolFileDWARF::ClangTypeToDIE& SymbolFileDWARFDwo::GetForwardDeclClangTypeToDie() { - return m_base_dwarf_cu->GetSymbolFileDWARF()->GetForwardDeclClangTypeToDie(); + return GetBaseSymbolFile()->GetForwardDeclClangTypeToDie(); +} + +lldb::TypeSP +SymbolFileDWARFDwo::FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &die_decl_ctx) +{ + return GetBaseSymbolFile()->FindDefinitionTypeForDWARFDeclContext(die_decl_ctx); +} + +SymbolFileDWARF* +SymbolFileDWARFDwo::GetBaseSymbolFile() +{ + return m_base_dwarf_cu->GetSymbolFileDWARF(); } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -432,7 +432,7 @@ bool include_inlines, lldb_private::SymbolContextList& sc_list); - lldb::TypeSP + virtual lldb::TypeSP FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &die_decl_ctx); lldb::TypeSP Index: source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -186,8 +186,11 @@ if (m_cu) { - assert ((id&0xffffffff00000000ull) == 0 || m_cu->GetOffset() == 0); - id |= ((lldb::user_id_t)m_cu->GetOffset()) << 32; + lldb::user_id_t cu_id = ((lldb::user_id_t)m_cu->GetID())<<32; + assert ((id&0xffffffff00000000ull) == 0 || + (cu_id&0xffffffff00000000ll) == 0 || + (id&0xffffffff00000000ull) == (cu_id&0xffffffff00000000ll)); + id |= cu_id; } return id; } Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -2239,6 +2239,13 @@ AddressRange func_range; lldb::addr_t lowest_func_addr = func_ranges.GetMinRangeBase (0); lldb::addr_t highest_func_addr = func_ranges.GetMaxRangeEnd (0); + + // lowest_func_addr is a file address what can't be 0 because at address 0 we should have the + // file header. It is 0 if the linker optimized out the given function when we don't want to + // return an invalid function object. + if (lowest_func_addr == 0) + return nullptr; + if (lowest_func_addr != LLDB_INVALID_ADDRESS && lowest_func_addr <= highest_func_addr) { ModuleSP module_sp (die.GetModule());
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits