[llvm-commits] [llvm] r139786 - /llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp

Benjamin Kramer benny.kra at googlemail.com
Wed Sep 14 22:43:00 PDT 2011


Author: d0k
Date: Thu Sep 15 00:43:00 2011
New Revision: 139786

URL: http://llvm.org/viewvc/llvm-project?rev=139786&view=rev
Log:
DWARF: Make DIE printing more bulletproof.

Modified:
    llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp

Modified: llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp?rev=139786&r1=139785&r2=139786&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp Thu Sep 15 00:43:00 2011
@@ -31,9 +31,13 @@
     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 @@
                                                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);
 





More information about the llvm-commits mailing list