[PATCH] D41084: [dsymutil] Accept DWARF4 line tables.

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 11:59:17 PST 2017


JDevlieghere created this revision.
JDevlieghere added a project: debug-info.

This patch removes the hard-coded check for DWARFv2 line tables. Now
dsymutil accepts line tables for DWARF versions 2 to 5 (inclusive).


Repository:
  rL LLVM

https://reviews.llvm.org/D41084

Files:
  test/tools/dsymutil/Inputs/dwarf4.o
  test/tools/dsymutil/X86/dwarf4-linetable.test
  tools/dsymutil/DwarfLinker.cpp


Index: tools/dsymutil/DwarfLinker.cpp
===================================================================
--- tools/dsymutil/DwarfLinker.cpp
+++ tools/dsymutil/DwarfLinker.cpp
@@ -3237,7 +3237,8 @@
   // prologue over and that works because we act as both producer and
   // consumer. It would be nicer to have a real configurable line
   // table emitter.
-  if (LineTable.Prologue.getVersion() != 2 ||
+  if (LineTable.Prologue.getVersion() < 2 ||
+      LineTable.Prologue.getVersion() > 5 ||
       LineTable.Prologue.DefaultIsStmt != DWARF2_LINE_DEFAULT_IS_STMT ||
       LineTable.Prologue.OpcodeBase > 13)
     reportWarning("line table parameters mismatch. Cannot emit.");
Index: test/tools/dsymutil/X86/dwarf4-linetable.test
===================================================================
--- /dev/null
+++ test/tools/dsymutil/X86/dwarf4-linetable.test
@@ -0,0 +1,23 @@
+# RUN: llvm-dsymutil -f -oso-prepend-path=%p/../Inputs/ -y %s -o - | llvm-dwarfdump -debug-line - | FileCheck %s
+
+# Source:
+#   int main() {
+#     return 0;
+#   }
+# Compile with:
+#   clang -gdwarf-4 dwarf4.c -c -o dwarf4.o
+
+---
+triple:          'x86_64-apple-darwin'
+objects:
+  - filename:        dwarf4.o
+    timestamp:       1513021112
+    symbols:
+      - { sym: _main, objAddr: 0x0000000000000000, binAddr: 0x0000000100000FA0, size: 0x0000000F }
+...
+
+# CHECK: .debug_line contents:
+# CHECK: debug_line
+# CHECK: Line table prologue:
+# CHECK: total_length:
+# CHECK: version: 4


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41084.126416.patch
Type: text/x-patch
Size: 1485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171211/3ce2b1e2/attachment.bin>


More information about the llvm-commits mailing list