SymbolFileDWARFDwo.cpp revision 293127
1//===-- SymbolFileDWARFDwo.cpp ----------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#include "SymbolFileDWARFDwo.h" 11 12#include "lldb/Core/Section.h" 13#include "lldb/Expression/DWARFExpression.h" 14#include "lldb/Symbol/ObjectFile.h" 15 16#include "DWARFCompileUnit.h" 17#include "DWARFDebugInfo.h" 18 19using namespace lldb; 20using namespace lldb_private; 21 22SymbolFileDWARFDwo::SymbolFileDWARFDwo(ObjectFileSP objfile, DWARFCompileUnit* dwarf_cu) : 23 SymbolFileDWARF(objfile.get()), 24 m_obj_file_sp(objfile), 25 m_base_dwarf_cu(dwarf_cu) 26{ 27 SetID(((lldb::user_id_t)dwarf_cu->GetOffset())<<32); 28} 29 30void 31SymbolFileDWARFDwo::LoadSectionData (lldb::SectionType sect_type, DWARFDataExtractor& data) 32{ 33 const SectionList* section_list = m_obj_file->GetSectionList(false /* update_module_section_list */); 34 if (section_list) 35 { 36 SectionSP section_sp (section_list->FindSectionByType(sect_type, true)); 37 if (section_sp) 38 { 39 // See if we memory mapped the DWARF segment? 40 if (m_dwarf_data.GetByteSize()) 41 { 42 data.SetData(m_dwarf_data, section_sp->GetOffset(), section_sp->GetFileSize()); 43 return; 44 } 45 46 if (m_obj_file->ReadSectionData(section_sp.get(), data) != 0) 47 return; 48 49 data.Clear(); 50 } 51 } 52 53 SymbolFileDWARF::LoadSectionData(sect_type, data); 54} 55 56lldb::CompUnitSP 57SymbolFileDWARFDwo::ParseCompileUnit(DWARFCompileUnit* dwarf_cu, uint32_t cu_idx) 58{ 59 assert(GetCompileUnit() == dwarf_cu && "SymbolFileDWARFDwo::ParseCompileUnit called with incompatible compile unit"); 60 return GetBaseSymbolFile()->ParseCompileUnit(m_base_dwarf_cu, UINT32_MAX); 61} 62 63DWARFCompileUnit* 64SymbolFileDWARFDwo::GetCompileUnit() 65{ 66 // Only dwo files with 1 compile unit is supported 67 if (GetNumCompileUnits() == 1) 68 return DebugInfo()->GetCompileUnitAtIndex(0); 69 else 70 return nullptr; 71} 72 73DWARFCompileUnit* 74SymbolFileDWARFDwo::GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) 75{ 76 return GetCompileUnit(); 77} 78 79SymbolFileDWARF::DIEToTypePtr& 80SymbolFileDWARFDwo::GetDIEToType() 81{ 82 return GetBaseSymbolFile()->GetDIEToType(); 83} 84 85SymbolFileDWARF::DIEToVariableSP& 86SymbolFileDWARFDwo::GetDIEToVariable() 87{ 88 return GetBaseSymbolFile()->GetDIEToVariable(); 89} 90 91SymbolFileDWARF::DIEToClangType& 92SymbolFileDWARFDwo::GetForwardDeclDieToClangType() 93{ 94 return GetBaseSymbolFile()->GetForwardDeclDieToClangType(); 95} 96 97SymbolFileDWARF::ClangTypeToDIE& 98SymbolFileDWARFDwo::GetForwardDeclClangTypeToDie() 99{ 100 return GetBaseSymbolFile()->GetForwardDeclClangTypeToDie(); 101} 102 103UniqueDWARFASTTypeMap& 104SymbolFileDWARFDwo::GetUniqueDWARFASTTypeMap() 105{ 106 return GetBaseSymbolFile()->GetUniqueDWARFASTTypeMap(); 107} 108 109lldb::TypeSP 110SymbolFileDWARFDwo::FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &die_decl_ctx) 111{ 112 return GetBaseSymbolFile()->FindDefinitionTypeForDWARFDeclContext(die_decl_ctx); 113} 114 115SymbolFileDWARF* 116SymbolFileDWARFDwo::GetBaseSymbolFile() 117{ 118 return m_base_dwarf_cu->GetSymbolFileDWARF(); 119} 120 121DWARFExpression::LocationListFormat 122SymbolFileDWARFDwo::GetLocationListFormat() const 123{ 124 return DWARFExpression::SplitDwarfLocationList; 125} 126 127TypeSystem* 128SymbolFileDWARFDwo::GetTypeSystemForLanguage(LanguageType language) 129{ 130 return GetBaseSymbolFile()->GetTypeSystemForLanguage(language); 131} 132