diff options
Diffstat (limited to 'source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp')
-rw-r--r-- | source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp | 80 |
1 files changed, 27 insertions, 53 deletions
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp index e7cb2b413ad7a..c5d7568b52729 100644 --- a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -311,46 +311,12 @@ DWARFCompileUnit::AddCompileUnitDIE(DWARFDebugInfoEntry& die) { assert (m_die_array.empty() && "Compile unit DIE already added"); AddDIE(die); - - DWARFDebugInfoEntry& cu_die = m_die_array.front(); - - const char* dwo_name = cu_die.GetAttributeValueAsString(m_dwarf2Data, - this, - DW_AT_GNU_dwo_name, - nullptr); - if (!dwo_name) - return; - - FileSpec dwo_file(dwo_name, true); - if (dwo_file.IsRelative()) - { - const char* comp_dir = cu_die.GetAttributeValueAsString(m_dwarf2Data, - this, - DW_AT_comp_dir, - nullptr); - if (!comp_dir) - return; - - dwo_file.SetFile(comp_dir, true); - dwo_file.AppendPathComponent(dwo_name); - } - - if (!dwo_file.Exists()) - return; - DataBufferSP dwo_file_data_sp; - lldb::offset_t dwo_file_data_offset = 0; - ObjectFileSP dwo_obj_file = ObjectFile::FindPlugin(m_dwarf2Data->GetObjectFile()->GetModule(), - &dwo_file, - 0 /* file_offset */, - dwo_file.GetByteSize(), - dwo_file_data_sp, - dwo_file_data_offset); - if (dwo_obj_file == nullptr) + const DWARFDebugInfoEntry &cu_die = m_die_array.front(); + std::unique_ptr<SymbolFileDWARFDwo> dwo_symbol_file = m_dwarf2Data->GetDwoSymbolFileForCompileUnit(*this, cu_die); + if (!dwo_symbol_file) return; - std::unique_ptr<SymbolFileDWARFDwo> dwo_symbol_file(new SymbolFileDWARFDwo(dwo_obj_file, this)); - DWARFCompileUnit* dwo_cu = dwo_symbol_file->GetCompileUnit(); if (!dwo_cu) return; // Can't fetch the compile unit from the dwo file. @@ -467,7 +433,7 @@ DWARFCompileUnit::GetID () const { dw_offset_t local_id = m_base_obj_offset != DW_INVALID_OFFSET ? m_base_obj_offset : m_offset; if (m_dwarf2Data) - return m_dwarf2Data->MakeUserID(local_id); + return DIERef(local_id, local_id).GetUID(m_dwarf2Data); else return local_id; } @@ -665,7 +631,7 @@ DWARFCompileUnit::GetDIE (dw_offset_t die_offset) { // Don't specify the compile unit offset as we don't know it because the DIE belongs to // a different compile unit in the same symbol file. - return m_dwarf2Data->DebugInfo()->GetDIE (DIERef(die_offset)); + return m_dwarf2Data->DebugInfo()->GetDIEForDIEOffset(die_offset); } } return DWARFDIE(); // Not found @@ -789,20 +755,21 @@ DWARFCompileUnit::IndexPrivate (DWARFCompileUnit* dwarf_cu, switch (tag) { - case DW_TAG_subprogram: - case DW_TAG_inlined_subroutine: + case DW_TAG_array_type: case DW_TAG_base_type: case DW_TAG_class_type: case DW_TAG_constant: case DW_TAG_enumeration_type: + case DW_TAG_inlined_subroutine: + case DW_TAG_namespace: case DW_TAG_string_type: - case DW_TAG_subroutine_type: case DW_TAG_structure_type: - case DW_TAG_union_type: + case DW_TAG_subprogram: + case DW_TAG_subroutine_type: case DW_TAG_typedef: - case DW_TAG_namespace: - case DW_TAG_variable: + case DW_TAG_union_type: case DW_TAG_unspecified_type: + case DW_TAG_variable: break; default: @@ -977,7 +944,7 @@ DWARFCompileUnit::IndexPrivate (DWARFCompileUnit* dwarf_cu, // as our name. If it starts with '_', then it is ok, else compare // the string to make sure it isn't the same and we don't end up // with duplicate entries - if (name != mangled_cstr && ((mangled_cstr[0] == '_') || (name && ::strcmp(name, mangled_cstr) != 0))) + if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { Mangled mangled (ConstString(mangled_cstr), true); func_fullnames.Insert (mangled.GetMangledName(), DIERef(cu_offset, die.GetOffset())); @@ -1000,7 +967,7 @@ DWARFCompileUnit::IndexPrivate (DWARFCompileUnit* dwarf_cu, // as our name. If it starts with '_', then it is ok, else compare // the string to make sure it isn't the same and we don't end up // with duplicate entries - if (name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) + if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { Mangled mangled (ConstString(mangled_cstr), true); func_fullnames.Insert (mangled.GetMangledName(), DIERef(cu_offset, die.GetOffset())); @@ -1014,20 +981,21 @@ DWARFCompileUnit::IndexPrivate (DWARFCompileUnit* dwarf_cu, } break; + case DW_TAG_array_type: case DW_TAG_base_type: case DW_TAG_class_type: case DW_TAG_constant: case DW_TAG_enumeration_type: case DW_TAG_string_type: - case DW_TAG_subroutine_type: case DW_TAG_structure_type: - case DW_TAG_union_type: + case DW_TAG_subroutine_type: case DW_TAG_typedef: + case DW_TAG_union_type: case DW_TAG_unspecified_type: - if (name && is_declaration == false) - { + if (name && !is_declaration) types.Insert (ConstString(name), DIERef(cu_offset, die.GetOffset())); - } + if (mangled_cstr && !is_declaration) + types.Insert (ConstString(mangled_cstr), DIERef(cu_offset, die.GetOffset())); break; case DW_TAG_namespace: @@ -1180,7 +1148,7 @@ DWARFCompileUnit::LanguageTypeFromDWARF(uint64_t val) { case DW_LANG_Mips_Assembler: return eLanguageTypeMipsAssembler; - case 0x8e57: // FIXME: needs to be added to llvm + case DW_LANG_GOOGLE_RenderScript: return eLanguageTypeExtRenderScript; default: return static_cast<LanguageType>(val); @@ -1259,3 +1227,9 @@ DWARFCompileUnit::SetAddrBase(dw_addr_t addr_base, dw_offset_t base_obj_offset) m_addr_base = addr_base; m_base_obj_offset = base_obj_offset; } + +lldb::ByteOrder +DWARFCompileUnit::GetByteOrder() const +{ + return m_dwarf2Data->GetObjectFile()->GetByteOrder(); +} |