diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-15 05:43:00 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-15 05:43:00 +0000 |
commit | 75c63087b4e1528cc608b1586014fc1ebad2d9fb (patch) | |
tree | b3ffb76db514eb9df17b597397f8a434d4cfa201 /lib/DebugInfo | |
parent | 2460f32a8ab3fec16f1578c0119c3c029d236fa5 (diff) | |
download | external_llvm-75c63087b4e1528cc608b1586014fc1ebad2d9fb.zip external_llvm-75c63087b4e1528cc608b1586014fc1ebad2d9fb.tar.gz external_llvm-75c63087b4e1528cc608b1586014fc1ebad2d9fb.tar.bz2 |
DWARF: Make DIE printing more bulletproof.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo')
-rw-r--r-- | lib/DebugInfo/DWARFDebugInfoEntry.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/DebugInfo/DWARFDebugInfoEntry.cpp b/lib/DebugInfo/DWARFDebugInfoEntry.cpp index 0bf8b69..f8c89fd 100644 --- a/lib/DebugInfo/DWARFDebugInfoEntry.cpp +++ b/lib/DebugInfo/DWARFDebugInfoEntry.cpp @@ -31,9 +31,13 @@ void DWARFDebugInfoEntryMinimal::dump(raw_ostream &OS, OS << format("\n0x%8.8x: ", Offset); if (abbrCode) { if (AbbrevDecl) { - OS.indent(indent) << TagString(AbbrevDecl->getTag()) - << format(" [%u] %c\n", abbrCode, - AbbrevDecl->hasChildren() ? '*': ' '); + const char *tagString = TagString(getTag()); + if (tagString) + OS.indent(indent) << tagString; + else + OS.indent(indent) << format("DW_TAG_Unknown_%x", getTag()); + OS << format(" [%u] %c\n", abbrCode, + AbbrevDecl->hasChildren() ? '*' : ' '); // Dump all data in the .debug_info for the attributes const uint32_t numAttributes = AbbrevDecl->getNumAttributes(); @@ -67,8 +71,17 @@ void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS, uint16_t form, unsigned indent) const { OS << format("0x%8.8x: ", *offset_ptr); - OS.indent(indent+2) << AttributeString(attr) - << " [" << FormEncodingString(form) << ']'; + OS.indent(indent+2); + const char *attrString = AttributeString(attr); + if (attrString) + OS << attrString; + else + OS << format("DW_AT_Unknown_%x", attr); + const char *formString = FormEncodingString(form); + if (formString) + OS << " [" << formString << ']'; + else + OS << format(" [DW_FORM_Unknown_%x]", form); DWARFFormValue formValue(form); |