1# Test object to verify dwarfdump handles dumping a DWARF v5 line table
2# without an associated unit.
3#
4# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
5# RUN: llvm-dwarfdump -v - | FileCheck %s
6
7        .section .text
8        # Dummy function
9foo:    ret
10
11        .section .debug_line,"",@progbits
12# CHECK-LABEL: .debug_line contents:
13
14# DWARF v5 line-table header.
15LH_5_start:
16        .long   LH_5_end-LH_5_version   # Length of Unit (DWARF-32 format)
17LH_5_version:
18        .short  5               # DWARF version number
19        .byte   8               # Address Size
20        .byte   0               # Segment Selector Size
21        .long   LH_5_header_end-LH_5_params     # Length of Prologue
22LH_5_params:
23        .byte   1               # Minimum Instruction Length
24        .byte   1               # Maximum Operations per Instruction
25        .byte   1               # Default is_stmt
26        .byte   -5              # Line Base
27        .byte   14              # Line Range
28        .byte   13              # Opcode Base
29        .byte   0               # Standard Opcode Lengths
30        .byte   1
31        .byte   1
32        .byte   1
33        .byte   1
34        .byte   0
35        .byte   0
36        .byte   0
37        .byte   1
38        .byte   0
39        .byte   0
40        .byte   1
41        # Directory table format
42        .byte   1               # One element per directory entry
43        .byte   1               # DW_LNCT_path
44        .byte   0x0e            # DW_FORM_strp (-> .debug_str)
45        # Directory table entries
46        .byte   2               # Two directory entries
47        .long   str_D1
48        .long   str_D2
49        # File table format
50        .byte   4               # Four elements per file entry
51        .byte   2               # DW_LNCT_directory_index
52        .byte   0x0b            # DW_FORM_data1
53        .byte   1               # DW_LNCT_path
54        .byte   0x1f            # DW_FORM_line_strp (-> .debug_line_str)
55        .byte   3               # DW_LNCT_timestamp
56        .byte   0x0f            # DW_FORM_udata
57        .byte   4               # DW_LNCT_size
58        .byte   0x0f            # DW_FORM_udata
59        # File table entries
60        .byte   2               # Two file entries
61        .byte   1
62        .long   ls_F1
63        .byte   0x51
64        .byte   0x52
65        .byte   0
66        .long   ls_F2
67        .byte   0x53
68        .byte   0x54
69LH_5_header_end:
70        # Minimal line number program with an address in it, which shows
71        # we picked up the address size from the line-table header.
72        .byte   0
73        .byte   9
74        .byte   2               # DW_LNE_set_address
75        .quad   .text
76        .byte   0
77        .byte   1
78        .byte   1               # DW_LNE_end_sequence
79LH_5_end:
80
81        .section .debug_str,"MS",@progbits,1
82str_D1: .asciz  "Directory1"
83str_D2: .asciz  "Directory2"
84
85        .section .debug_line_str,"MS",@progbits,1
86ls_F1:  .asciz "File1"
87ls_F2:  .asciz "File2"
88
89# CHECK: Line table prologue:
90# CHECK: version: 5
91# CHECK: address_size: 8
92# CHECK: seg_select_size: 0
93# CHECK: max_ops_per_inst: 1
94# CHECK: include_directories[  0] = .debug_str[0x00000000] = "Directory1"
95# CHECK: include_directories[  1] = .debug_str[0x0000000b] = "Directory2"
96# CHECK-NOT: include_directories
97# CHECK: file_names[  0]:
98# CHECK-NEXT: name: .debug_line_str[0x00000000] = "File1"
99# CHECK-NEXT: dir_index: 1
100# CHECK-NEXT: mod_time: 0x00000051
101# CHECK-NEXT: length: 0x00000052
102# CHECK: file_names[  1]:
103# CHECK-NEXT: name: .debug_line_str[0x00000006] = "File2"
104# CHECK-NEXT: dir_index: 0
105# CHECK-NEXT: mod_time: 0x00000053
106# CHECK-NEXT: length: 0x00000054
107# CHECK-NOT: file_names
108# CHECK: 0x0000000000000000 {{.*}} is_stmt end_sequence
109