]> granicus.if.org Git - llvm/commitdiff
[MC/Dwarf] Use the older DWARF linetables format on Darwin.
authorDavide Italiano <davide@freebsd.org>
Thu, 7 Dec 2017 00:57:25 +0000 (00:57 +0000)
committerDavide Italiano <davide@freebsd.org>
Thu, 7 Dec 2017 00:57:25 +0000 (00:57 +0000)
dsymutil doesn't yet understand the new format and the change,
among others, breaks a large fraction of the debugger tests on
mac OS.

rdar://problem/35856354

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319995 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCDwarf.cpp
test/DebugInfo/Generic/nodebug.ll
test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
test/MC/MachO/file.s
test/MC/MachO/gen-dwarf.s
test/MC/MachO/loc.s

index 32e7cd4f90979b7cf06cafb06af3edccad57c1ce..bda0ec14599971ce7040109eab2f0b1966a0cf1f 100644 (file)
@@ -338,7 +338,10 @@ MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
                MakeStartMinusEndExpr(*MCOS, *LineStartSym, *LineEndSym, 4), 4);
 
   // Next 2 bytes is the Version.
+  // FIXME: On Darwin we still default to V2.
   unsigned LineTableVersion = context.getDwarfVersion();
+  if (context.getObjectFileInfo()->getTargetTriple().isOSDarwin())
+    LineTableVersion = 2;
   MCOS->EmitIntValue(LineTableVersion, 2);
 
   // Keep track of the bytes between the very start and where the header length
index 82528db773ec35fa8d2c049b349a3692cf990115..a911cf13dffe5867fffa8493ecfb1f00bff358ea 100644 (file)
@@ -24,7 +24,7 @@
 ; Expect no line table entry since there are no functions and file references in this compile unit
 ; CHECK: .debug_line contents:
 ; CHECK: Line table prologue:
-; CHECK: total_length: 0x0000001a
+; CHECK: total_length: 0x00000019
 ; CHECK-NOT: file_names[
 
 @i = external global i32
index 0400e6386a3dcef12f2af32edce40c5430f78a4e..64b20e04dee7ad502db9c17192a94d525781850e 100644 (file)
@@ -15,7 +15,7 @@
 ; CHECK: DW_AT_high_pc [DW_FORM_data4]          (0x00000010)
 
 ; CHECK: DW_TAG_compile_unit
-; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x0000003d)
+; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x0000003c)
 ; CHECK: DW_AT_low_pc [DW_FORM_addr]            (0x0000000000000010)
 ; CHECK: DW_AT_high_pc [DW_FORM_data4]          (0x00000009)
 ; CHECK: DW_TAG_subprogram
 ; CHECK: .debug_line contents:
 ; CHECK-NEXT: debug_line[{{.*}}]
 ; CHECK-NEXT: Line table prologue:
-; CHECK-NEXT: total_length: 0x00000039
+; CHECK-NEXT: total_length: 0x00000038
 ; CHECK: file_names[  1]    0 0x00000000 0x00000000 simple.c
 ; CHECK: debug_line[{{.*}}]
 ; CHECK-NEXT: Line table prologue:
-; CHECK-NEXT: total_length: 0x0000003a
+; CHECK-NEXT: total_length: 0x00000039
 ; CHECK: file_names[  1]    0 0x00000000 0x00000000 simple2.c
 ; CHECK-NOT: file_names
 
index 40f8c4ab87de68a90f732f4d260497449cdee9f5..0a871379c864770840579187285ab892e1638499 100644 (file)
@@ -8,7 +8,7 @@
 // CHECK-NEXT:    Name: __debug_line
 // CHECK-NEXT:    Segment: __DWARF
 // CHECK-NEXT:    Address: 0x1
-// CHECK-NEXT:    Size: 0x29
+// CHECK-NEXT:    Size: 0x28
 // CHECK-NEXT:    Offset: 237
 // CHECK-NEXT:    Alignment: 0
 // CHECK-NEXT:    RelocationOffset: 0x0
@@ -20,8 +20,8 @@
 // CHECK-NEXT:    Reserved1: 0x0
 // CHECK-NEXT:    Reserved2: 0x0
 // CHECK-NEXT:    SectionData (
-// CHECK-NEXT:      0000: 25000000 04001F00 00000101 01FB0E0D  |%...............|
-// CHECK-NEXT:      0010: 00010101 01000000 01000001 64697200  |............dir.|
-// CHECK-NEXT:      0020: 00666F6F 00010000 00                 |.foo.....|
+// CHECK-NEXT:       0000: 24000000 02001E00 00000101 FB0E0D00  |$...............|
+// CHECK-NEXT:       0010: 01010101 00000001 00000164 69720000  |...........dir..|
+// CHECK-NEXT:       0020: 666F6F00 01000000                    |foo.....|
 // CHECK-NEXT:    )
 // CHECK-NEXT:  }
index 349c59f3df209a61044f1909477d193d155e5e09..74d3d2aa8bf7588a6e809400ceb91ce5bac1c4be 100644 (file)
@@ -89,7 +89,7 @@ _x:   .long 1
 // CHECK: .debug_line contents:
 // CHECK: Line table prologue:
 // We don't check the total_length as it includes lengths of temp paths
-// CHECK:         version: 4
+// CHECK:         version: 2
 // We don't check the prologue_length as it too includes lengths of temp paths
 // CHECK: min_inst_length: 1
 // CHECK: default_is_stmt: 1
index d38bcf903576467efeefe8a61d51cb668f03a840..c1a2edd60909fccd9866b3be3f4cd7d4c9b8d8ac 100644 (file)
@@ -9,10 +9,10 @@
 // CHECK:     Name: __debug_line (5F 5F 64 65 62 75 67 5F 6C 69 6E 65 00 00 00 00)
 // CHECK:     Segment: __DWARF (5F 5F 44 57 41 52 46 00 00 00 00 00 00 00 00 00)
 // CHECK:     Address: 0x1
-// CHECK:     Size: 0x34
+// CHECK:     Size: 0x33
 // CHECK:     Offset: 237
 // CHECK:     Alignment: 0
-// CHECK:     RelocationOffset: 0x124
+// CHECK:     RelocationOffset: 0x120
 // CHECK:     RelocationCount: 1
 // CHECK:     Type: 0x0
 // CHECK:     Attributes [ (0x20000)
 // CHECK:     Reserved1: 0x0
 // CHECK:     Reserved2: 0x0
 // CHECK:     SectionData (
-// CHECK:       0000: 30000000 04001B00 00000101 01FB0E0D  |0...............|
-// CHECK:       0010: 00010101 01000000 01000001 00666F6F  |.............foo|
-// CHECK:       0020: 00000000 00000502 00000000 033F0102  |.............?..|
-// CHECK:       0030: 01000101   
+// CHECK:       0000: 2F000000 02001A00 00000101 FB0E0D00  |/...............|
+// CHECK:       0010: 01010101 00000001 00000100 666F6F00  |............foo.|
+// CHECK:       0020: 00000000 00050200 00000003 3F010201  |............?...|
+// CHECK:       0030: 000101                               |...|
 // CHECK:     )
 // CHECK:   }
 // CHECK: ]
 // CHECK: Relocations [
 // CHECK:   Section __debug_line {
-// CHECK:     0x28 0 2 0 GENERIC_RELOC_VANILLA 0 __text
+// CHECK:     0x27 0 2 0 GENERIC_RELOC_VANILLA 0 __text
 // CHECK:   }
 // CHECK: ]