1## Show that llvm-dwarfdump dumps the whole .debug_line section when
2## --debug-line is specified.
3
4# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o
5# RUN: llvm-dwarfdump --debug-line %t.o | FileCheck %s --match-full-lines
6
7# CHECK:      .debug_line contents:
8# CHECK-NEXT: debug_line[0x00000000]
9# CHECK-NEXT: Line table prologue:
10# CHECK-NEXT:     total_length: 0x00000069
11# CHECK-NEXT:           format: DWARF32
12# CHECK-NEXT:          version: 5
13# CHECK-NEXT:     address_size: 8
14# CHECK-NEXT:  seg_select_size: 0
15# CHECK-NEXT:  prologue_length: 0x0000004c
16# CHECK-NEXT:  min_inst_length: 1
17# CHECK-NEXT: max_ops_per_inst: 1
18# CHECK-NEXT:  default_is_stmt: 1
19# CHECK-NEXT:        line_base: -5
20# CHECK-NEXT:       line_range: 7
21# CHECK-NEXT:      opcode_base: 14
22# CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0
23# CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1
24# CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1
25# CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1
26# CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1
27# CHECK-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
28# CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
29# CHECK-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
30# CHECK-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
31# CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
32# CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
33# CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1
34# CHECK-NEXT: standard_opcode_lengths[DW_LNS_unknown_d] = 0
35# CHECK-NEXT: include_directories[  0] = "dir1/dir2"
36# CHECK-NEXT: file_names[  0]:
37# CHECK-NEXT:            name: "file1.c"
38# CHECK-NEXT:       dir_index: 2
39# CHECK-NEXT:        mod_time: 0x12345678
40# CHECK-NEXT:          length: 0x00000010
41# CHECK-EMPTY:
42# CHECK-NEXT: Address            Line   Column File   ISA Discriminator Flags
43# CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- -------------
44# CHECK-NEXT: 0x0000000000000002      1      0      1   0             0  is_stmt
45# CHECK-NEXT: 0x0000000000000002      1      4      3   0             0  is_stmt
46# CHECK-NEXT: 0x0000000000000024      1      4      3   5             6  basic_block prologue_end epilogue_begin end_sequence
47# CHECK-EMPTY:
48# CHECK-NEXT: debug_line[0x0000006d]
49# CHECK-NEXT: Line table prologue:
50# CHECK-NEXT:     total_length: 0x0000001b
51# CHECK-NEXT:           format: DWARF32
52# CHECK-NEXT:          version: 4
53# CHECK-NEXT:  prologue_length: 0x00000015
54# CHECK-NEXT:  min_inst_length: 2
55# CHECK-NEXT: max_ops_per_inst: 4
56# CHECK-NEXT:  default_is_stmt: 0
57# CHECK-NEXT:        line_base: 42
58# CHECK-NEXT:       line_range: 10
59# CHECK-NEXT:      opcode_base: 2
60# CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 42
61# CHECK-NEXT: include_directories[  1] = "baz"
62# CHECK-NEXT: file_names[  1]:
63# CHECK-NEXT:            name: "foo.c"
64# CHECK-NEXT:       dir_index: 1
65# CHECK-NEXT:        mod_time: 0x00000011
66# CHECK-NEXT:          length: 0x00000022
67# CHECK-EMPTY:
68# CHECK-NEXT: debug_line[0x0000008c]
69
70.section .debug_line,"",@progbits
71    .long .Lunit0_end - .Lunit0_begin ## unit_length
72.Lunit0_begin:
73    .short 5 ## version
74    .byte 8  ## address_size
75    .byte 0  ## segment_selector_size
76    .long .Lheader0_end - .Lheader0_begin ## header_length
77.Lheader0_begin:
78    .byte 1  ## minimum_instruction_length
79    .byte 1  ## maximum_operations_per_instruction
80    .byte 1  ## default_is_stmt
81    .byte -5 ## line_base
82    .byte 7  ## line_range
83    ## Use an opcode_base > than the last standard opcode to show that unknown
84    ## standard opcodes can be handled.
85    .byte 14 ## opcode_base
86    .byte 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0 ## standard_opcode_lengths
87    .byte 2  ## directory_entry_format_count
88    ## Use two formats to show that only the path is included in the output.
89    .byte 0x1, 0x8 ## DW_LNCT_path, DW_FORM_string
90    .byte 0x4, 0x5 ## DW_LNCT_size, DW_FORM_data2
91    .byte 1  ## directories_count
92    .asciz "dir1/dir2" ## directory entry 0
93    .short 0x1234
94    .byte 4  ## file_name_entry_format_count
95    .byte 0x4, 0x1E ## DW_LNCT_MD5, DW_FORM_data16
96    .byte 0x3, 0x6  ## DW_LNCT_timestamp, DW_FORM_data4
97    .byte 0x2, 0xB  ## DW_LNCT_directory_index, DW_FORM_data1
98    .byte 0x1, 0x8  ## DW_LNCT_path, DW_FORM_string
99    .byte 1  ## file_names_count
100    .quad 0x1111222233334444, 0x5555666677778888 ## file name entry 0
101    .long 0x12345678
102    .byte 2
103    .asciz "file1.c"
104.Lheader0_end:
105    .byte 0x21 ## Special opcode - shows line printed after special opcode.
106    .byte 0x4  ## DW_LNS_set_file - shows file can be changed to an arbitrary value.
107    .byte 3
108    .byte 0x5  ## DW_LNS_set_column - shows column can be changed.
109    .byte 4
110    .byte 0x1  ## DW_LNS_copy - shows line printed after copy opcode.
111    .byte 0x8  ## DW_LNS_const_add_pc - shows address can be changed.
112    .byte 0xC  ## DW_LNS_set_isa - shows isa register value can be changed.
113    .byte 5
114    .byte 0, 0x2, 0x4 ## DW_LNE_set_discriminator - shows discriminator can be changed.
115    .byte 6
116    ## These lines all show that the printed boolean register values can be changed.
117    .byte 0x6  ## DW_LNS_negate_stmt
118    .byte 0x7  ## DW_LNS_set_basic_block
119    .byte 0xA  ## DW_LNS_set_prologue_end
120    .byte 0xB  ## DW_LNS_set_epilogue_begin
121
122    .byte 0xD  ## DW_LNS_unknown - shows that unknown opcodes do not affect state.
123    .byte 0, 0x1, 0x1 ## DW_LNE_end_sequence
124.Lunit0_end:
125
126## Second line table program with version 4 and no sequences.
127    .long .Lunit1_end - .Lunit1_begin ## unit_length
128.Lunit1_begin:
129    .short 4 ## version
130    .long .Lheader1_end - .Lheader1_begin ## header_length
131.Lheader1_begin:
132    .byte 2  ## minimum_instruction_length
133    .byte 4  ## maximum_operations_per_instruction
134    .byte 0  ## default_is_stmt
135    .byte 42 ## line_base
136    .byte 10 ## line_range
137    .byte 2  ## opcode_base - lower than normal to show this can be handled.
138    .byte 42 ## standard_opcode_lengths - different to normal.
139    ## include_directories
140    .asciz "baz"
141    .byte 0
142    ## file_names
143    .asciz "foo.c"
144    .byte 1    ## Directory index
145    .byte 0x11 ## Timestamp
146    .byte 0x22 ## Length
147.Lheader1_end:
148.Lunit1_end:
149
150## Third line table program needed to show that only a single blank line is
151## printed after a program with no sequences. The values in this table are
152## arbitrary.
153    .long .Lunit2_end - .Lunit2_begin ## unit_length
154.Lunit2_begin:
155    .short 4 ## version
156    .long .Lheader2_end - .Lheader2_begin ## header_length
157.Lheader2_begin:
158    .byte 1 ## minimum_instruction_length
159    .byte 2 ## maximum_operations_per_instruction
160    .byte 1 ## default_is_stmt
161    .byte 1 ## line_base
162    .byte 1 ## line_range
163    .byte 2 ## opcode_base
164    .byte 1 ## standard_opcode_lengths
165    ## include_directories
166    .byte 0
167    ## file_names
168    .asciz "bar.c"
169    .byte 0 ## Directory index
170    .byte 0 ## Timestamp
171    .byte 0 ## Length
172.Lheader2_end:
173    .byte 0, 0x1, 0x1 ## DW_LNE_end_sequence
174.Lunit2_end:
175