|
| 1 | +## This tests handling invalid .debug_str_offsets.dwo sections in |
| 2 | +## a pre-standard DWO/DWP file. |
| 3 | + |
| 4 | +# RUN: llvm-mc -triple x86_64 %s -filetype=obj -o %t.dwo |
| 5 | +# RUN: not llvm-dwarfdump -v %t.dwo 2>&1 | FileCheck %s |
| 6 | + |
| 7 | +# RUN: llvm-mc -triple x86_64 %s -filetype=obj -o %t.dwp --defsym DWP=0 |
| 8 | +# RUN: not llvm-dwarfdump -v %t.dwp 2>&1 | FileCheck %s |
| 9 | + |
| 10 | +# CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: length exceeds section size |
| 11 | + |
| 12 | + .section .debug_abbrev.dwo,"e",@progbits |
| 13 | +.LAbbr: |
| 14 | + .byte 0x01 # Abbrev code |
| 15 | + .byte 0x11 # DW_TAG_compile_unit |
| 16 | + .byte 0x00 # DW_CHILDREN_no |
| 17 | + .byte 0x00 # EOM(1) |
| 18 | + .byte 0x00 # EOM(2) |
| 19 | + .byte 0x00 # EOM(3) |
| 20 | +.LAbbrEnd: |
| 21 | + |
| 22 | + .section .debug_info.dwo,"e",@progbits |
| 23 | +.LCU: |
| 24 | + .long .LCUEnd-.LCUVersion |
| 25 | +.LCUVersion: |
| 26 | + .short 4 |
| 27 | + .long 0 |
| 28 | + .byte 8 |
| 29 | + .uleb128 1 |
| 30 | +.LCUEnd: |
| 31 | + |
| 32 | +## The section is truncated, i.e. its size is not a multiple of entry size. |
| 33 | + .section .debug_str_offsets.dwo,"e",@progbits |
| 34 | +.LStrOff: |
| 35 | + .byte 0 |
| 36 | +.LStrOffEnd: |
| 37 | + |
| 38 | +.ifdef DWP |
| 39 | + .section .debug_cu_index, "", @progbits |
| 40 | +## Header: |
| 41 | + .long 2 # Version |
| 42 | + .long 3 # Section count |
| 43 | + .long 1 # Unit count |
| 44 | + .long 2 # Slot count |
| 45 | +## Hash Table of Signatures: |
| 46 | + .quad 0x1100001122222222 # DWO Id of CU0 |
| 47 | + .quad 0 |
| 48 | +## Parallel Table of Indexes: |
| 49 | + .long 1 |
| 50 | + .long 0 |
| 51 | +## Table of Section Offsets: |
| 52 | +## Row 0: |
| 53 | + .long 1 # DW_SECT_INFO |
| 54 | + .long 3 # DW_SECT_ABBREV |
| 55 | + .long 6 # DW_SECT_STR_OFFSETS |
| 56 | +## Row 1, offsets of the contribution |
| 57 | + .long .LCU-.debug_info.dwo |
| 58 | + .long .LAbbr-.debug_abbrev.dwo |
| 59 | + .long .LStrOff-.debug_str_offsets.dwo |
| 60 | +## Table of Section Sizes: |
| 61 | +## Row 1, sizes of the contribution |
| 62 | + .long .LCUEnd-.LCU |
| 63 | + .long .LAbbrEnd-.LAbbr |
| 64 | + .long .LStrOffEnd-.LStrOff |
| 65 | +.endif |
0 commit comments