diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-09-24 19:50:00 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-09-24 19:50:00 +0000 |
commit | ecd21fff61dd3597201728cdc726f228ae56f53d (patch) | |
tree | 506dd5bfe211300fa4e1d42e167c7dd5380c1717 /llvm/lib/DebugInfo | |
parent | 4f3f5ade5467cd9d8b2ba0f37489f1b8ea8fcee3 (diff) | |
download | bcm5719-llvm-ecd21fff61dd3597201728cdc726f228ae56f53d.tar.gz bcm5719-llvm-ecd21fff61dd3597201728cdc726f228ae56f53d.zip |
llvm-dwarfdump support for gnu_pubtypes
llvm-svn: 191329
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFContext.cpp | 50 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/DWARFContext.h | 3 |
2 files changed, 33 insertions, 20 deletions
diff --git a/llvm/lib/DebugInfo/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARFContext.cpp index 0e45322a3b6..e629390c5aa 100644 --- a/llvm/lib/DebugInfo/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARFContext.cpp @@ -28,6 +28,28 @@ DWARFContext::~DWARFContext() { DeleteContainerPointers(DWOCUs); } +static void dumpPubSection(raw_ostream &OS, StringRef Name, StringRef Data, + bool LittleEndian) { + OS << "\n." << Name << " contents:\n"; + DataExtractor pubNames(Data, LittleEndian, 0); + uint32_t offset = 0; + OS << "Length: " << pubNames.getU32(&offset) << "\n"; + OS << "Version: " << pubNames.getU16(&offset) << "\n"; + OS << "Offset in .debug_info: " << pubNames.getU32(&offset) << "\n"; + OS << "Size: " << pubNames.getU32(&offset) << "\n"; + OS << "Offset Linkage Kind Name\n"; + while (offset < Data.size()) { + uint32_t dieRef = pubNames.getU32(&offset); + if (dieRef == 0) + break; + PubIndexEntryDescriptor desc(pubNames.getU8(&offset)); + OS << format("0x%8.8x ", dieRef) + << format("%-8s", dwarf::GDBIndexEntryLinkageString(desc.Linkage)) << ' ' + << dwarf::GDBIndexEntryKindString(desc.Kind) << " \"" + << pubNames.getCStr(&offset) << "\"\n"; + } +} + void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) { if (DumpType == DIDT_All || DumpType == DIDT_Abbrev) { OS << ".debug_abbrev contents:\n"; @@ -126,26 +148,13 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) { } } - if (DumpType == DIDT_All || DumpType == DIDT_GnuPubnames) { - OS << "\n.debug_gnu_pubnames contents:\n"; - DataExtractor pubNames(getGnuPubNamesSection(), isLittleEndian(), 0); - offset = 0; - OS << "Length: " << pubNames.getU32(&offset) << "\n"; - OS << "Version: " << pubNames.getU16(&offset) << "\n"; - OS << "Offset in .debug_info: " << pubNames.getU32(&offset) << "\n"; - OS << "Size: " << pubNames.getU32(&offset) << "\n"; - OS << "Offset Linkage Kind Name\n"; - while (offset < getGnuPubNamesSection().size()) { - uint32_t dieRef = pubNames.getU32(&offset); - if (dieRef == 0) - break; - PubIndexEntryDescriptor desc(pubNames.getU8(&offset)); - OS << format("0x%8.8x ", dieRef) - << format("%-8s", dwarf::GDBIndexEntryLinkageString(desc.Linkage)) - << ' ' << format("%-8s", dwarf::GDBIndexEntryKindString(desc.Kind)) - << " \"" << pubNames.getCStr(&offset) << "\"\n"; - } - } + if (DumpType == DIDT_All || DumpType == DIDT_GnuPubnames) + dumpPubSection(OS, "debug_gnu_pubnames", getGnuPubNamesSection(), + isLittleEndian()); + + if (DumpType == DIDT_All || DumpType == DIDT_GnuPubtypes) + dumpPubSection(OS, "debug_gnu_pubtypes", getGnuPubTypesSection(), + isLittleEndian()); if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo) { const DWARFDebugAbbrev *D = getDebugAbbrevDWO(); @@ -612,6 +621,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : .Case("debug_ranges", &RangeSection) .Case("debug_pubnames", &PubNamesSection) .Case("debug_gnu_pubnames", &GnuPubNamesSection) + .Case("debug_gnu_pubtypes", &GnuPubTypesSection) .Case("debug_info.dwo", &InfoDWOSection.Data) .Case("debug_abbrev.dwo", &AbbrevDWOSection) .Case("debug_str.dwo", &StringDWOSection) diff --git a/llvm/lib/DebugInfo/DWARFContext.h b/llvm/lib/DebugInfo/DWARFContext.h index 242d186c696..44311b8e842 100644 --- a/llvm/lib/DebugInfo/DWARFContext.h +++ b/llvm/lib/DebugInfo/DWARFContext.h @@ -148,6 +148,7 @@ public: virtual StringRef getRangeSection() = 0; virtual StringRef getPubNamesSection() = 0; virtual StringRef getGnuPubNamesSection() = 0; + virtual StringRef getGnuPubTypesSection() = 0; // Sections for DWARF5 split dwarf proposal. virtual const Section &getInfoDWOSection() = 0; @@ -187,6 +188,7 @@ class DWARFContextInMemory : public DWARFContext { StringRef RangeSection; StringRef PubNamesSection; StringRef GnuPubNamesSection; + StringRef GnuPubTypesSection; // Sections for DWARF5 split dwarf proposal. Section InfoDWOSection; @@ -216,6 +218,7 @@ public: virtual StringRef getRangeSection() { return RangeSection; } virtual StringRef getPubNamesSection() { return PubNamesSection; } virtual StringRef getGnuPubNamesSection() { return GnuPubNamesSection; } + virtual StringRef getGnuPubTypesSection() { return GnuPubTypesSection; } // Sections for DWARF5 split dwarf proposal. virtual const Section &getInfoDWOSection() { return InfoDWOSection; } |