From 994c37fcb001bc5a53bf2c676009b327b882d765 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 19 Sep 2013 23:01:29 +0000 Subject: DebugInfo: llvm-dwarfdump support for gnu_pubnames section git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191050 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARFContext.cpp | 22 ++++++++++++++++++++++ lib/DebugInfo/DWARFContext.h | 3 +++ 2 files changed, 25 insertions(+) (limited to 'lib/DebugInfo') diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index baf2bb5b57..c87855e530 100644 --- a/lib/DebugInfo/DWARFContext.cpp +++ b/lib/DebugInfo/DWARFContext.cpp @@ -120,6 +120,27 @@ 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)) + << ' ' << dwarf::GDBIndexEntryKindString(desc.Kind) << ' ' + << pubNames.getCStr(&offset) << "\n"; + } + } + if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo) { const DWARFDebugAbbrev *D = getDebugAbbrevDWO(); if (D) { @@ -566,6 +587,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : .Case("debug_str", &StringSection) .Case("debug_ranges", &RangeSection) .Case("debug_pubnames", &PubNamesSection) + .Case("debug_gnu_pubnames", &GnuPubNamesSection) .Case("debug_info.dwo", &InfoDWOSection) .Case("debug_abbrev.dwo", &AbbrevDWOSection) .Case("debug_str.dwo", &StringDWOSection) diff --git a/lib/DebugInfo/DWARFContext.h b/lib/DebugInfo/DWARFContext.h index c491b4ca49..e4b640e4c9 100644 --- a/lib/DebugInfo/DWARFContext.h +++ b/lib/DebugInfo/DWARFContext.h @@ -125,6 +125,7 @@ public: virtual StringRef getStringSection() = 0; virtual StringRef getRangeSection() = 0; virtual StringRef getPubNamesSection() = 0; + virtual StringRef getGnuPubNamesSection() = 0; // Sections for DWARF5 split dwarf proposal. virtual StringRef getInfoDWOSection() = 0; @@ -166,6 +167,7 @@ class DWARFContextInMemory : public DWARFContext { StringRef StringSection; StringRef RangeSection; StringRef PubNamesSection; + StringRef GnuPubNamesSection; // Sections for DWARF5 split dwarf proposal. RelocAddrMap InfoDWORelocMap; @@ -195,6 +197,7 @@ public: virtual StringRef getStringSection() { return StringSection; } virtual StringRef getRangeSection() { return RangeSection; } virtual StringRef getPubNamesSection() { return PubNamesSection; } + virtual StringRef getGnuPubNamesSection() { return GnuPubNamesSection; } // Sections for DWARF5 split dwarf proposal. virtual StringRef getInfoDWOSection() { return InfoDWOSection; } -- cgit v1.2.3