[DebugInfo] Bail out if making no progress dumping line tables.

llvm-svn: 319564
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 5893f22..414959c 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -357,12 +357,16 @@
       // Verbose dumping is done during parsing and not on the intermediate
       // representation.
       OS << "debug_line[" << format("0x%8.8x", Offset) << "]\n";
+      unsigned OldOffset = Offset;
       if (DumpOpts.Verbose) {
         LineTable.parse(LineData, &Offset, U, &OS);
       } else {
         LineTable.parse(LineData, &Offset, U);
         LineTable.dump(OS);
       }
+      // Check for unparseable prologue, to avoid infinite loops.
+      if (OldOffset == Offset)
+        break;
     }
   }