xref: /llvm-project/lldb/test/Shell/SymbolFile/DWARF/x86/debug-line-basic.s (revision 8a64d80a959bf2844df33f9112e456f33de7b468)
1# Test basics of debug_line parsing. This test uses a linker script which
2# ensures the code is placed at the end of a module to test the boundary
3# condition when the final end-of-sequence line table entry points to an address
4# that is outside the range of memory covered by the module.
5
6# REQUIRES: lld
7
8# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o
9# RUN: ld.lld --script=%S/Inputs/debug-line-basic.script %t.o -o %t
10# RUN: %lldb %t -o "image dump line-table -v a.c" -o exit | FileCheck %s
11
12	.text
13	.globl	_start
14_start:
15# CHECK: Line table for /tmp/a.c
16	.file	1 "/tmp/b.c"
17	.loc	1 0 0
18        nop
19# CHECK-NEXT: 0x0000000000201000: /tmp/b.c, is_start_of_statement = TRUE{{$}}
20	.loc	1 1 0
21        nop
22# CHECK-NEXT: 0x0000000000201001: /tmp/b.c:1, is_start_of_statement = TRUE{{$}}
23        .loc   1 1 1
24        nop
25# CHECK-NEXT: 0x0000000000201002: /tmp/b.c:1:1, is_start_of_statement = TRUE{{$}}
26        .loc   1 2 0 is_stmt 0
27        nop
28# CHECK-NEXT: 0x0000000000201003: /tmp/b.c:2{{$}}
29        .loc   1 2 0 is_stmt 0 basic_block
30        nop
31# CHECK-NEXT: 0x0000000000201004: /tmp/b.c:2, is_start_of_basic_block = TRUE{{$}}
32        .loc   1 2 0 is_stmt 0 prologue_end
33        nop
34# CHECK-NEXT: 0x0000000000201005: /tmp/b.c:2, is_prologue_end = TRUE{{$}}
35        .loc   1 2 0 is_stmt 0 epilogue_begin
36        nop
37# CHECK-NEXT: 0x0000000000201006: /tmp/b.c:2, is_epilogue_begin = TRUE{{$}}
38	.file  2 "/tmp/c.c"
39	.loc   2 1 0 is_stmt 0
40        nop
41# CHECK-NEXT: 0x0000000000201007: /tmp/c.c:1{{$}}
42# CHECK-NEXT: 0x0000000000201008: /tmp/c.c:1, is_terminal_entry = TRUE{{$}}
43
44	.section	.text.f,"ax",@progbits
45f:
46        .loc   1 3 0 is_stmt 0
47        nop
48# CHECK-NEXT: 0x0000000000201008: /tmp/b.c:3{{$}}
49# CHECK-NEXT: 0x0000000000201009: /tmp/b.c:3, is_terminal_entry = TRUE{{$}}
50
51
52	.section	.debug_str,"MS",@progbits,1
53.Linfo_string1:
54	.asciz	"a.c"
55.Linfo_string2:
56	.asciz	"/tmp"
57	.section	.debug_abbrev,"",@progbits
58	.byte	1                       # Abbreviation Code
59	.byte	17                      # DW_TAG_compile_unit
60	.byte	0                       # DW_CHILDREN_no
61	.byte	19                      # DW_AT_language
62	.byte	5                       # DW_FORM_data2
63	.byte	3                       # DW_AT_name
64	.byte	14                      # DW_FORM_strp
65	.byte	16                      # DW_AT_stmt_list
66	.byte	23                      # DW_FORM_sec_offset
67	.byte	27                      # DW_AT_comp_dir
68	.byte	14                      # DW_FORM_strp
69	.byte	0                       # EOM(1)
70	.byte	0                       # EOM(2)
71	.byte	0                       # EOM(3)
72	.section	.debug_info,"",@progbits
73.Lcu_begin0:
74	.long	.Lcu_end0-.Lcu_start0   # Length of Unit
75.Lcu_start0:
76	.short	4                       # DWARF version number
77	.long	.debug_abbrev           # Offset Into Abbrev. Section
78	.byte	8                       # Address Size (in bytes)
79	.byte	1                       # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit
80	.short	12                      # DW_AT_language
81	.long	.Linfo_string1          # DW_AT_name
82	.long	.Lline_table_start0     # DW_AT_stmt_list
83	.long	.Linfo_string2          # DW_AT_comp_dir
84.Lcu_end0:
85	.section	.debug_line,"",@progbits
86.Lline_table_start0:
87