diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-01-09 05:08:24 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-01-09 05:08:24 +0000 |
commit | a34ec4a961503e1ceb6c6c3ce0b59911960b8fa1 (patch) | |
tree | e47861d4a1b522985bb14c9a463e5eacae5a0765 /lib/DebugInfo/DWARFContext.cpp | |
parent | 3ca4db23ed3bf1798e238722319633e07ed39f44 (diff) | |
download | llvm-a34ec4a961503e1ceb6c6c3ce0b59911960b8fa1.tar.gz llvm-a34ec4a961503e1ceb6c6c3ce0b59911960b8fa1.tar.bz2 llvm-a34ec4a961503e1ceb6c6c3ce0b59911960b8fa1.tar.xz |
llvm-dwarfdump: type unit dwo support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198850 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo/DWARFContext.cpp')
-rw-r--r-- | lib/DebugInfo/DWARFContext.cpp | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index e8c47802a5..b725619d8e 100644 --- a/lib/DebugInfo/DWARFContext.cpp +++ b/lib/DebugInfo/DWARFContext.cpp @@ -91,6 +91,13 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) { getTypeUnitAtIndex(i)->dump(OS); } + if (DumpType == DIDT_All || DumpType == DIDT_TypesDwo) + if (getNumDWOTypeUnits()) { + OS << "\n.debug_types.dwo contents:\n"; + for (unsigned i = 0, e = getNumDWOTypeUnits(); i != e; ++i) + getDWOTypeUnitAtIndex(i)->dump(OS); + } + if (DumpType == DIDT_All || DumpType == DIDT_Loc) { OS << "\n.debug_loc contents:\n"; getDebugLoc()->dump(OS); @@ -333,6 +340,27 @@ void DWARFContext::parseDWOCompileUnits() { } } +void DWARFContext::parseDWOTypeUnits() { + const TypeSectionMap &Sections = getTypesDWOSections(); + for (TypeSectionMap::const_iterator I = Sections.begin(), E = Sections.end(); + I != E; ++I) { + uint32_t offset = 0; + const DataExtractor &DIData = + DataExtractor(I->second.Data, isLittleEndian(), 0); + while (DIData.isValidOffset(offset)) { + OwningPtr<DWARFTypeUnit> TU(new DWARFTypeUnit( + getDebugAbbrevDWO(), I->second.Data, getAbbrevDWOSection(), + getRangeDWOSection(), getStringDWOSection(), + getStringOffsetDWOSection(), getAddrSection(), &I->second.Relocs, + isLittleEndian())); + if (!TU->extract(DIData, &offset)) + break; + DWOTUs.push_back(TU.take()); + offset = DWOTUs.back()->getNextUnitOffset(); + } + } +} + namespace { struct OffsetComparator { bool operator()(const DWARFCompileUnit *LHS, @@ -632,6 +660,8 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : // Find debug_types data by section rather than name as there are // multiple, comdat grouped, debug_types sections. TypesSections[*i].Data = data; + } else if (name == "debug_types.dwo") { + TypesDWOSections[*i].Data = data; } section_iterator RelocatedSection = i->getRelocatedSection(); @@ -652,11 +682,14 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : .Case("debug_line", &LineSection.Relocs) .Default(0); if (!Map) { - if (RelSecName != "debug_types") - continue; // Find debug_types relocs by section rather than name as there are // multiple, comdat grouped, debug_types sections. - Map = &TypesSections[*RelocatedSection].Relocs; + if (RelSecName == "debug_types") + Map = &TypesSections[*RelocatedSection].Relocs; + else if (RelSecName == "debug_types.dwo") + Map = &TypesDWOSections[*RelocatedSection].Relocs; + else + continue; } if (i->begin_relocations() != i->end_relocations()) { |