Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / llvm-dwarfutil / ELF / X86 / dwarf5-loclists.test
blob719944b3d224e581d0e2cfcf0c1ed24dc2b0e82e
1 ## Test that DWARFv5 .debug_loclists is correctly recognized
2 ## and converted into the DW_FORM_sec_offset form in --garbage-collection
3 ## case or correctly preserved in --no-garbage-collection case.
5 # RUN: yaml2obj %s -o %t.o
7 # RUN: llvm-dwarfutil %t.o %t1
8 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
9 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK
11 # RUN: llvm-dwarfutil --no-garbage-collection %t.o %t1
12 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
13 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
15 # RUN: llvm-dwarfutil --no-garbage-collection --build-accelerator=DWARF %t.o %t1
16 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
17 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
19 # RUN: llvm-dwarfutil --linker llvm %t.o %t1
20 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
21 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK
23 # RUN: llvm-dwarfutil --linker llvm --no-garbage-collection %t.o %t1
24 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
25 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
27 # RUN: llvm-dwarfutil --linker llvm --no-garbage-collection --build-accelerator=DWARF %t.o %t1
28 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
29 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
31 #CHECK: No errors.
33 #DWARF-CHECK: DW_TAG_compile_unit
34 #DWARF-CHECK: DW_AT_name {{.*}}"CU1"
35 #DWARF-CHECK-NOT: DW_AT_loclists_base
36 #DWARF-CHECK: DW_TAG_variable
37 #DWARF-CHECK: DW_AT_name {{.*}}"var1"
38 #DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset]      (0x0000000c:
39 #DWARF-CHECK: [0x0000000000001130, 0x0000000000001140): DW_OP_reg5 RDI)
40 #DWARF-CHECK: DW_AT_name {{.*}}"var2"
41 #DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset]     (0x00000014:
42 #DWARF-CHECK: <default>: DW_OP_reg5 RDI)
43 #DWARF-CHECK: DW_TAG_variable
44 #DWARF-CHECK: DW_AT_name {{.*}}"var3"
45 #DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset]     (0x00000018:
46 #DWARF-CHECK: [0x0000000000001140, 0x0000000000001150): DW_OP_reg5 RDI
47 #DWARF-CHECK: [0x0000000000001160, 0x0000000000001170): DW_OP_reg6 RBP)
49 #UPD-DWARF-CHECK: DW_TAG_compile_unit
50 #UPD-DWARF-CHECK:   DW_AT_name {{.*}}"CU1"
51 #UPD-DWARF-CHECK:              DW_AT_loclists_base [DW_FORM_sec_offset]  (0x0000000c)
52 #UPD-DWARF-CHECK:   DW_TAG_variable
53 #UPD-DWARF-CHECK:     DW_AT_name {{.*}}"var1"
54 #UPD-DWARF-CHECK:     DW_AT_location [DW_FORM_loclistx]       (indexed (0x0) loclist = 0x00000018:
55 #UPD-DWARF-CHECK:     [0x0000000000001130, 0x0000000000001140): DW_OP_reg5 RDI)
56 #UPD-DWARF-CHECK:   DW_TAG_variable
57 #UPD-DWARF-CHECK:     DW_AT_name {{.*}}"var2"
58 #UPD-DWARF-CHECK:     DW_AT_location [DW_FORM_loclistx]       (indexed (0x1) loclist = 0x0000001e:
59 #UPD-DWARF-CHECK:        <default>: DW_OP_reg5 RDI)
60 #UPD-DWARF-CHECK:   DW_TAG_variable
61 #UPD-DWARF-CHECK:     DW_AT_name {{.*}}"var3"
62 #UPD-DWARF-CHECK:     DW_AT_location [DW_FORM_loclistx]       (indexed (0x2) loclist = 0x00000022:
63 #UPD-DWARF-CHECK:        [0x0000000000001140, 0x0000000000001150): DW_OP_reg5 RDI
64 #UPD-DWARF-CHECK:        [0x0000000000001160, 0x0000000000001170): DW_OP_reg6 RBP)
66 ## Following yaml description has Content of the .debug_rnglists exactly like following data vvvvvvvvvvv
67 ## .debug_rnglists contents:
68 ## 0x00000000: range list header: length = 0x0000003e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000005
69 ## offsets: [
70 ## 0x00000014 => 0x00000020
71 ## 0x00000018 => 0x00000024
72 ## 0x0000001c => 0x00000028
73 ## 0x00000027 => 0x00000033
74 ## 0x00000032 => 0x0000003e
75 ## ]
76 ## ranges:
77 ## 0x00000020: [DW_RLE_startx_length]:  0x0000000000000000, 0x0000000000000010 => [0x0000000000001130, 0x0000000000001140)
78 ## 0x00000023: [DW_RLE_end_of_list  ]
79 ## 0x00000024: [DW_RLE_startx_length]:  0x0000000000000001, 0x0000000000000010 => [0x0000000000001140, 0x0000000000001150)
80 ## 0x00000027: [DW_RLE_end_of_list  ]
81 ## 0x00000028: [DW_RLE_start_length ]:  0x0000000000001150, 0x0000000000000010 => [0x0000000000001150, 0x0000000000001160)
82 ## 0x00000032: [DW_RLE_end_of_list  ]
83 ## 0x00000033: [DW_RLE_start_length ]:  0x0000000000001160, 0x0000000000000010 => [0x0000000000001160, 0x0000000000001170)
84 ## 0x0000003d: [DW_RLE_end_of_list  ]
85 ## 0x0000003e: [DW_RLE_startx_length]:  0x0000000000000000, 0x0000000000000040 => [0x0000000000001130, 0x0000000000001170)
86 ## 0x00000041: [DW_RLE_end_of_list  ]
89 ## Following yaml description has Content of the .debug_loclists exactly like following data vvvvvvvvvvv
90 ## .debug_loclists contents:
91 ## 0x00000000: locations list header: length = 0x00000029, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000003
92 ## offsets: [
93 ## 0x0000000c => 0x00000018
94 ## 0x00000012 => 0x0000001e
95 ## 0x00000016 => 0x00000022
96 ## ]
97 ## 0x00000018:
98 ##             DW_LLE_startx_length   (0x0000000000000000, 0x0000000000000010): DW_OP_reg5 RDI
99 ##             DW_LLE_end_of_list     ()
101 ## 0x0000001e:
102 ##             DW_LLE_default_location()
103 ##                       => <default>: DW_OP_reg5 RDI
104 ##             DW_LLE_end_of_list     ()
106 ## 0x00000022:
107 ##             DW_LLE_startx_length   (0x0000000000000001, 0x0000000000000010): DW_OP_reg5 RDI
108 ##             DW_LLE_startx_length   (0x0000000000000003, 0x0000000000000010): DW_OP_reg6 RBP
109 ##             DW_LLE_end_of_list     ()
111 --- !ELF
112 FileHeader:
113   Class:    ELFCLASS64
114   Data:     ELFDATA2LSB
115   Type:     ET_REL
116   Machine:  EM_X86_64
117 Sections:
118   - Name:            .text
119     Type:            SHT_PROGBITS
120     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
121     Address:         0x1130
122     Size:            0x70
123   - Name:            .debug_rnglists
124     Type:            SHT_PROGBITS
125     Flags:           [  ]
126     Content:        "3e000000050008000500000014000000180000001c000000270000003200000003001000030110000750110000000000001000076011000000000000100003004000"
127   - Name:            .debug_loclists
128     Type:            SHT_PROGBITS
129     Flags:           [  ]
130     Content:        "2900000005000800030000000c0000001200000016000000030010015500050155000301100155030310015600"
131 DWARF:
132   debug_abbrev:
133     - Table:
134       - Tag:      DW_TAG_compile_unit
135         Children: DW_CHILDREN_yes
136         Attributes:
137           - Attribute: DW_AT_producer
138             Form:      DW_FORM_string
139           - Attribute: DW_AT_language
140             Form:      DW_FORM_data2
141           - Attribute: DW_AT_name
142             Form:      DW_FORM_string
143           - Attribute: DW_AT_low_pc
144             Form:      DW_FORM_addrx
145           - Attribute: DW_AT_ranges
146             Form:      DW_FORM_rnglistx
147           - Attribute: DW_AT_rnglists_base
148             Form:      DW_FORM_sec_offset
149           - Attribute: DW_AT_loclists_base
150             Form:      DW_FORM_sec_offset
151           - Attribute: DW_AT_addr_base
152             Form:      DW_FORM_sec_offset
153       - Tag:      DW_TAG_base_type
154         Children: DW_CHILDREN_no
155         Attributes:
156           - Attribute: DW_AT_name
157             Form:      DW_FORM_string
158       - Tag:      DW_TAG_variable
159         Children: DW_CHILDREN_no
160         Attributes:
161           - Attribute: DW_AT_name
162             Form:      DW_FORM_string
163           - Attribute: DW_AT_const_value
164             Form:      DW_FORM_data4
165           - Attribute: DW_AT_type
166             Form:      DW_FORM_ref_addr
167           - Attribute: DW_AT_location
168             Form:      DW_FORM_loclistx
169   debug_info:
170     - Version: 5
171       UnitType:   DW_UT_compile
172       Entries:
173         - AbbrCode: 1
174           Values:
175             - CStr: by_hand
176             - Value:  0x04
177             - CStr: CU1
178             - Value:  0x0
179             - Value:  0x4
180             - Value:  0xc
181             - Value:  0xc
182             - Value:  0x8
183         - AbbrCode: 2
184           Values:
185             - CStr: int
186         - AbbrCode: 3
187           Values:
188             - CStr: var1
189             - Value:  0x00000000
190             - Value:  0x00000029
191             - Value:  0x0
192         - AbbrCode: 3
193           Values:
194             - CStr: var2
195             - Value:  0x00000000
196             - Value:  0x00000029
197             - Value:  0x1
198         - AbbrCode: 3
199           Values:
200             - CStr: var3
201             - Value:  0x00000000
202             - Value:  0x00000029
203             - Value:  0x2
204         - AbbrCode: 0
205   debug_addr:
206     - Version: 5
207       AddressSize: 0x08
208       Entries:
209         - Address: 0x1130
210         - Address: 0x1140
211         - Address: 0x1150
212         - Address: 0x1160