Dump the normal dwarf pubtypes section as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191408 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2013-09-25 23:02:41 +00:00
parent c839df0e4c
commit 7357f03e88
4 changed files with 31 additions and 20 deletions

View File

@ -109,6 +109,7 @@ enum DIDumpType {
DIDT_Loc, DIDT_Loc,
DIDT_Ranges, DIDT_Ranges,
DIDT_Pubnames, DIDT_Pubnames,
DIDT_Pubtypes,
DIDT_GnuPubnames, DIDT_GnuPubnames,
DIDT_GnuPubtypes, DIDT_GnuPubtypes,
DIDT_Str, DIDT_Str,

View File

@ -54,7 +54,7 @@ static void dumpPubSection(raw_ostream &OS, StringRef Name, StringRef Data,
<< ' ' << '\"' << pubNames.getCStr(&offset) << "\"\n"; << ' ' << '\"' << pubNames.getCStr(&offset) << "\"\n";
} else { } else {
OS << format("0x%8.8x ", dieRef); OS << format("0x%8.8x ", dieRef);
OS << pubNames.getCStr(&offset) << "\n"; OS << '\"' << pubNames.getCStr(&offset) << "\"\n";
} }
} }
} }
@ -143,6 +143,10 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {
dumpPubSection(OS, "debug_pubnames", getPubNamesSection(), dumpPubSection(OS, "debug_pubnames", getPubNamesSection(),
isLittleEndian(), false); isLittleEndian(), false);
if (DumpType == DIDT_All || DumpType == DIDT_Pubtypes)
dumpPubSection(OS, "debug_pubtypes", getPubTypesSection(),
isLittleEndian(), false);
if (DumpType == DIDT_All || DumpType == DIDT_GnuPubnames) if (DumpType == DIDT_All || DumpType == DIDT_GnuPubnames)
dumpPubSection(OS, "debug_gnu_pubnames", getGnuPubNamesSection(), dumpPubSection(OS, "debug_gnu_pubnames", getGnuPubNamesSection(),
isLittleEndian(), true /* GnuStyle */); isLittleEndian(), true /* GnuStyle */);
@ -605,25 +609,27 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) :
UncompressedSections.push_back(UncompressedSection.take()); UncompressedSections.push_back(UncompressedSection.take());
} }
StringRef *Section = StringSwitch<StringRef*>(name) StringRef *Section =
.Case("debug_info", &InfoSection.Data) StringSwitch<StringRef *>(name)
.Case("debug_abbrev", &AbbrevSection) .Case("debug_info", &InfoSection.Data)
.Case("debug_loc", &LocSection.Data) .Case("debug_abbrev", &AbbrevSection)
.Case("debug_line", &LineSection.Data) .Case("debug_loc", &LocSection.Data)
.Case("debug_aranges", &ARangeSection) .Case("debug_line", &LineSection.Data)
.Case("debug_frame", &DebugFrameSection) .Case("debug_aranges", &ARangeSection)
.Case("debug_str", &StringSection) .Case("debug_frame", &DebugFrameSection)
.Case("debug_ranges", &RangeSection) .Case("debug_str", &StringSection)
.Case("debug_pubnames", &PubNamesSection) .Case("debug_ranges", &RangeSection)
.Case("debug_gnu_pubnames", &GnuPubNamesSection) .Case("debug_pubnames", &PubNamesSection)
.Case("debug_gnu_pubtypes", &GnuPubTypesSection) .Case("debug_pubtypes", &PubTypesSection)
.Case("debug_info.dwo", &InfoDWOSection.Data) .Case("debug_gnu_pubnames", &GnuPubNamesSection)
.Case("debug_abbrev.dwo", &AbbrevDWOSection) .Case("debug_gnu_pubtypes", &GnuPubTypesSection)
.Case("debug_str.dwo", &StringDWOSection) .Case("debug_info.dwo", &InfoDWOSection.Data)
.Case("debug_str_offsets.dwo", &StringOffsetDWOSection) .Case("debug_abbrev.dwo", &AbbrevDWOSection)
.Case("debug_addr", &AddrSection) .Case("debug_str.dwo", &StringDWOSection)
// Any more debug info sections go here. .Case("debug_str_offsets.dwo", &StringOffsetDWOSection)
.Default(0); .Case("debug_addr", &AddrSection)
// Any more debug info sections go here.
.Default(0);
if (Section) { if (Section) {
*Section = data; *Section = data;
if (name == "debug_ranges") { if (name == "debug_ranges") {

View File

@ -147,6 +147,7 @@ public:
virtual StringRef getStringSection() = 0; virtual StringRef getStringSection() = 0;
virtual StringRef getRangeSection() = 0; virtual StringRef getRangeSection() = 0;
virtual StringRef getPubNamesSection() = 0; virtual StringRef getPubNamesSection() = 0;
virtual StringRef getPubTypesSection() = 0;
virtual StringRef getGnuPubNamesSection() = 0; virtual StringRef getGnuPubNamesSection() = 0;
virtual StringRef getGnuPubTypesSection() = 0; virtual StringRef getGnuPubTypesSection() = 0;
@ -187,6 +188,7 @@ class DWARFContextInMemory : public DWARFContext {
StringRef StringSection; StringRef StringSection;
StringRef RangeSection; StringRef RangeSection;
StringRef PubNamesSection; StringRef PubNamesSection;
StringRef PubTypesSection;
StringRef GnuPubNamesSection; StringRef GnuPubNamesSection;
StringRef GnuPubTypesSection; StringRef GnuPubTypesSection;
@ -217,6 +219,7 @@ public:
virtual StringRef getStringSection() { return StringSection; } virtual StringRef getStringSection() { return StringSection; }
virtual StringRef getRangeSection() { return RangeSection; } virtual StringRef getRangeSection() { return RangeSection; }
virtual StringRef getPubNamesSection() { return PubNamesSection; } virtual StringRef getPubNamesSection() { return PubNamesSection; }
virtual StringRef getPubTypesSection() { return PubTypesSection; }
virtual StringRef getGnuPubNamesSection() { return GnuPubNamesSection; } virtual StringRef getGnuPubNamesSection() { return GnuPubNamesSection; }
virtual StringRef getGnuPubTypesSection() { return GnuPubTypesSection; } virtual StringRef getGnuPubTypesSection() { return GnuPubTypesSection; }

View File

@ -67,6 +67,7 @@ DumpType("debug-dump", cl::init(DIDT_All),
clEnumValN(DIDT_Frames, "frames", ".debug_frame"), clEnumValN(DIDT_Frames, "frames", ".debug_frame"),
clEnumValN(DIDT_Ranges, "ranges", ".debug_ranges"), clEnumValN(DIDT_Ranges, "ranges", ".debug_ranges"),
clEnumValN(DIDT_Pubnames, "pubnames", ".debug_pubnames"), clEnumValN(DIDT_Pubnames, "pubnames", ".debug_pubnames"),
clEnumValN(DIDT_Pubtypes, "pubtypes", ".debug_pubtypes"),
clEnumValN(DIDT_Str, "str", ".debug_str"), clEnumValN(DIDT_Str, "str", ".debug_str"),
clEnumValN(DIDT_StrDwo, "str.dwo", ".debug_str.dwo"), clEnumValN(DIDT_StrDwo, "str.dwo", ".debug_str.dwo"),
clEnumValN(DIDT_StrOffsetsDwo, "str_offsets.dwo", ".debug_str_offsets.dwo"), clEnumValN(DIDT_StrOffsetsDwo, "str_offsets.dwo", ".debug_str_offsets.dwo"),