1 ## Test that yaml2obj emits a .debug_rnglists section when requested.
3 ## a) Generate and verify a little endian DWARF32 .debug_rnglists section in a 64-bit object file.
5 # RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2LSB %s -o %t1.le.dwarf32.o
6 # RUN: llvm-readobj --sections --section-data %t1.le.dwarf32.o | \
7 # RUN: FileCheck -DSIZE=99 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-LE
10 # SHDR-NEXT: Name: .debug_rnglists (1)
11 # SHDR-NEXT: Type: SHT_PROGBITS (0x1)
12 # SHDR-NEXT: Flags [ (0x0)
14 # SHDR-NEXT: Address: 0x0
15 # SHDR-NEXT: Offset: 0x40
16 # SHDR-NEXT: Size: [[SIZE]]
19 # SHDR-NEXT: AddressAlignment: [[ADDRALIGN]]
20 # SHDR-NEXT: EntrySize: 0
21 # DWARF32-LE-NEXT: SectionData (
22 # DWARF32-LE-NEXT: 0000: 24000000 05000800 02000000 08000000 |$...............|
23 ## ^------- unit_length (4-byte)
24 ## ^--- version (2-byte)
25 ## ^- address_size (1-byte)
26 ## ^- segment_selector_size (1-byte)
27 ## ^------- offset_entry_count (4-byte)
28 ## ^------- offsets[0] (4-byte)
29 # DWARF32-LE-NEXT: 0010: 11000000 01B42402 B424B424 0003B424 |......$..$.$...$|
30 ## ^------- offsets[1] (4-byte)
31 ## ^- DW_RLE_base_addressx (1-byte)
32 ## ^--- operands[0] (ULEB128) 0x1234
33 ## ^- DW_RLE_startx_endx (1-byte)
34 ## ^--- operands[0] (ULEB128) 0x1234
35 ## ^--- operands[1] (ULEB128) 0x1234
36 ## ^- DW_RLE_end_of_list (1-byte)
37 ## ^- DW_RLE_startx_length (1-byte)
38 ## ^--- operands[0] (ULEB128) 0x1234
39 # DWARF32-LE-NEXT: 0020: B42404B4 24B42400 37000000 05000800 |.$..$.$.7.......|
40 ## ^--- operands[1] (ULEB128) 0x1234
41 ## ^- DW_RLE_offset_pair (1-byte)
42 ## ^---- operands[0] (ULEB128) 0x1234
43 ## ^--- operands[1] (ULEB128) 0x1234
44 ## ^- DW_RLE_end_of_list (1-byte)
45 ## ^------- unit_length (4-byte)
46 ## ^--- version (2-byte)
47 ## ^- address_size (1-byte)
48 ## ^- segment_selector_size (1-byte)
49 # DWARF32-LE-NEXT: 0030: 02000000 08000000 23000000 05341200 |........#....4..|
50 ## ^------- offset_entry_count (4-byte)
51 ## ^------- offsets[0] (4-byte)
52 ## ^------- offsets[1] (4-byte)
53 ## ^- DW_RLE_base_address (1-byte)
54 ## ^----- operands[0] (8-byte)
55 # DWARF32-LE-NEXT: 0040: 00000000 00063412 00000000 00003412 |......4.......4.|
57 ## ^- DW_RLE_start_end (1-byte)
58 ## ^----------------- operands[0] (8-byte)
59 ## ^--- operands[1] (8-byte)
60 # DWARF32-LE-NEXT: 0050: 00000000 00000007 34120000 00000000 |........4.......|
62 ## ^- DW_RLE_end_of_list (1-byte)
63 ## ^- DW_RLE_start_length (1-byte)
64 ## ^---------------- operands[0] (8-byte)
65 # DWARF32-LE-NEXT: 0060: B42400 |.$.|
66 ## ^--- operands[1] (ULEB128) 0x1234
67 ## ^- DW_RLE_end_of_list (1-byte)
79 - Operator: DW_RLE_base_addressx
81 - Operator: DW_RLE_startx_endx
82 Values: [ 0x1234, 0x1234 ]
83 - Operator: DW_RLE_end_of_list
85 - Operator: DW_RLE_startx_length
86 Values: [ 0x1234, 0x1234 ]
87 - Operator: DW_RLE_offset_pair
88 Values: [ 0x1234, 0x1234 ]
89 - Operator: DW_RLE_end_of_list
92 - Operator: DW_RLE_base_address
94 - Operator: DW_RLE_start_end
95 Values: [ 0x1234, 0x1234 ]
96 - Operator: DW_RLE_end_of_list
98 - Operator: DW_RLE_start_length
99 Values: [ 0x1234, 0x1234 ]
100 - Operator: DW_RLE_end_of_list
102 ## b) Generate and verify a big endian DWARF32 .debug_rnglists section in a 64-bit object file.
104 # RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2MSB %s -o %t1.be.dwarf32.o
105 # RUN: llvm-readobj --sections --section-data %t1.be.dwarf32.o | \
106 # RUN: FileCheck -DSIZE=99 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-BE
108 # DWARF32-BE-NEXT: SectionData (
109 # DWARF32-BE-NEXT: 0000: 00000024 00050800 00000002 00000008 |...$............|
110 ## ^------- unit_length (4-byte)
111 ## ^--- version (2-byte)
112 ## ^- address_size (1-byte)
113 ## ^- segment_selector_size (1-byte)
114 ## ^------- offset_entry_count (4-byte)
115 ## ^------- offsets[0] (4-byte)
116 # DWARF32-BE-NEXT: 0010: 00000011 01B42402 B424B424 0003B424 |......$..$.$...$|
117 ## ^------- offsets[1] (4-byte)
118 ## ^- DW_RLE_base_addressx (1-byte)
119 ## ^--- operands[0] (ULEB128) 0x1234
120 ## ^- DW_RLE_startx_endx (1-byte)
121 ## ^--- operands[0] (ULEB128) 0x1234
122 ## ^--- operands[1] (ULEB128) 0x1234
123 ## ^- DW_RLE_end_of_list (1-byte)
124 ## ^- DW_RLE_startx_length (1-byte)
125 ## ^--- operands[0] (ULEB128) 0x1234
126 # DWARF32-BE-NEXT: 0020: B42404B4 24B42400 00000037 00050800 |.$..$.$....7....|
127 ## ^--- operands[1] (ULEB128) 0x1234
128 ## ^- DW_RLE_offset_pair (1-byte)
129 ## ^---- operands[0] (ULEB128) 0x1234
130 ## ^--- operands[1] (ULEB128) 0x1234
131 ## ^- DW_RLE_end_of_list (1-byte)
132 ## ^------- unit_length (4-byte)
133 ## ^--- version (2-byte)
134 ## ^- address_size (1-byte)
135 ## ^- segment_selector_size (1-byte)
136 # DWARF32-BE-NEXT: 0030: 00000002 00000008 00000023 05000000 |...........#....|
137 ## ^------- offset_entry_count (4-byte)
138 ## ^------- offsets[0] (4-byte)
139 ## ^------- offsets[1] (4-byte)
140 ## ^- DW_RLE_base_address (1-byte)
141 ## ^----- operands[0] (8-byte)
142 # DWARF32-BE-NEXT: 0040: 00000012 34060000 00000000 12340000 |....4........4..|
144 ## ^- DW_RLE_start_end (1-byte)
145 ## ^----------------- operands[0] (8-byte)
146 ## ^--- operands[1] (8-byte)
147 # DWARF32-BE-NEXT: 0050: 00000000 12340007 00000000 00001234 |.....4.........4|
149 ## ^- DW_RLE_end_of_list (1-byte)
150 ## ^- DW_RLE_start_length (1-byte)
151 ## ^---------------- operands[0] (8-byte)
152 # DWARF32-BE-NEXT: 0060: B42400 |.$.|
153 ## ^--- operands[1] (ULEB128) 0x1234
154 ## ^- DW_RLE_end_of_list (1-byte)
157 ## c) Generate and verify a little endian DWARF64 .debug_rnglists section in a 64-bit object file.
159 # RUN: yaml2obj --docnum=2 -DENDIAN=ELFDATA2LSB %s -o %t2.le.dwarf64.o
160 # RUN: llvm-readobj --sections --section-data %t2.le.dwarf64.o | \
161 # RUN: FileCheck -DSIZE=38 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF64-LE
163 # DWARF64-LE-NEXT: SectionData (
164 # DWARF64-LE-NEXT: 0000: FFFFFFFF 1A000000 00000000 05000800 |................|
165 ## ^------------------------- unit_length (12-byte)
166 ## ^--- version (2-byte)
167 ## ^- address_size (1-byte)
168 ## ^- segment_selector_size (1-byte)
169 # DWARF64-LE-NEXT: 0010: 02000000 10000000 00000000 11000000 |................|
170 ## ^------- offset_entry_count (4-byte)
171 ## ^---------------- offsets[0] (8-byte)
172 ## ^------- offsets[1] (8-byte)
173 # DWARF64-LE-NEXT: 0020: 00000000 0000 |......|
175 ## ^- DW_RLE_end_of_list (1-byte)
176 ## ^- DW_RLE_end_of_list (1-byte)
189 - Operator: DW_RLE_end_of_list
191 - Operator: DW_RLE_end_of_list
193 ## d) Generate and verify a big endian DWARF64 .debug_rnglists section in a 64-bit object file.
195 # RUN: yaml2obj --docnum=2 -DENDIAN=ELFDATA2MSB %s -o %t2.be.dwarf64.o
196 # RUN: llvm-readobj --sections --section-data %t2.be.dwarf64.o | \
197 # RUN: FileCheck -DSIZE=38 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF64-BE
199 # DWARF64-BE-NEXT: SectionData (
200 # DWARF64-BE-NEXT: 0000: FFFFFFFF 00000000 0000001A 00050800 |................|
201 ## ^------------------------- unit_length (12-byte)
202 ## ^--- version (2-byte)
203 ## ^- address_size (1-byte)
204 ## ^- segment_selector_size (1-byte)
205 # DWARF64-BE-NEXT: 0010: 00000002 00000000 00000010 00000000 |................|
206 ## ^------- offset_entry_count (4-byte)
207 ## ^---------------- offsets[0] (8-byte)
208 ## ^------- offsets[1] (8-byte)
209 # DWARF64-BE-NEXT: 0020: 00000011 0000 |......|
211 ## ^- DW_RLE_end_of_list (1-byte)
212 ## ^- DW_RLE_end_of_list (1-byte)
215 ## e) Test that the length, version, segment_selector_size, address_size, offset_entry_count
216 ## and offsets fields can be specified manually.
218 # RUN: yaml2obj --docnum=3 %s -o %t3.o
219 # RUN: llvm-readelf --hex-dump=.debug_rnglists %t3.o | \
220 # RUN: FileCheck %s --check-prefix=OVERWRITE
222 # OVERWRITE: Hex dump of section '.debug_rnglists':
223 # OVERWRITE-NEXT: 0x00000000 34120000 06000303 04000000 01000000 4...............
224 ## ^------- unit_length (4-byte)
225 ## ^--- version (2-byte)
226 ## ^- address_size (1-byte)
227 ## ^- segment_selector_size (1-byte)
228 ## ^------- offset_entry_count (4-byte)
229 ## ^------- offsets[0] (4-byte)
230 # OVERWRITE-NEXT: 0x00000010 0000 ..
242 SegmentSelectorSize: 3
247 - Operator: DW_RLE_end_of_list
249 - Operator: DW_RLE_end_of_list
251 ## f) Test that the default value of the address_size field in a 32-bit object file is 4.
253 # RUN: yaml2obj --docnum=4 %s -o %t4.o
254 # RUN: llvm-readelf --hex-dump=.debug_rnglists %t4.o | \
255 # RUN: FileCheck %s --check-prefix=ADDRSIZE32
257 # ADDRSIZE32: Hex dump of section '.debug_rnglists':
258 # ADDRSIZE32-NEXT: 0x00000000 22000000 05000400 01000000 04000000 "...............
259 ## ^- address_size (1-byte)
260 # ADDRSIZE32-NEXT: 0x00000010 05341200 00063412 00002143 00000734 .4....4...!C...4
261 ## ^- DW_RLE_base_address (1-byte)
262 ## ^-------- operands[0] (4-byte)
263 ## ^- DW_RLE_start_end (1-byte)
264 ## ^-------- operands[0] (4-byte)
265 ## ^-------- operands[1] (4-byte)
266 ## ^- DW_RLE_start_length (1-byte)
267 ## ^- operands[0] (4-byte)
268 # ADDRSIZE32-NEXT: 0x00000020 120000a1 8601 ......
270 ## ^------ operands[1] (ULEB128) 0x4321
281 - Operator: DW_RLE_base_address
283 - Operator: DW_RLE_start_end
284 Values: [ 0x1234, 0x4321 ]
285 - Operator: DW_RLE_start_length
286 Values: [ 0x1234, 0x4321 ]
288 ## g) Test that the address_size field can be specified manually and the size of
289 ## corresponding operands will be changed accordingly.
291 # RUN: yaml2obj --docnum=5 %s -o %t5.o
292 # RUN: llvm-readelf --hex-dump=.debug_rnglists %t5.o | \
293 # RUN: FileCheck %s --check-prefix=ADDRSIZE
295 # ADDRSIZE: Hex dump of section '.debug_rnglists':
296 # ADDRSIZE-NEXT: 0x00000000 22000000 05000400 01000000 04000000 "...............
297 ## ^- address_size 0x04
298 # ADDRSIZE-NEXT: 0x00000010 05341200 00063412 00002143 00000734 .4....4...!C...4
299 ## ^- DW_RLE_base_address
300 ## ^-------- operands[0] (4-byte)
301 ## ^- DW_RLE_start_end
302 ## ^-------- operands[0] (4-byte)
303 ## ^-------- operands[1] (4-byte)
304 ## ^- DW_RLE_start_length
305 ## ^- operands[0] (4-byte)
306 # ADDRSIZE-NEXT: 0x00000020 120000b4 2400 ....$.
308 ## ^---- operands[1] (ULEB128)
309 ## ^- DW_RLE_end_of_list
321 - Operator: DW_RLE_base_address
323 - Operator: DW_RLE_start_end
324 Values: [ 0x1234, 0x4321 ]
325 - Operator: DW_RLE_start_length
326 Values: [ 0x1234, 0x1234 ]
327 - Operator: DW_RLE_end_of_list
329 ## h) Test that yaml2obj emits an error message if we try to assign an invalid value to
330 ## 'AddressSize' when there is an entry whose operands contain address.
332 # RUN: not yaml2obj -DOPERATOR=base_address -DVALUES=[0x01] --docnum=6 %s 2>&1 | \
333 # RUN: FileCheck -DOPERATOR=base_address %s --check-prefix=INVALID-ADDRSIZE
335 # RUN: not yaml2obj -DOPERATOR=start_end -DVALUES=[0x01,0x02] --docnum=6 %s 2>&1 | \
336 # RUN: FileCheck -DOPERATOR=start_end %s --check-prefix=INVALID-ADDRSIZE
338 # RUN: not yaml2obj -DOPERATOR=start_length -DVALUES=[0x01,0x02] --docnum=6 %s 2>&1 | \
339 # RUN: FileCheck -DOPERATOR=start_length %s --check-prefix=INVALID-ADDRSIZE
341 # INVALID-ADDRSIZE: yaml2obj: error: unable to write address for the operator DW_RLE_[[OPERATOR]]: invalid integer write size: 3
353 - Operator: DW_RLE_[[OPERATOR]]
356 ## i) Test that an invalid address_size can be used when there are no address-using operators.
358 # RUN: yaml2obj --docnum=7 %s -o %t7.o
359 # RUN: llvm-readelf --hex-dump=.debug_rnglists %t7.o | \
360 # RUN: FileCheck %s --check-prefix=ADDRSIZE-NOERROR
362 # ADDRSIZE-NOERROR: Hex dump of section '.debug_rnglists':
363 # ADDRSIZE-NOERROR-NEXT: 0x00000000 0e000000 05000300 01000000 04000000 ................
364 ## ^- address_size (1-byte) 0x03
365 # ADDRSIZE-NOERROR-NEXT: 0x00000010 0101 ..
377 - Operator: DW_RLE_base_addressx
380 ## j) Test that yaml2obj emits an error message if we specify invalid numbers of operands
383 # RUN: not yaml2obj -DOPERATOR=end_of_list -DVALUES=[0x01] --docnum=8 %s 2>&1 | \
384 # RUN: FileCheck -DOPERATOR=end_of_list -DACTUAL=1 -DEXPECTED=0 %s --check-prefix=INVALID-OPERANDS
386 # RUN: not yaml2obj -DOPERATOR=base_addressx -DVALUES=[] --docnum=8 %s 2>&1 | \
387 # RUN: FileCheck -DOPERATOR=base_addressx -DACTUAL=0 -DEXPECTED=1 %s --check-prefix=INVALID-OPERANDS
389 # RUN: not yaml2obj -DOPERATOR=startx_endx -DVALUES=[0x01] --docnum=8 %s 2>&1 | \
390 # RUN: FileCheck -DOPERATOR=startx_endx -DACTUAL=1 -DEXPECTED=2 %s --check-prefix=INVALID-OPERANDS
392 # RUN: not yaml2obj -DOPERATOR=startx_length -DVALUES=[0x01] --docnum=8 %s 2>&1 | \
393 # RUN: FileCheck -DOPERATOR=startx_length -DACTUAL=1 -DEXPECTED=2 %s --check-prefix=INVALID-OPERANDS
395 # RUN: not yaml2obj -DOPERATOR=offset_pair -DVALUES=[] --docnum=8 %s 2>&1 | \
396 # RUN: FileCheck -DOPERATOR=offset_pair -DACTUAL=0 -DEXPECTED=2 %s --check-prefix=INVALID-OPERANDS
398 # RUN: not yaml2obj -DOPERATOR=base_address -DVALUES=[0x01,0x02] --docnum=8 %s 2>&1 | \
399 # RUN: FileCheck -DOPERATOR=base_address -DACTUAL=2 -DEXPECTED=1 %s --check-prefix=INVALID-OPERANDS
401 # RUN: not yaml2obj -DOPERATOR=start_end -DVALUES=[0x01,0x02,0x03] --docnum=8 %s 2>&1 | \
402 # RUN: FileCheck -DOPERATOR=start_end -DACTUAL=3 -DEXPECTED=2 %s --check-prefix=INVALID-OPERANDS
404 # RUN: not yaml2obj -DOPERATOR=start_length -DVALUES=[0x01] --docnum=8 %s 2>&1 | \
405 # RUN: FileCheck -DOPERATOR=start_length -DACTUAL=1 -DEXPECTED=2 %s --check-prefix=INVALID-OPERANDS
407 # INVALID-OPERANDS: yaml2obj: error: invalid number ([[ACTUAL]]) of operands for the operator: DW_RLE_[[OPERATOR]], [[EXPECTED]] expected
419 - Operator: DW_RLE_[[OPERATOR]]
422 ## k) Test that an empty list is allowed for a range list table.
424 # RUN: yaml2obj --docnum=9 %s -o %t9.o
425 # RUN: llvm-readelf --hex-dump=.debug_rnglists %t9.o | \
426 # RUN: FileCheck %s --check-prefix=EMPTY-LIST
428 # EMPTY-LIST: Hex dump of section '.debug_rnglists':
429 # EMPTY-LIST-NEXT: 0x00000000 08000000 05000800 00000000 ............
430 ## ^------- unit_length (4-byte)
431 ## ^--- version (2-byte)
432 ## ^--- address_size (1-byte)
433 ## ^------- offset_entry_count (4-byte)
444 ## l) Generate the .debug_rnglists section from raw section content.
446 # RUN: yaml2obj --docnum=10 %s -o %t10.o
447 # RUN: llvm-readobj --sections --section-data %t10.o | \
448 # RUN: FileCheck %s -DSIZE=3 -DADDRALIGN=0 --check-prefixes=SHDR,ARBITRARY-CONTENT
450 # ARBITRARY-CONTENT: SectionData (
451 # ARBITRARY-CONTENT-NEXT: 0000: 112233
452 # ARBITRARY-CONTENT-NEXT: )
460 - Name: .debug_rnglists
464 ## m) Generate the .debug_rnglists section when the "Size" is specified.
466 # RUN: yaml2obj --docnum=11 %s -o %t11.o
467 # RUN: llvm-readelf --hex-dump=.debug_rnglists %t11.o | \
468 # RUN: FileCheck %s --check-prefix=SIZE
470 # SIZE: Hex dump of section '.debug_rnglists':
471 # SIZE-NEXT: 0x00000000 00000000 00000000 00000000 00000000 ................
480 - Name: .debug_rnglists
484 ## n) Test that yaml2obj emits an error message when both the "Size" and the
485 ## "debug_rnglists" entry are specified at the same time.
487 # RUN: not yaml2obj --docnum=12 %s 2>&1 | FileCheck %s --check-prefix=ERROR
489 # ERROR: yaml2obj: error: cannot specify section '.debug_rnglists' contents in the 'DWARF' entry and the 'Content' or 'Size' in the 'Sections' entry at the same time
497 - Name: .debug_rnglists
504 ## o) Test that yaml2obj emits an error message when both the "Content" and the
505 ## "debug_rnglists" entry are specified at the same time.
507 # RUN: not yaml2obj --docnum=13 %s 2>&1 | FileCheck %s --check-prefix=ERROR
515 - Name: .debug_rnglists
522 ## p) Test that all the properties can be overridden by the section header when
523 ## the "debug_rnglists" entry doesn't exist.
525 # RUN: yaml2obj --docnum=14 %s -o %t14.o
526 # RUN: llvm-readelf --sections %t14.o | FileCheck %s --check-prefix=OVERRIDDEN
528 # OVERRIDDEN: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
529 # OVERRIDDEN: [ 1] .debug_rnglists STRTAB 0000000000002020 000050 00000c 01 A 2 1 2
530 # OVERRIDDEN-NEXT: [ 2] .sec STRTAB 0000000000000000 00005c 000000 00 0 0 0
538 - Name: .debug_rnglists
539 Type: SHT_STRTAB ## SHT_PROGBITS by default.
540 Flags: [SHF_ALLOC] ## 0 by default.
541 Link: .sec ## 0 by default.
542 EntSize: 1 ## 0 by default.
543 Info: 1 ## 0 by default.
544 AddressAlign: 2 ## 0 by default.
545 Address: 0x2020 ## 0x00 by default.
546 Offset: 0x50 ## 0x40 for the first section.
547 Size: 0x0c ## Set the "Size" so that we can reuse the check tag "OVERRIDDEN".
548 - Name: .sec ## Linked by .debug_rnglists.
551 ## q) Test that all the properties can be overridden by the section header when
552 ## the "debug_rnglists" entry exists.
554 # RUN: yaml2obj --docnum=15 %s -o %t15.o
555 # RUN: llvm-readelf --sections %t15.o | FileCheck %s --check-prefix=OVERRIDDEN
563 - Name: .debug_rnglists
564 Type: SHT_STRTAB ## SHT_PROGBITS by default.
565 Flags: [SHF_ALLOC] ## 0 by default.
566 Link: .sec ## 0 by default.
567 EntSize: 1 ## 0 by default.
568 Info: 1 ## 0 by default.
569 AddressAlign: 2 ## 1 by default.
570 Address: 0x2020 ## 0x00 by default.
571 Offset: 0x50 ## 0x40 for the first section.
572 - Name: .sec ## Linked by .debug_rnglists.
578 ## r) Test that the .debug_rnglists section header is emitted if the "debug_rnglists"
581 # RUN: yaml2obj --docnum=16 %s -o %t16.o
582 # RUN: llvm-readobj --sections --section-data %t16.o | \
583 # RUN: FileCheck -DSIZE=0 -DADDRALIGN=1 %s --check-prefixes=SHDR,EMPTY-CONTENT
585 # EMPTY-CONTENT-NEXT: SectionData (
586 # EMPTY-CONTENT-NEXT: )
596 ## s) Test that we are able to generate a range list via raw binary data.
598 # RUN: yaml2obj --docnum=17 %s -o %t17.o
599 # RUN: llvm-readelf --hex-dump=.debug_rnglists %t17.o | \
600 # RUN: FileCheck %s --check-prefix=CUSTOM-LIST
602 # CUSTOM-LIST: Hex dump of section '.debug_rnglists':
603 # CUSTOM-LIST-NEXT: 0x00000000 29000000 05000800 03000000 0c000000 )...............
604 ## ^------- unit_length (4-byte)
605 ## ^--- version (2-byte)
606 ## ^- address_size (1-byte)
607 ## ^- segment_selector_size (1-byte)
608 ## ^------- offset_entry_count (4-byte)
609 ## ^------- offsets[0] (4-byte)
610 # CUSTOM-LIST-NEXT: 0x00000010 11000000 19000000 02b424b4 24123456 ..........$.$.4V
611 ## ^------- offsets[1] (4-byte)
612 ## ^------- offsets[2] (4-byte)
613 ## ^- DW_RLE_startx_endx
614 ## ^--- operands[0] (ULEB128) 0x1234
615 ## ^---- operands[1] (ULEB128) 0x1234
616 ## ^----- custom list content
617 # CUSTOM-LIST-NEXT: 0x00000020 7890abcd efabcdef 12345678 90 x........4Vx.
619 ## ^----------------- custom list content
630 - Operator: DW_RLE_startx_endx
631 Values: [ 0x1234, 0x1234 ]
632 - Content: '1234567890abcdef'
633 - Content: 'abcdef1234567890'
635 ## t) Test that yaml2obj emits an error message when 'Content' and 'Entries' are specified
638 # RUN: not yaml2obj --docnum=18 %s 2>&1 | FileCheck %s --check-prefix=ERR
640 # ERR: YAML:{{.*}}: error: Entries and Content can't be used together
641 # ERR-NEXT: - Entries: []
655 ## u) Test that when the "OffsetEntryCount" is specified to be 0 and "Offsets" is not specified,
656 ## the offsets array is not emitted.
658 # RUN: yaml2obj --docnum=19 -DENTRYCOUNT=0 %s -o %t19.o
659 # RUN: llvm-readelf --hex-dump=.debug_rnglists %t19.o | \
660 # RUN: FileCheck %s --check-prefix=NO-OFFSETS
662 # NO-OFFSETS: Hex dump of section '.debug_rnglists':
663 # NO-OFFSETS-NEXT: 0x00000000 0e000000 05000800 00000000 02010202 ................
664 ## ^------- offset_entry_count (4-byte)
665 ## ^- DW_RLE_startx_endx
666 ## ^- operands[0] (ULEB128) 0x01
667 ## ^- operands[1] (ULEB128) 0x02
668 ## ^- DW_RLE_startx_endx
669 # NO-OFFSETS-NEXT: 0x00000010 0102 ..
670 ## ^- operands[0] (ULEB128) 0x01
671 ## ^- operands[1] (ULEB128) 0x02
680 - OffsetEntryCount: [[ENTRYCOUNT=<none>]]
681 Offsets: [[OFFSETS=<none>]]
684 - Operator: DW_RLE_startx_endx
685 Values: [ 0x01, 0x02 ]
687 - Operator: DW_RLE_startx_endx
688 Values: [ 0x01, 0x02 ]
690 ## v) Test that when the "Offsets" entry is specified to be empty and the "OffsetEntryCount" is not specified,
691 ## the offsets array will be omitted.
693 # RUN: yaml2obj --docnum=19 -DOFFSETS=[] %s -o %t20.o
694 # RUN: llvm-readelf --hex-dump=.debug_rnglists %t20.o | \
695 # RUN: FileCheck %s --check-prefix=NO-OFFSETS
697 ## w) Test that if "Offsets" is specified, the offsets array will be emitted accordingly, even when
698 ## the "OffsetEntryCount" is specified to be 0.
700 # RUN: yaml2obj --docnum=19 -DOFFSETS=[0x01,0x02,0x03] -DENTRYCOUNT=0 %s -o %t21.o
701 # RUN: llvm-readelf --hex-dump=.debug_rnglists %t21.o | \
702 # RUN: FileCheck %s --check-prefix=OFFSETS
704 # OFFSETS: Hex dump of section '.debug_rnglists':
705 # OFFSETS-NEXT: 0x00000000 0e000000 05000800 00000000 01000000 ................
706 ## ^------- offset_entry_count (4-byte)
707 ## ^------- offsets[0] (4-byte)
708 # OFFSETS-NEXT: 0x00000010 02000000 03000000 02010202 0102 ..............
709 ## ^------- offsets[1] (4-byte)
710 ## ^------- offsets[2] (4-byte)
711 ## ^- DW_RLE_startx_endx
712 ## ^- operands[0] (ULEB128) 0x01
713 ## ^- operands[1] (ULEB128) 0x02
714 ## ^- DW_RLE_startx_endx
715 ## ^- operands[0] (ULEB128) 0x01
716 ## ^- operands[1] (ULEB128) 0x02