diff options
author | Eric Christopher <echristo@gmail.com> | 2013-09-25 23:02:36 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-09-25 23:02:36 +0000 |
commit | c839df0e4cbc3329ae9f03ca4db5893ea9b2c7bd (patch) | |
tree | afbb9ab3a6b8945f8a40736034a2bdbb9914de40 /lib/DebugInfo | |
parent | 4e1c4d69e457c1e8892dd86983e71d347aff5553 (diff) | |
download | external_llvm-c839df0e4cbc3329ae9f03ca4db5893ea9b2c7bd.zip external_llvm-c839df0e4cbc3329ae9f03ca4db5893ea9b2c7bd.tar.gz external_llvm-c839df0e4cbc3329ae9f03ca4db5893ea9b2c7bd.tar.bz2 |
Unify pubsection/gnu pubsection printing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191407 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo')
-rw-r--r-- | lib/DebugInfo/DWARFContext.cpp | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index 2477f3e..cc1f8f9 100644 --- a/lib/DebugInfo/DWARFContext.cpp +++ b/lib/DebugInfo/DWARFContext.cpp @@ -29,7 +29,7 @@ DWARFContext::~DWARFContext() { } static void dumpPubSection(raw_ostream &OS, StringRef Name, StringRef Data, - bool LittleEndian) { + bool LittleEndian, bool GnuStyle) { OS << "\n." << Name << " contents:\n"; DataExtractor pubNames(Data, LittleEndian, 0); uint32_t offset = 0; @@ -37,16 +37,25 @@ static void dumpPubSection(raw_ostream &OS, StringRef Name, StringRef Data, 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"; + if (GnuStyle) + OS << "Offset Linkage Kind Name\n"; + else + OS << "Offset 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)) << ' ' - << format("%-8s", dwarf::GDBIndexEntryKindString(desc.Kind)) << ' ' - << '\"' << pubNames.getCStr(&offset) << "\"\n"; + if (GnuStyle) { + 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"; + } else { + OS << format("0x%8.8x ", dieRef); + OS << pubNames.getCStr(&offset) << "\n"; + } } } @@ -130,31 +139,17 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) { rangeList.dump(OS); } - if (DumpType == DIDT_All || DumpType == DIDT_Pubnames) { - OS << "\n.debug_pubnames contents:\n"; - DataExtractor pubNames(getPubNamesSection(), 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 << "\n Offset Name\n"; - while (offset < getPubNamesSection().size()) { - uint32_t n = pubNames.getU32(&offset); - if (n == 0) - break; - OS << format("%8x ", n); - OS << pubNames.getCStr(&offset) << "\n"; - } - } + if (DumpType == DIDT_All || DumpType == DIDT_Pubnames) + dumpPubSection(OS, "debug_pubnames", getPubNamesSection(), + isLittleEndian(), false); if (DumpType == DIDT_All || DumpType == DIDT_GnuPubnames) dumpPubSection(OS, "debug_gnu_pubnames", getGnuPubNamesSection(), - isLittleEndian()); + isLittleEndian(), true /* GnuStyle */); if (DumpType == DIDT_All || DumpType == DIDT_GnuPubtypes) dumpPubSection(OS, "debug_gnu_pubtypes", getGnuPubTypesSection(), - isLittleEndian()); + isLittleEndian(), true /* GnuStyle */); if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo) { const DWARFDebugAbbrev *D = getDebugAbbrevDWO(); |