[lld] r328215 - Make the debug info in some tests more realistic.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 22 10:14:41 PDT 2018


Author: rafael
Date: Thu Mar 22 10:14:41 2018
New Revision: 328215

URL: http://llvm.org/viewvc/llvm-project?rev=328215&view=rev
Log:
Make the debug info in some tests more realistic.

Currently lld just parses the .debug_line section assuming that there
is only one compile unit. That assumption is false (PR36793).

I have a patch that changes lld to iterate over the compile units and
parse the portions of the .debug_line they point to (which fixes
PR36793).

A problem is that we will then need a compiler unit pointing to
.debug_line for lld to see it.

It seems like bfd has the same restriction.

This patch updates existing tests to add a minimal compile unit so
that they still work with PR36793 fixed.

Modified:
    lld/trunk/test/ELF/Inputs/conflict-debug.s
    lld/trunk/test/ELF/Inputs/undef-debug.s
    lld/trunk/test/ELF/compressed-debug-conflict.s
    lld/trunk/test/ELF/undef-broken-debug.test

Modified: lld/trunk/test/ELF/Inputs/conflict-debug.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/conflict-debug.s?rev=328215&r1=328214&r2=328215&view=diff
==============================================================================
--- lld/trunk/test/ELF/Inputs/conflict-debug.s (original)
+++ lld/trunk/test/ELF/Inputs/conflict-debug.s Thu Mar 22 10:14:41 2018
@@ -3,3 +3,24 @@
 .loc 1 4
 zed:
   nop
+
+	.section	.debug_abbrev,"", at progbits
+	.byte	1                       # Abbreviation Code
+	.byte	17                      # DW_TAG_compile_unit
+	.byte	0                       # DW_CHILDREN_no
+	.byte	16                      # DW_AT_stmt_list
+	.byte	23                      # DW_FORM_sec_offset
+	.byte	0                       # EOM(1)
+	.byte	0                       # EOM(2)
+	.byte	0                       # EOM(3)
+
+        .section	.debug_info,"", at progbits
+	.long	.Lend0 - .Lbegin0       # Length of Unit
+.Lbegin0:
+	.short	4                       # DWARF version number
+	.long	.debug_abbrev           # Offset Into Abbrev. Section
+	.byte	8                       # Address Size (in bytes)
+	.byte	1                       # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit
+	.long	.debug_line             # DW_AT_stmt_list
+.Lend0:
+	.section	.debug_line,"", at progbits

Modified: lld/trunk/test/ELF/Inputs/undef-debug.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/undef-debug.s?rev=328215&r1=328214&r2=328215&view=diff
==============================================================================
--- lld/trunk/test/ELF/Inputs/undef-debug.s (original)
+++ lld/trunk/test/ELF/Inputs/undef-debug.s Thu Mar 22 10:14:41 2018
@@ -9,3 +9,24 @@
 .section .text.2,"ax"
 .loc 1 11
         .quad zed5
+
+	.section	.debug_abbrev,"", at progbits
+	.byte	1                       # Abbreviation Code
+	.byte	17                      # DW_TAG_compile_unit
+	.byte	0                       # DW_CHILDREN_no
+	.byte	16                      # DW_AT_stmt_list
+	.byte	23                      # DW_FORM_sec_offset
+	.byte	0                       # EOM(1)
+	.byte	0                       # EOM(2)
+	.byte	0                       # EOM(3)
+
+        .section	.debug_info,"", at progbits
+	.long	.Lend0 - .Lbegin0       # Length of Unit
+.Lbegin0:
+	.short	4                       # DWARF version number
+	.long	.debug_abbrev           # Offset Into Abbrev. Section
+	.byte	8                       # Address Size (in bytes)
+	.byte	1                       # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit
+	.long	.debug_line             # DW_AT_stmt_list
+.Lend0:
+	.section	.debug_line,"", at progbits

Modified: lld/trunk/test/ELF/compressed-debug-conflict.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/compressed-debug-conflict.s?rev=328215&r1=328214&r2=328215&view=diff
==============================================================================
--- lld/trunk/test/ELF/compressed-debug-conflict.s (original)
+++ lld/trunk/test/ELF/compressed-debug-conflict.s Thu Mar 22 10:14:41 2018
@@ -27,3 +27,24 @@ main:
 	xorl	%eax, %eax
 	retl
 	.file	2 "/tmp/repeat/repeat/repeat/repeat" "repeat.h"
+
+	.section	.debug_abbrev,"", at progbits
+	.byte	1                       # Abbreviation Code
+	.byte	17                      # DW_TAG_compile_unit
+	.byte	0                       # DW_CHILDREN_no
+	.byte	16                      # DW_AT_stmt_list
+	.byte	23                      # DW_FORM_sec_offset
+	.byte	0                       # EOM(1)
+	.byte	0                       # EOM(2)
+	.byte	0                       # EOM(3)
+
+        .section	.debug_info,"", at progbits
+	.long	.Lend0 - .Lbegin0       # Length of Unit
+.Lbegin0:
+	.short	4                       # DWARF version number
+	.long	.debug_abbrev           # Offset Into Abbrev. Section
+	.byte	8                       # Address Size (in bytes)
+	.byte	1                       # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit
+	.long	.debug_line             # DW_AT_stmt_list
+.Lend0:
+	.section	.debug_line,"", at progbits

Modified: lld/trunk/test/ELF/undef-broken-debug.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/undef-broken-debug.test?rev=328215&r1=328214&r2=328215&view=diff
==============================================================================
--- lld/trunk/test/ELF/undef-broken-debug.test (original)
+++ lld/trunk/test/ELF/undef-broken-debug.test Thu Mar 22 10:14:41 2018
@@ -40,6 +40,27 @@ Sections:
       - Offset:          0x0000000000000029
         Symbol:          bar
         Type:            R_X86_64_64
+  - Name:            .debug_info
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x0000000000000001
+    Content:         0C000000040000000000080100000000
+  - Name:            .rela.debug_info
+    Type:            SHT_RELA
+    Link:            .symtab
+    AddressAlign:    0x0000000000000008
+    Info:            .debug_info
+    Relocations:
+      - Offset:          0x0000000000000006
+        Symbol:          .debug_abbrev
+        Type:            R_X86_64_32
+      - Offset:          0x000000000000000C
+        Symbol:          .debug_line
+        Type:            R_X86_64_32
+  - Name:            .debug_abbrev
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x0000000000000001
+    Content:         '0111001017000000'
+
 Symbols:
   Global:
     - Name:            _start




More information about the llvm-commits mailing list