[Lldb-commits] [PATCH] D65789: A more robust way of testing debug_line parser near the end of module

2019-08-07 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368154: A more robust way of testing debug_line parser near 
the end of module (authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65789/new/

https://reviews.llvm.org/D65789

Files:
  lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
  lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s


Index: lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
===
--- lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
+++ lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
@@ -0,0 +1,14 @@
+PHDRS {
+  text PT_LOAD;
+}
+SECTIONS {
+  .shstrtab : { *(.shstrtab) }
+  .debug_info   : { *(.debug_info  ) }
+  .debug_line   : { *(.debug_line  ) }
+  .debug_str: { *(.debug_str   ) }
+  .debug_abbrev : { *(.debug_abbrev) }
+
+  . = 0x201000;
+  .text : { *(.text .text.f) } :text
+  /DISCARD/ : { *(*) }
+}
Index: lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s
===
--- lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s
+++ lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s
@@ -1,10 +1,14 @@
+# Test basics of debug_line parsing. This test uses a linker script which
+# ensures the code is placed at the end of a module to test the boundary
+# condition when the final end-of-sequence line table entry points to an 
address
+# that is outside the range of memory covered by the module.
+
 # REQUIRES: lld, x86
 
 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
-# RUN: ld.lld %t.o -o %t
+# RUN: ld.lld --script=%S/Inputs/debug-line-basic.script %t.o -o %t
 # RUN: %lldb %t -o "image dump line-table -v a.c" -o exit | FileCheck %s
 
-
.text
.globl  _start
 _start:
@@ -35,9 +39,16 @@
.loc   2 1 0 is_stmt 0
 nop
 # CHECK-NEXT: 0x00201007: /tmp/c.c:1{{$}}
-
 # CHECK-NEXT: 0x00201008: /tmp/c.c:1, is_terminal_entry = TRUE{{$}}
 
+   .section.text.f,"ax",@progbits
+f:
+.loc   1 3 0 is_stmt 0
+nop
+# CHECK-NEXT: 0x00201008: /tmp/b.c:3{{$}}
+# CHECK-NEXT: 0x00201009: /tmp/b.c:3, is_terminal_entry = TRUE{{$}}
+
+
.section.debug_str,"MS",@progbits,1
 .Linfo_string1:
.asciz  "a.c"


Index: lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
===
--- lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
+++ lldb/trunk/lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
@@ -0,0 +1,14 @@
+PHDRS {
+  text PT_LOAD;
+}
+SECTIONS {
+  .shstrtab : { *(.shstrtab) }
+  .debug_info   : { *(.debug_info  ) }
+  .debug_line   : { *(.debug_line  ) }
+  .debug_str: { *(.debug_str   ) }
+  .debug_abbrev : { *(.debug_abbrev) }
+
+  . = 0x201000;
+  .text : { *(.text .text.f) } :text
+  /DISCARD/ : { *(*) }
+}
Index: lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s
===
--- lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s
+++ lldb/trunk/lit/SymbolFile/DWARF/debug-line-basic.s
@@ -1,10 +1,14 @@
+# Test basics of debug_line parsing. This test uses a linker script which
+# ensures the code is placed at the end of a module to test the boundary
+# condition when the final end-of-sequence line table entry points to an address
+# that is outside the range of memory covered by the module.
+
 # REQUIRES: lld, x86
 
 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
-# RUN: ld.lld %t.o -o %t
+# RUN: ld.lld --script=%S/Inputs/debug-line-basic.script %t.o -o %t
 # RUN: %lldb %t -o "image dump line-table -v a.c" -o exit | FileCheck %s
 
-
 	.text
 	.globl	_start
 _start:
@@ -35,9 +39,16 @@
 	.loc   2 1 0 is_stmt 0
 nop
 # CHECK-NEXT: 0x00201007: /tmp/c.c:1{{$}}
-
 # CHECK-NEXT: 0x00201008: /tmp/c.c:1, is_terminal_entry = TRUE{{$}}
 
+	.section	.text.f,"ax",@progbits
+f:
+.loc   1 3 0 is_stmt 0
+nop
+# CHECK-NEXT: 0x00201008: /tmp/b.c:3{{$}}
+# CHECK-NEXT: 0x00201009: /tmp/b.c:3, is_terminal_entry = TRUE{{$}}
+
+
 	.section	.debug_str,"MS",@progbits,1
 .Linfo_string1:
 	.asciz	"a.c"
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65789: A more robust way of testing debug_line parser near the end of module

2019-08-07 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 213845.
labath added a comment.

- remove output section addresses


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65789/new/

https://reviews.llvm.org/D65789

Files:
  lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
  lit/SymbolFile/DWARF/debug-line-basic.s


Index: lit/SymbolFile/DWARF/debug-line-basic.s
===
--- lit/SymbolFile/DWARF/debug-line-basic.s
+++ lit/SymbolFile/DWARF/debug-line-basic.s
@@ -1,10 +1,14 @@
+# Test basics of debug_line parsing. This test uses a linker script which
+# ensures the code is placed at the end of a module to test the boundary
+# condition when the final end-of-sequence line table entry points to an 
address
+# that is outside the range of memory covered by the module.
+
 # REQUIRES: lld, x86
 
 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
-# RUN: ld.lld %t.o -o %t
+# RUN: ld.lld --script=%S/Inputs/debug-line-basic.script %t.o -o %t
 # RUN: %lldb %t -o "image dump line-table -v a.c" -o exit | FileCheck %s
 
-
.text
.globl  _start
 _start:
@@ -35,9 +39,16 @@
.loc   2 1 0 is_stmt 0
 nop
 # CHECK-NEXT: 0x00201007: /tmp/c.c:1{{$}}
-
 # CHECK-NEXT: 0x00201008: /tmp/c.c:1, is_terminal_entry = TRUE{{$}}
 
+   .section.text.f,"ax",@progbits
+f:
+.loc   1 3 0 is_stmt 0
+nop
+# CHECK-NEXT: 0x00201008: /tmp/b.c:3{{$}}
+# CHECK-NEXT: 0x00201009: /tmp/b.c:3, is_terminal_entry = TRUE{{$}}
+
+
.section.debug_str,"MS",@progbits,1
 .Linfo_string1:
.asciz  "a.c"
Index: lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
===
--- /dev/null
+++ lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
@@ -0,0 +1,14 @@
+PHDRS {
+  text PT_LOAD;
+}
+SECTIONS {
+  .shstrtab : { *(.shstrtab) }
+  .debug_info   : { *(.debug_info  ) }
+  .debug_line   : { *(.debug_line  ) }
+  .debug_str: { *(.debug_str   ) }
+  .debug_abbrev : { *(.debug_abbrev) }
+
+  . = 0x201000;
+  .text : { *(.text .text.f) } :text
+  /DISCARD/ : { *(*) }
+}


Index: lit/SymbolFile/DWARF/debug-line-basic.s
===
--- lit/SymbolFile/DWARF/debug-line-basic.s
+++ lit/SymbolFile/DWARF/debug-line-basic.s
@@ -1,10 +1,14 @@
+# Test basics of debug_line parsing. This test uses a linker script which
+# ensures the code is placed at the end of a module to test the boundary
+# condition when the final end-of-sequence line table entry points to an address
+# that is outside the range of memory covered by the module.
+
 # REQUIRES: lld, x86
 
 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
-# RUN: ld.lld %t.o -o %t
+# RUN: ld.lld --script=%S/Inputs/debug-line-basic.script %t.o -o %t
 # RUN: %lldb %t -o "image dump line-table -v a.c" -o exit | FileCheck %s
 
-
 	.text
 	.globl	_start
 _start:
@@ -35,9 +39,16 @@
 	.loc   2 1 0 is_stmt 0
 nop
 # CHECK-NEXT: 0x00201007: /tmp/c.c:1{{$}}
-
 # CHECK-NEXT: 0x00201008: /tmp/c.c:1, is_terminal_entry = TRUE{{$}}
 
+	.section	.text.f,"ax",@progbits
+f:
+.loc   1 3 0 is_stmt 0
+nop
+# CHECK-NEXT: 0x00201008: /tmp/b.c:3{{$}}
+# CHECK-NEXT: 0x00201009: /tmp/b.c:3, is_terminal_entry = TRUE{{$}}
+
+
 	.section	.debug_str,"MS",@progbits,1
 .Linfo_string1:
 	.asciz	"a.c"
Index: lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
===
--- /dev/null
+++ lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
@@ -0,0 +1,14 @@
+PHDRS {
+  text PT_LOAD;
+}
+SECTIONS {
+  .shstrtab : { *(.shstrtab) }
+  .debug_info   : { *(.debug_info  ) }
+  .debug_line   : { *(.debug_line  ) }
+  .debug_str: { *(.debug_str   ) }
+  .debug_abbrev : { *(.debug_abbrev) }
+
+  . = 0x201000;
+  .text : { *(.text .text.f) } :text
+  /DISCARD/ : { *(*) }
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65789: A more robust way of testing debug_line parser near the end of module

2019-08-06 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay accepted this revision.
MaskRay added inline comments.
This revision is now accepted and ready to land.



Comment at: lit/SymbolFile/DWARF/Inputs/debug-line-basic.script:6
+  .shstrtab : { *(.shstrtab) }
+  .debug_info0 : { *(.debug_info  ) }
+  .debug_line0 : { *(.debug_line  ) }

`0` (output section address, `addrExpr` in lld) can be deleted. For 
non-SHF_ALLOC sections (`.shstrtab` `.debug_info` etc), the address expression 
is just ignored.

// lld/ELF/LinkerScript.cpp#L772
  if ((sec->flags & SHF_ALLOC) && sec->addrExpr)
setDot(sec->addrExpr, sec->location, false);


(I guess it was retrieved from `ld --verbose`)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65789/new/

https://reviews.llvm.org/D65789



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65789: A more robust way of testing debug_line parser near the end of module

2019-08-06 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added a reviewer: MaskRay.

While removing -z separate-code makes lld produce place the code at the
end of a segment right now, it's possible that future changes to the
linker will change that, thereby removing the coverage for the changes
in r367983. This patch adds a linker script to one of the line table
tests, which ensures that the code (and its line table) will be placed
at the very end of a module.


https://reviews.llvm.org/D65789

Files:
  lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
  lit/SymbolFile/DWARF/debug-line-basic.s


Index: lit/SymbolFile/DWARF/debug-line-basic.s
===
--- lit/SymbolFile/DWARF/debug-line-basic.s
+++ lit/SymbolFile/DWARF/debug-line-basic.s
@@ -1,10 +1,14 @@
+# Test basics of debug_line parsing. This test uses a linker script which
+# ensures the code is placed at the end of a module to test the boundary
+# condition when the final end-of-sequence line table entry points to an 
address
+# that is outside the range of memory covered by the module.
+
 # REQUIRES: lld, x86
 
 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
-# RUN: ld.lld %t.o -o %t
+# RUN: ld.lld --script=%S/Inputs/debug-line-basic.script %t.o -o %t
 # RUN: %lldb %t -o "image dump line-table -v a.c" -o exit | FileCheck %s
 
-
.text
.globl  _start
 _start:
@@ -35,9 +39,16 @@
.loc   2 1 0 is_stmt 0
 nop
 # CHECK-NEXT: 0x00201007: /tmp/c.c:1{{$}}
-
 # CHECK-NEXT: 0x00201008: /tmp/c.c:1, is_terminal_entry = TRUE{{$}}
 
+   .section.text.f,"ax",@progbits
+f:
+.loc   1 3 0 is_stmt 0
+nop
+# CHECK-NEXT: 0x00201008: /tmp/b.c:3{{$}}
+# CHECK-NEXT: 0x00201009: /tmp/b.c:3, is_terminal_entry = TRUE{{$}}
+
+
.section.debug_str,"MS",@progbits,1
 .Linfo_string1:
.asciz  "a.c"
Index: lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
===
--- /dev/null
+++ lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
@@ -0,0 +1,14 @@
+PHDRS {
+  text PT_LOAD;
+}
+SECTIONS {
+  .shstrtab : { *(.shstrtab) }
+  .debug_info0 : { *(.debug_info  ) }
+  .debug_line0 : { *(.debug_line  ) }
+  .debug_str 0 : { *(.debug_str   ) }
+  .debug_abbrev  0 : { *(.debug_abbrev) }
+
+  . = 0x201000;
+  .text : { *(.text .text.f) } :text
+  /DISCARD/ : { *(*) }
+}


Index: lit/SymbolFile/DWARF/debug-line-basic.s
===
--- lit/SymbolFile/DWARF/debug-line-basic.s
+++ lit/SymbolFile/DWARF/debug-line-basic.s
@@ -1,10 +1,14 @@
+# Test basics of debug_line parsing. This test uses a linker script which
+# ensures the code is placed at the end of a module to test the boundary
+# condition when the final end-of-sequence line table entry points to an address
+# that is outside the range of memory covered by the module.
+
 # REQUIRES: lld, x86
 
 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
-# RUN: ld.lld %t.o -o %t
+# RUN: ld.lld --script=%S/Inputs/debug-line-basic.script %t.o -o %t
 # RUN: %lldb %t -o "image dump line-table -v a.c" -o exit | FileCheck %s
 
-
 	.text
 	.globl	_start
 _start:
@@ -35,9 +39,16 @@
 	.loc   2 1 0 is_stmt 0
 nop
 # CHECK-NEXT: 0x00201007: /tmp/c.c:1{{$}}
-
 # CHECK-NEXT: 0x00201008: /tmp/c.c:1, is_terminal_entry = TRUE{{$}}
 
+	.section	.text.f,"ax",@progbits
+f:
+.loc   1 3 0 is_stmt 0
+nop
+# CHECK-NEXT: 0x00201008: /tmp/b.c:3{{$}}
+# CHECK-NEXT: 0x00201009: /tmp/b.c:3, is_terminal_entry = TRUE{{$}}
+
+
 	.section	.debug_str,"MS",@progbits,1
 .Linfo_string1:
 	.asciz	"a.c"
Index: lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
===
--- /dev/null
+++ lit/SymbolFile/DWARF/Inputs/debug-line-basic.script
@@ -0,0 +1,14 @@
+PHDRS {
+  text PT_LOAD;
+}
+SECTIONS {
+  .shstrtab : { *(.shstrtab) }
+  .debug_info0 : { *(.debug_info  ) }
+  .debug_line0 : { *(.debug_line  ) }
+  .debug_str 0 : { *(.debug_str   ) }
+  .debug_abbrev  0 : { *(.debug_abbrev) }
+
+  . = 0x201000;
+  .text : { *(.text .text.f) } :text
+  /DISCARD/ : { *(*) }
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits