1 ## Test that yaml2obj emits .debug_line section.
3 ## a) Generate the .debug_line section from the "DWARF" entry.
5 ## Generate and verify a little endian DWARF32 .debug_line section.
7 # RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2LSB %s -o %t1.le.o
8 # RUN: llvm-readobj --sections --section-data %t1.le.o | \
9 # RUN: FileCheck %s -DSIZE=50 -DADDRALIGN=1 --check-prefixes=SHDR,DWARF-LE-CONTENT
12 # SHDR-NEXT: Name: .debug_line (1)
13 # SHDR-NEXT: Type: SHT_PROGBITS (0x1)
14 # SHDR-NEXT: Flags [ (0x0)
16 # SHDR-NEXT: Address: 0x0
17 # SHDR-NEXT: Offset: 0x40
18 # SHDR-NEXT: Size: [[SIZE]]
21 # SHDR-NEXT: AddressAlignment: [[ADDRALIGN]]
22 # SHDR-NEXT: EntrySize: 0
23 # DWARF-LE-CONTENT-NEXT: SectionData (
24 # DWARF-LE-CONTENT-NEXT: 0000: 70000000 02003200 00000102 03040501
26 ## | | | | | | | | +- standard_opcode_lengths[DW_LNS_copy] (1-byte) 0x01
27 ## | | | | | | | +- opcode_base (1-byte) 0x05
28 ## | | | | | | +- line_range (1-byte) 0x04
29 ## | | | | | +- line_base (signed 1-byte) 0x03
30 ## | | | | +- default_is_stmt (1-byte) 0x02
31 ## | | | +- minimum_instruction_length (1-byte) 0x01
32 ## | | +-------- prologue_length (4-byte) 50
33 ## | +--- version (2-byte) 0x02
34 ## +------- unit_length (4-byte) 0x70
36 # DWARF-LE-CONTENT-NEXT: 0010: 02030405 06070809 64697231 00646972
37 ## | | | | | | | | | |
38 ## | | | | | | | | | +----- include_directories[2] "dir2\0"
39 ## | | | | | | | | +---------- include_directories[1] "dir1\0"
40 ## | | | | | | | +- standard_opcode_lengths[DW_LNS_fixed_advance_pc] (1-byte) 0x09
41 ## | | | | | | +- standard_opcode_lengths[DW_LNS_const_add_pc] (1-byte) 0x08
42 ## | | | | | +- standard_opcode_lengths[DW_LNS_set_basic_block] (1-byte) 0x07
43 ## | | | | +- standard_opcode_lengths[DW_LNS_negate_stmt] (1-byte) 0x06
44 ## | | | +- standard_opcode_lengths[DW_LNS_set_column] (1-byte) 0x05
45 ## | | +- standard_opcode_lengths[DW_LNS_set_file] (1-byte) 0x04
46 ## | +- standard_opcode_lengths[DW_LNS_advance_line] (1-byte) 0x03
47 ## +- standard_opcode_lengths[DW_LNS_advance_pc] (1-byte) 0x02
49 # DWARF-LE-CONTENT-NEXT: 0020: 32000061 2E630001 0203622E 63000203
51 ## | | | | | | | | +- ModTime (ULEB128) 0x03
52 ## | | | | | | | +- DirIndex (ULEB128) 0x02
53 ## | | | | | | +-------- file_names[2] "b.c\0"
54 ## | | | | | +- Length (ULEB128) 0x03
55 ## | | | | +- ModTime (ULEB128) 0x02
56 ## | | | +- DirIndex (ULEB128) 0x01
57 ## | | +-------- file_names[1] "a.c\0"
58 ## | +- terminating entry (1-byte) 0x00
59 ## +--- the last two bytes of "dir2\0"
61 # DWARF-LE-CONTENT-NEXT: 0030: 0400
63 ## | +- terminating entry (1-byte) 0x00
64 ## +- Length (ULEB128) 0x04
65 # DWARF-LE-CONTENT-NEXT: )
82 StandardOpcodeLengths: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
96 ## Generate and verify a big endian DWARF32 .debug_line section.
98 # RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2MSB %s -o %t1.be.o
99 # RUN: llvm-readobj --sections --section-data %t1.be.o | \
100 # RUN: FileCheck %s -DSIZE=50 -DADDRALIGN=1 --check-prefixes=SHDR,DWARF-BE-CONTENT
102 # DWARF-BE-CONTENT-NEXT: SectionData (
103 # DWARF-BE-CONTENT-NEXT: 0000: 00000070 00020000 00320102 03040501
105 ## | | | | | | | | +- standard_opcode_lengths[DW_LNS_copy] (1-byte) 0x01
106 ## | | | | | | | +- opcode_base (1-byte) 0x05
107 ## | | | | | | +- line_range (1-byte) 0x04
108 ## | | | | | +- line_base (signed 1-byte) 0x03
109 ## | | | | +- default_is_stmt (1-byte) 0x02
110 ## | | | +- minimum_instruction_length (1-byte) 0x01
111 ## | | +-------- prologue_length (4-byte) 50
112 ## | +--- version (2-byte) 0x02
113 ## +------- unit_length (4-byte) 0x70
115 # DWARF-BE-CONTENT-NEXT: 0010: 02030405 06070809 64697231 00646972
116 ## | | | | | | | | | |
117 ## | | | | | | | | | +----- include_directories[2] "dir2\0"
118 ## | | | | | | | | +---------- include_directories[1] "dir1\0"
119 ## | | | | | | | +- standard_opcode_lengths[DW_LNS_fixed_advance_pc] (1-byte) 0x09
120 ## | | | | | | +- standard_opcode_lengths[DW_LNS_const_add_pc] (1-byte) 0x08
121 ## | | | | | +- standard_opcode_lengths[DW_LNS_set_basic_block] (1-byte) 0x07
122 ## | | | | +- standard_opcode_lengths[DW_LNS_negate_stmt] (1-byte) 0x06
123 ## | | | +- standard_opcode_lengths[DW_LNS_set_column] (1-byte) 0x05
124 ## | | +- standard_opcode_lengths[DW_LNS_set_file] (1-byte) 0x04
125 ## | +- standard_opcode_lengths[DW_LNS_advance_line] (1-byte) 0x03
126 ## +- standard_opcode_lengths[DW_LNS_advance_pc] (1-byte) 0x02
128 # DWARF-BE-CONTENT-NEXT: 0020: 32000061 2E630001 0203622E 63000203
130 ## | | | | | | | | +- ModTime (ULEB128) 0x03
131 ## | | | | | | | +- DirIndex (ULEB128) 0x02
132 ## | | | | | | +-------- file_names[2] "b.c\0"
133 ## | | | | | +- Length (ULEB128) 0x03
134 ## | | | | +- ModTime (ULEB128) 0x02
135 ## | | | +- DirIndex (ULEB128) 0x01
136 ## | | +-------- file_names[1] "a.c\0"
137 ## | +- terminating entry (1-byte) 0x00
138 ## +--- the last two bytes of "dir2\0"
140 # DWARF-BE-CONTENT-NEXT: 0030: 0400
142 ## | +- terminating entry (1-byte) 0x00
143 ## +- Length (ULEB128) 0x04
144 # DWARF-BE-CONTENT-NEXT: )
146 ## b) Generate the .debug_line section from raw section content.
148 # RUN: yaml2obj --docnum=2 %s -o %t2.o
149 # RUN: llvm-readobj --sections --section-data %t2.o | \
150 # RUN: FileCheck %s -DSIZE=3 -DADDRALIGN=0 --check-prefixes=SHDR,ARBITRARY-CONTENT
152 # ARBITRARY-CONTENT: SectionData (
153 # ARBITRARY-CONTENT-NEXT: 0000: 112233 |."3|
154 # ARBITRARY-CONTENT-NEXT: )
166 ## c) Generate the .debug_line section when the "Size" is specified.
168 # RUN: yaml2obj --docnum=3 %s -o %t3.o
169 # RUN: llvm-readobj --sections --section-data %t3.o | \
170 # RUN: FileCheck %s -DSIZE=16 -DADDRALIGN=0 --check-prefixes=SHDR,SIZE
172 # SIZE: SectionData (
173 # SIZE-NEXT: 0000: 00000000 00000000 00000000 00000000 |................|
186 ## d) Test that yaml2obj emits an error message when both the "Size" and the
187 ## "debug_line" entry are specified at the same time.
189 # RUN: not yaml2obj --docnum=4 %s 2>&1 | FileCheck %s --check-prefix=ERROR
191 # ERROR: yaml2obj: error: cannot specify section '.debug_line' contents in the 'DWARF' entry and the 'Content' or 'Size' in the 'Sections' entry at the same time
212 StandardOpcodeLengths: []
214 ## e) Test that yaml2obj emits an error message when both the "Content" and the
215 ## "debug_line" entry are specified at the same time.
217 # RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s --check-prefix=ERROR
238 StandardOpcodeLengths: []
240 ## f) Test that all the properties can be overridden by the section header when
241 ## the "debug_line" entry doesn't exist.
243 # RUN: yaml2obj --docnum=6 %s -o %t6.o
244 # RUN: llvm-readelf --sections %t6.o | FileCheck %s --check-prefix=OVERRIDDEN
246 # OVERRIDDEN: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
247 # OVERRIDDEN: [ 1] .debug_line STRTAB 0000000000002020 000050 000011 01 A 2 1 2
248 # OVERRIDDEN-NEXT: [ 2] .sec STRTAB 0000000000000000 000061 000000 00 0 0 0
257 Type: SHT_STRTAB # SHT_PROGBITS by default.
258 Flags: [SHF_ALLOC] # 0 by default.
259 Link: .sec # 0 by default.
260 EntSize: 1 # 0 by default.
261 Info: 1 # 0 by default.
262 AddressAlign: 2 # 0 by default.
263 Address: 0x2020 # 0x00 by default.
264 Offset: 0x50 # 0x40 for the first section.
265 Size: 0x11 # Set the "Size" so that we can reuse the check tag "OVERRIDDEN".
266 - Name: .sec # Linked by .debug_line.
269 ## g) Test that all the properties can be overridden by the section header when
270 ## the "debug_line" entry exists.
272 # RUN: yaml2obj --docnum=7 %s -o %t7.o
273 # RUN: llvm-readelf --sections %t7.o | FileCheck %s --check-prefix=OVERRIDDEN
282 Type: SHT_STRTAB # SHT_PROGBITS by default.
283 Flags: [SHF_ALLOC] # 0 by default.
284 Link: .sec # 0 by default.
285 EntSize: 1 # 0 by default.
286 Info: 1 # 0 by default.
287 AddressAlign: 2 # 1 by default.
288 Address: 0x2020 # 0x00 by default.
289 Offset: 0x50 # 0x40 for the first section.
290 - Name: .sec # Linked by .debug_line.
302 StandardOpcodeLengths: []
304 ## h) Test that the address size is inferred from the target machine.
306 # RUN: yaml2obj --docnum=8 -DBITS=64 -DADDR=0x1234567890abcdef %s -o %t8.64-bit.o
307 # RUN: llvm-readelf --hex-dump=.debug_line %t8.64-bit.o | \
308 # RUN: FileCheck %s --check-prefix=ADDRSIZE -DADDR="efcdab90 78563412"
310 # ADDRSIZE: Hex dump of section '.debug_line':
311 # ADDRSIZE-NEXT: 0x00000000 34120000 02003412 00000101 010e0d00 4.....4.........
312 ## ^------- unit_length (4-byte)
313 ## ^--- version (2-byte)
314 ## ^-------- header_length (4-byte)
315 ## ^- minimum_instruction_length (1-byte)
316 ## ^- default_is_stmt (1-byte)
317 ## ^- line_base (1-byte)
318 ## ^- line_range (1-byte)
319 ## ^- opcode_base (1-byte)
320 ## ^- null byte for terminating include_directories
321 # ADDRSIZE-NEXT: 0x00000010 00000902 [[ADDR]]
322 ## ^- null byte for terminating file_names
323 ## ^- DW_LNS_extended_op
324 ## ^- extended op length (ULEB128) 0x09
325 ## ^- DW_LNE_set_address
328 # RUN: yaml2obj --docnum=8 -DBITS=32 -DADDR=0x12345678 %s -o %t8.32-bit.o
329 # RUN: llvm-readelf --hex-dump=.debug_line %t8.32-bit.o | \
330 # RUN: FileCheck %s --check-prefix=ADDRSIZE -DADDR="78563412"
334 Class: ELFCLASS[[BITS]]
341 PrologueLength: 0x1234
347 StandardOpcodeLengths: []
349 - Opcode: DW_LNS_extended_op
351 SubOpcode: DW_LNE_set_address
354 ## i) Test that yaml2obj is able to emit correct opcodes.
356 # RUN: yaml2obj --docnum=9 %s -o %t9.o
357 # RUN: llvm-readelf --hex-dump=.debug_line %t9.o | FileCheck %s --check-prefix=OPCODES
359 # OPCODES: Hex dump of section '.debug_line':
360 # OPCODES-NEXT: 0x00000000 34120000 04003412 00000101 01010e0d 4.....4.........
361 ## ^------- unit_length (4-byte)
362 ## ^--- version (2-byte)
363 ## ^-------- header_length (4-byte)
364 ## ^- minimum_instruction_length (1-byte)
365 ## ^- maximum_operations_per_instruction (1-byte)
366 ## ^- default_is_stmt (1-byte)
367 ## ^- line_base (1-byte)
368 ## ^- line_range (1-byte)
369 ## ^- opcode_base (1-byte)
370 # OPCODES-NEXT: 0x00000010 00000102 b42403b4 2404b424 05b42406 .....$..$..$..$.
371 ## ^- null byte for terminating include_directories
372 ## ^- null byte for terminating file_names
373 ## ^- DW_LNS_copy (1-byte)
374 ## ^- DW_LNS_advance_pc
375 ## ^--- operands[0] (ULEB128) 0x1234
376 ## ^- DW_LNS_advance_line
377 ## ^---- operands[0] (SLEB128) 0x1234
378 ## ^- DW_LNS_set_file
379 ## ^--- operands[0] (ULEB128) 0x1234
380 ## ^- DW_LNS_set_column
381 ## ^--- operands[0] (ULEB128) 0x1234
382 ## ^- DW_LNS_negate_stmt
383 # OPCODES-NEXT: 0x00000020 07080934 120a0b0c b4240009 01000902 ...4.....$......
384 ## ^- DW_LNS_set_basic_block
385 ## ^- DW_LNS_const_add_pc
386 ## ^- DW_LNS_fixed_advance_pc
387 ## ^---- operands[0] (uhalf, 2-byte)
388 ## ^- DW_LNS_set_prologue_end
389 ## ^- DW_LNS_set_epilogue_begin
391 ## ^--- operands[0] (ULEB128) 0x1234
392 ## ^- DW_LNS_extended_op
393 ## ^- extended op length (ULEB128) 0x09
394 ## ^- DW_LNE_end_sequence
395 ## ^- DW_LNS_extended_op
396 ## ^- extended op length (ULEB128) 0x09
397 ## ^- DW_LNE_set_address
398 # OPCODES-NEXT: 0x00000030 34120000 00000000 00090361 62636400 4..........abcd.
399 ## ^---------------- operands[0] (8-byte)
400 ## ^- DW_LNS_extended_op
401 ## ^- extended op length (ULEB128) 0x09
402 ## ^- DW_LNE_define_file
403 ## ^---------- operands[0] "abcd\0"
404 # OPCODES-NEXT: 0x00000040 b424b424 b4240009 04b424 .$.$.$....$
405 ## ^--- operands[1] (ULEB128) 0x1234
406 ## ^--- operands[2] (ULEB128) 0x1234
407 ## ^--- operands[3] (ULEB128) 0x1234
408 ## ^- DW_LNS_extended_op
409 ## ^- extended op length (ULEB128) 0x09
410 ## ^- DW_LNE_set_discriminator
411 ## ^--- operands[0] (ULEB128) 0x1234
422 PrologueLength: 0x1234
429 StandardOpcodeLengths: []
431 - Opcode: DW_LNS_copy
432 - Opcode: DW_LNS_advance_pc
434 - Opcode: DW_LNS_advance_line
436 - Opcode: DW_LNS_set_file
438 - Opcode: DW_LNS_set_column
440 - Opcode: DW_LNS_negate_stmt
441 - Opcode: DW_LNS_set_basic_block
442 - Opcode: DW_LNS_const_add_pc
443 - Opcode: DW_LNS_fixed_advance_pc
445 - Opcode: DW_LNS_set_prologue_end
446 - Opcode: DW_LNS_set_epilogue_begin
447 - Opcode: DW_LNS_set_isa
449 - Opcode: DW_LNS_extended_op
451 SubOpcode: DW_LNE_end_sequence
452 - Opcode: DW_LNS_extended_op
454 SubOpcode: DW_LNE_set_address
456 - Opcode: DW_LNS_extended_op
458 SubOpcode: DW_LNE_define_file
464 - Opcode: DW_LNS_extended_op
466 SubOpcode: DW_LNE_set_discriminator
469 ## j) Test that yaml2obj is able to infer the length and header_length fields.
471 # RUN: yaml2obj --docnum=10 %s -o %t10.o
472 # RUN: llvm-readelf --hex-dump=.debug_line %t10.o | FileCheck %s --check-prefix=INFER-LENGTH
474 # INFER-LENGTH: Hex dump of section '.debug_line':
475 # INFER-LENGTH-NEXT: 0x00000000 2e000000 04002500 00000101 01fb0e04 ......%.........
476 ## ^------- unit_length (4-byte) 0x2e
477 ## ^--- version (2-byte)
478 ## ^-------- header_length (4-byte) 0x25
479 ## ^- minimum_instruction_length (1-byte)
480 ## ^- maximum_operations_per_instruction (1-byte)
481 ## ^- default_is_stmt (1-byte)
482 ## ^- line_base (1-byte) -5
483 ## ^- line_range (1-byte)
484 ## ^- opcode_base (1-byte)
485 # INFER-LENGTH-NEXT: 0x00000010 00010174 656d7031 0074656d 70320000 ...temp1.temp2..
486 ## ^----- standard_opcode_lengths (3-byte)
487 ## ^------------- include_directories[1] "temp1\0"
488 ## ^------------ include_directories[2] "temp1\0"
489 ## ^- include_directories null byte
490 # INFER-LENGTH-NEXT: 0x00000020 612e6300 01000062 2e630002 00000000 a.c....b.c......
491 ## ^------- file_names[1] file name "a.c\0"
492 ## ^- file_names[1] directory index (ULEB128) 0x01
493 ## ^- file_names[1] file length (ULEB128) 0x00
494 ## ^- file_names[1] modification time 0x00
495 ## ^-------- file_names[2] file name "b.c\0"
496 ## ^- file_names[2] directory index (ULEB128) 0x02
497 ## ^- file_names[2] file length (ULEB128) 0x00
498 ## ^- file_names[2] modification time 0x00
499 ## ^- file_names null byte
500 ## ^- DW_LNS_extended_op
501 # INFER-LENGTH-NEXT: 0x00000030 0101ffff ffff2500 00000000 00000400 ......%.........
502 ## ^- extended op length (ULEB128) 0x01
503 ## ^- DW_LNE_end_sequence
504 ## ^-------------------------- unit_length (12-byte)
505 ## ^--- version (2-byte)
506 # INFER-LENGTH-NEXT: 0x00000040 18000000 00000000 010101fb 0e040001 ................
507 ## ^---------------- header_length (8-byte)
508 ## ^- minimum_instruction_length (1-byte)
509 ## ^- maximum_operations_per_instruction (1-byte)
510 ## ^- default_is_stmt (1-byte)
511 ## ^- line_base (1-byte) -5
512 ## ^- line_range (1-byte)
513 ## ^- opcode_base (1-byte)
514 ## ^--- standard_opcode_lengths (3-byte)
515 # INFER-LENGTH-NEXT: 0x00000050 0174656d 70330000 632e6300 01000000 .temp3..c.c.....
517 ## ^------------ include_directories[1] "temp3\0"
518 ## ^- include_directories null byte
519 ## ^------- file_names[1] file name "a.c\0"
520 ## ^- file_names[1] directory index (ULEB128) 0x01
521 ## ^- file_names[1] file length (ULEB128) 0x00
522 ## ^- file_names[1] modification time 0x00
523 ## ^- file_names null byte
524 # INFER-LENGTH-NEXT: 0x00000060 000101 ...
525 ## ^- DW_LNS_extended_op
526 ## ^- extended op length (ULEB128) 0x01
527 ## ^- DW_LNE_end_sequence
543 StandardOpcodeLengths: [ 0, 1, 1 ]
557 - Opcode: DW_LNS_extended_op
559 SubOpcode: DW_LNE_end_sequence
568 StandardOpcodeLengths: [ 0, 1, 1 ]
577 - Opcode: DW_LNS_extended_op
579 SubOpcode: DW_LNE_end_sequence
581 ## k) Test that we can omit the include_directories, file_names and opcodes
582 ## fields of the line table.
584 # RUN: yaml2obj --docnum=11 %s -o %t11.o
585 # RUN: llvm-readelf --hex-dump=.debug_line %t11.o | \
586 # RUN: FileCheck %s --check-prefix=OMIT-FIELDS
588 # OMIT-FIELDS: Hex dump of section '.debug_line':
589 # OMIT-FIELDS-NEXT: 0x00000000 11000000 04000b00 00000101 01fb0e04 ................
590 ## ^------- unit_length (4-byte)
591 ## ^--- version (2-byte)
592 ## ^-------- header_length (4-byte)
593 ## ^- minimum_instruction_length (1-byte)
594 ## ^- maximum_operations_per_instruction (1-byte)
595 ## ^- default_is_stmt (1-byte)
596 ## ^- line_base (1-byte) -5
597 ## ^- line_range (1-byte)
598 ## ^- opcode_base (1-byte)
599 # OMIT-FIELDS-NEXT: 0x00000010 00010100 00 .....
600 ## ^----- standard_opcode_lengths (3-byte)
601 ## ^- include_directories null byte (1-byte)
602 ## ^- file_names null byte (1-byte)
618 StandardOpcodeLengths: [ 0, 1, 1 ]
620 ## l) Test that we can specify or omit the ExtLen field of extended opcodes.
622 # RUN: yaml2obj --docnum=12 %s -o %t12.o
623 # RUN: llvm-readelf --hex-dump=.debug_line %t12.o | \
624 # RUN: FileCheck %s --check-prefix=EXTLEN --strict-whitespace
626 # EXTLEN: Hex dump of section '.debug_line':
627 # EXTLEN-NEXT: 0x00000000 20000000 04000800 00000101 01fb0e01
628 ## ^---------------------------------- line number program header
629 # EXTLEN-NEXT: 0x00000010 0000000c 03616263 6400b424 b424b424
631 ## ^- DW_LNS_extended_op
632 ## ^- extended opcode length (ULEB128) 12
633 ## ^- DW_LNE_define_file
634 ## ^---------- "abcd\0"
635 ## ^--- directory index (ULEB128) 0x1234
636 ## ^--- modification time (ULEB128) 0x1234
637 ## ^--- file length (ULEB128) 0x1234
638 # EXTLEN-NEXT: 0x00000020 00b42401{{ }}
639 ## ^- DW_LNS_extended_op
640 ## ^--- extended opcode length (ULEB128) 0x1234
641 ## ^- DW_LNE_end_sequence
657 StandardOpcodeLengths: []
659 - Opcode: DW_LNS_extended_op
660 ## Omit the ExtLen field.
661 SubOpcode: DW_LNE_define_file
667 - Opcode: DW_LNS_extended_op
668 ## Specify the ExtLen field.
670 SubOpcode: DW_LNE_end_sequence
672 ## m) Test how yaml2obj generates the opcode_base and the
673 ## standard_opcode_lengths fields.
675 ## Both the opcode_base and the standard_opcode_lengths fields are not
676 ## specified (DWARFv2).
678 # RUN: yaml2obj --docnum=13 -DVERSION=2 -DMAXOPSPERINST='' %s -o %t13.o
679 # RUN: llvm-readelf --hex-dump=.debug_line %t13.o | \
680 # RUN: FileCheck %s --check-prefix=OPCODEBASEV2
682 # OPCODEBASEV2: Hex dump of section '.debug_line':
683 # OPCODEBASEV2-NEXT: 0x00000000 16000000 02001000 00000101 00010a00 ................
684 ## ^- opcode_base (10)
685 ## ^- standard_opcode_lengths[DW_LNS_copy] = 0
686 # OPCODEBASEV2-NEXT: 0x00000010 01010101 00000001 0000 ..........
687 ## ^- standard_opcode_lengths[DW_LNS_advance_pc] = 1
688 ## ^- standard_opcode_lengths[DW_LNS_advance_line] = 1
689 ## ^- standard_opcode_lengths[DW_LNS_set_file] = 1
690 ## ^- standard_opcode_lengths[DW_LNS_set_column] = 1
691 ## ^- standard_opcode_lengths[DW_LNS_negate_stmt] = 0
692 ## ^- standard_opcode_lengths[DW_LNS_set_basic_block] = 0
693 ## ^- standard_opcode_lengths[DW_LNS_const_add_pc] = 0
694 ## ^- standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
695 ## ^--- terminators for include_directories and file_names
704 - Version: [[VERSION=4]]
706 [[MAXOPSPERINST=MaxOpsPerInst: 0]]
710 OpcodeBase: [[OPCODEBASE=<none>]]
711 StandardOpcodeLengths: [[STANDARDOPCODELENGTHS=<none>]]
713 ## Both the opcode_base and the standard_opcode_lengths fields are not
714 ## specified (DWARFv3).
716 # RUN: yaml2obj --docnum=13 -DVERSION=3 -DMAXOPSPERINST='' %s -o %t14.o
717 # RUN: llvm-readelf --hex-dump=.debug_line %t14.o | \
718 # RUN: FileCheck %s --check-prefix=OPCODEBASEV3
720 # OPCODEBASEV3: Hex dump of section '.debug_line':
721 # OPCODEBASEV3-NEXT: 0x00000000 19000000 03001300 00000101 00010d00 ................
722 ## ^- opcode_base (13)
723 ## ^- standard_opcode_lengths[DW_LNS_copy] = 0
724 # OPCODEBASEV3-NEXT: 0x00000010 01010101 00000001 00000100 00 .............
725 ## ^- standard_opcode_lengths[DW_LNS_advance_pc] = 1
726 ## ^- standard_opcode_lengths[DW_LNS_advance_line] = 1
727 ## ^- standard_opcode_lengths[DW_LNS_set_file] = 1
728 ## ^- standard_opcode_lengths[DW_LNS_set_column] = 1
729 ## ^- standard_opcode_lengths[DW_LNS_negate_stmt] = 0
730 ## ^- standard_opcode_lengths[DW_LNS_set_basic_block] = 0
731 ## ^- standard_opcode_lengths[DW_LNS_const_add_pc] = 0
732 ## ^- standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
733 ## ^- standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
734 ## ^- standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
735 ## ^- standard_opcode_lengths[DW_LNS_set_isa] = 1
736 ## ^---- terminators for include_directories and file_names
738 ## Both the opcode_base and the standard_opcode_lengths fields are not
739 ## specified (DWARFv4).
741 # RUN: yaml2obj --docnum=13 %s -o %t15.o
742 # RUN: llvm-readelf --hex-dump=.debug_line %t15.o | \
743 # RUN: FileCheck %s --check-prefix=OPCODEBASEV4
745 # OPCODEBASEV4: Hex dump of section '.debug_line':
746 # OPCODEBASEV4-NEXT: 0x00000000 1a000000 04001400 00000100 0100010d ................
747 ## ^- opcode_base (13)
748 # OPCODEBASEV4-NEXT: 0x00000010 00010101 01000000 01000001 0000 ..............
749 ## ^- standard_opcode_lengths[DW_LNS_copy] = 0
750 ## ^- standard_opcode_lengths[DW_LNS_advance_pc] = 1
751 ## ^- standard_opcode_lengths[DW_LNS_advance_line] = 1
752 ## ^- standard_opcode_lengths[DW_LNS_set_file] = 1
753 ## ^- standard_opcode_lengths[DW_LNS_set_column] = 1
754 ## ^- standard_opcode_lengths[DW_LNS_negate_stmt] = 0
755 ## ^- standard_opcode_lengths[DW_LNS_set_basic_block] = 0
756 ## ^- standard_opcode_lengths[DW_LNS_const_add_pc] = 0
757 ## ^- standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
758 ## ^- standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
759 ## ^- standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
760 ## ^- standard_opcode_lengths[DW_LNS_set_isa] = 1
761 ## ^--- terminators for include_directories and file_names
763 ## Specify the opcode_base field (opcode_base == 0).
765 # RUN: yaml2obj --docnum=13 -DOPCODEBASE=0 %s -o %t16.o
766 # RUN: llvm-readelf --hex-dump=.debug_line %t16.o | \
767 # RUN: FileCheck %s --check-prefix=ZERO-OPCODEBASE
769 # ZERO-OPCODEBASE: Hex dump of section '.debug_line':
770 # ZERO-OPCODEBASE-NEXT: 0x00000000 0e000000 04000800 00000100 01000100 ................
771 ## ^- opcode_base (0)
772 # ZERO-OPCODEBASE-NEXT: 0x00000010 0000 ..
773 ## ^--- terminators for include_directories and file_names
775 ## Specify the opcode_base field (opcode_base != 0, opcode_base - 1 < 12).
776 ## The standard_opcode_lengths array will be truncated.
778 # RUN: yaml2obj --docnum=13 -DOPCODEBASE=4 %s -o %t17.o
779 # RUN: llvm-readelf --hex-dump=.debug_line %t17.o | \
780 # RUN: FileCheck %s --check-prefix=OPCODEBASE
782 # OPCODEBASE: Hex dump of section '.debug_line':
783 # OPCODEBASE-NEXT: 0x00000000 11000000 04000b00 00000100 01000104 ................
784 ## ^- opcode_base (4)
785 # OPCODEBASE-NEXT: 0x00000010 00010100 00 .....
786 ## ^----- standard_opcode_lengths (3-byte)
787 ## ^---- terminators for include_directories and file_names
789 ## Specify the opcode_base field (opcode_base != 0, opcode_base - 1 > 12).
790 ## The standard_opcode_lengths array will be extended.
792 # RUN: yaml2obj --docnum=13 -DOPCODEBASE=20 %s -o %t18.o
793 # RUN: llvm-readelf --hex-dump=.debug_line %t18.o | \
794 # RUN: FileCheck %s --check-prefix=OPCODEBASE1
796 # OPCODEBASE1: Hex dump of section '.debug_line':
797 # OPCODEBASE1-NEXT: 0x00000000 21000000 04001b00 00000100 01000114 !...............
798 ## ^- opcode_base (20)
799 # OPCODEBASE1-NEXT: 0x00000010 00010101 01000000 01000001 00000000 ................
800 ## ^------------------------- standard_opcode_lengths defined in DWARFv5 (12-byte)
801 ## ^------- extended standard_opcode_lengths (7-byte)
802 # OPCODEBASE1-NEXT: 0x00000020 00000000 00 .....
804 ## ^---- terminators for include_directories and file_names
806 ## Specify the standard_opcode_lengths field.
808 # RUN: yaml2obj --docnum=13 -DSTANDARDOPCODELENGTHS=[0,1,0] %s -o %t19.o
809 # RUN: llvm-readelf --hex-dump=.debug_line %t19.o | \
810 # RUN: FileCheck %s --check-prefix=OPCODELENGTHS
812 # OPCODELENGTHS: Hex dump of section '.debug_line':
813 # OPCODELENGTHS-NEXT: 0x00000000 11000000 04000b00 00000100 01000104 ................
814 ## ^- opcode_base (4)
815 # OPCODELENGTHS-NEXT: 0x00000010 00010000 00 .....
816 ## ^----- standard_opcode_lengths (3-byte)
817 ## ^---- terminators for include_directories and file_names
819 ## Specify both the opcode_base and the standard_opcode_lengths fields.
821 # RUN: yaml2obj --docnum=13 -DOPCODEBASE=2 -DSTANDARDOPCODELENGTHS=[0,1,0] %s -o %t20.o
822 # RUN: llvm-readelf --hex-dump=.debug_line %t20.o | \
823 # RUN: FileCheck %s --check-prefix=OPCODEBASE-LENGTHS
825 # OPCODEBASE-LENGTHS: Hex dump of section '.debug_line':
826 # OPCODEBASE-LENGTHS-NEXT: 0x00000000 11000000 04000b00 00000100 01000102 ................
827 ## ^- opcode_base (2)
828 # OPCODEBASE-LENGTHS-NEXT: 0x00000010 00010000 00 .....
829 ## ^----- standard_opcode_lengths (3-byte)
830 ## ^---- terminators for include_directories and file_names