[dwarfdump] Add support for -debug-line=OFFSET

This patch adds support for passing an offset to -debug-line.

Differential revision: https://reviews.llvm.org/D38240

llvm-svn: 314288
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 8bb47c9..f6c8499 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -331,12 +331,15 @@
       if (!CUDIE)
         continue;
       if (auto StmtOffset = toSectionOffset(CUDIE.find(DW_AT_stmt_list))) {
+        if (DumpOffset && *StmtOffset != *DumpOffset)
+          continue;
         DWARFDataExtractor lineData(*DObj, DObj->getLineSection(),
                                     isLittleEndian(), savedAddressByteSize);
         DWARFDebugLine::LineTable LineTable;
         uint32_t Offset = *StmtOffset;
         // Verbose dumping is done during parsing and not on the intermediate
         // representation.
+        OS << "debug_line[" << format("%16.16" PRIx64, Offset) << "]\n";
         if (DumpOpts.Verbose) {
           LineTable.parse(lineData, &Offset, &OS);
         } else {