mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Unify pubsection/gnu pubsection printing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191407 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4e1c4d69e4
commit
c839df0e4c
@ -29,7 +29,7 @@ DWARFContext::~DWARFContext() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void dumpPubSection(raw_ostream &OS, StringRef Name, StringRef Data,
|
static void dumpPubSection(raw_ostream &OS, StringRef Name, StringRef Data,
|
||||||
bool LittleEndian) {
|
bool LittleEndian, bool GnuStyle) {
|
||||||
OS << "\n." << Name << " contents:\n";
|
OS << "\n." << Name << " contents:\n";
|
||||||
DataExtractor pubNames(Data, LittleEndian, 0);
|
DataExtractor pubNames(Data, LittleEndian, 0);
|
||||||
uint32_t offset = 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 << "Version: " << pubNames.getU16(&offset) << "\n";
|
||||||
OS << "Offset in .debug_info: " << pubNames.getU32(&offset) << "\n";
|
OS << "Offset in .debug_info: " << pubNames.getU32(&offset) << "\n";
|
||||||
OS << "Size: " << pubNames.getU32(&offset) << "\n";
|
OS << "Size: " << pubNames.getU32(&offset) << "\n";
|
||||||
|
if (GnuStyle)
|
||||||
OS << "Offset Linkage Kind Name\n";
|
OS << "Offset Linkage Kind Name\n";
|
||||||
|
else
|
||||||
|
OS << "Offset Name\n";
|
||||||
|
|
||||||
while (offset < Data.size()) {
|
while (offset < Data.size()) {
|
||||||
uint32_t dieRef = pubNames.getU32(&offset);
|
uint32_t dieRef = pubNames.getU32(&offset);
|
||||||
if (dieRef == 0)
|
if (dieRef == 0)
|
||||||
break;
|
break;
|
||||||
|
if (GnuStyle) {
|
||||||
PubIndexEntryDescriptor desc(pubNames.getU8(&offset));
|
PubIndexEntryDescriptor desc(pubNames.getU8(&offset));
|
||||||
OS << format("0x%8.8x ", dieRef)
|
OS << format("0x%8.8x ", dieRef)
|
||||||
<< format("%-8s", dwarf::GDBIndexEntryLinkageString(desc.Linkage)) << ' '
|
<< format("%-8s", dwarf::GDBIndexEntryLinkageString(desc.Linkage))
|
||||||
<< format("%-8s", dwarf::GDBIndexEntryKindString(desc.Kind)) << ' '
|
<< ' ' << format("%-8s", dwarf::GDBIndexEntryKindString(desc.Kind))
|
||||||
<< '\"' << pubNames.getCStr(&offset) << "\"\n";
|
<< ' ' << '\"' << 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);
|
rangeList.dump(OS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DumpType == DIDT_All || DumpType == DIDT_Pubnames) {
|
if (DumpType == DIDT_All || DumpType == DIDT_Pubnames)
|
||||||
OS << "\n.debug_pubnames contents:\n";
|
dumpPubSection(OS, "debug_pubnames", getPubNamesSection(),
|
||||||
DataExtractor pubNames(getPubNamesSection(), isLittleEndian(), 0);
|
isLittleEndian(), false);
|
||||||
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_GnuPubnames)
|
if (DumpType == DIDT_All || DumpType == DIDT_GnuPubnames)
|
||||||
dumpPubSection(OS, "debug_gnu_pubnames", getGnuPubNamesSection(),
|
dumpPubSection(OS, "debug_gnu_pubnames", getGnuPubNamesSection(),
|
||||||
isLittleEndian());
|
isLittleEndian(), true /* GnuStyle */);
|
||||||
|
|
||||||
if (DumpType == DIDT_All || DumpType == DIDT_GnuPubtypes)
|
if (DumpType == DIDT_All || DumpType == DIDT_GnuPubtypes)
|
||||||
dumpPubSection(OS, "debug_gnu_pubtypes", getGnuPubTypesSection(),
|
dumpPubSection(OS, "debug_gnu_pubtypes", getGnuPubTypesSection(),
|
||||||
isLittleEndian());
|
isLittleEndian(), true /* GnuStyle */);
|
||||||
|
|
||||||
if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo) {
|
if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo) {
|
||||||
const DWARFDebugAbbrev *D = getDebugAbbrevDWO();
|
const DWARFDebugAbbrev *D = getDebugAbbrevDWO();
|
||||||
|
@ -8,9 +8,10 @@ CHECK: Offset in .debug_info: 0
|
|||||||
CHECK: Size: 321
|
CHECK: Size: 321
|
||||||
|
|
||||||
CHECK: Offset Name
|
CHECK: Offset Name
|
||||||
CHECK: 98 global_namespace_variable
|
CHECK: 0x00000098 "global_namespace_variable"
|
||||||
CHECK: a7 global_namespace_function
|
CHECK: 0x000000a7 "global_namespace_function"
|
||||||
CHECK: ec static_member_function
|
CHECK: 0x000000ec "static_member_function"
|
||||||
CHECK: 7c global_variable
|
CHECK: 0x0000007c "global_variable"
|
||||||
CHECK: 103 global_function
|
CHECK: 0x00000103 "global_function"
|
||||||
CHECK: c2 member_function
|
CHECK: 0x000000c2 "member_function"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user