xref: /llvm-project/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_str_offsets.yaml (revision 20948df25d0401f248ec754dfa22422e20377662)
1# RUN: rm -rf %t && split-file %s %t
2# RUN: yaml2obj %t/v5.yaml -o %t/v5.o
3# RUN: not llvm-dwarfdump -debug-str-offsets -verify %t/v5.o | FileCheck %s
4# RUN: yaml2obj %t/v4.yaml -o %t/v4.o
5# RUN: not llvm-dwarfdump -debug-str-offsets -verify %t/v4.o | FileCheck --check-prefix=V4 %s
6
7#      CHECK: Verifying .debug_abbrev...
8#      CHECK: Verifying .debug_str_offsets...
9# CHECK-NEXT: error: .debug_str_offsets: contribution 0x0: index 0x2: invalid string offset *0x10 == 0x1, is neither zero nor immediately following a null character
10# CHECK-NEXT: error: .debug_str_offsets: contribution 0x0: index 0x3: invalid string offset *0x14 == 0x42, is beyond the bounds of the string section of length 0x8
11# CHECK-NEXT: error: .debug_str_offsets: contribution 0x18: invalid version 42
12# CHECK-NEXT: error: .debug_str_offsets: contribution 0x20: invalid length ((length (0x5) - header (0x4)) % offset size 0x4 == 0x1 != 0)
13# CHECK-NEXT: error: .debug_str_offsets: contribution 0x29: length exceeds available space (contribution offset (0x29) + length field space (0x4) + length (0x5000000) == 0x500002D > section size 0x30)
14# Errors detected.
15
16# V4: error: .debug_str_offsets.dwo: contribution 0x0: index 0x2: invalid string offset *0x8 == 0x2, is neither zero nor immediately following a null character
17
18
19#--- v4.yaml
20--- !ELF
21FileHeader:
22  Class: ELFCLASS64
23  Data:  ELFDATA2LSB
24  Type:  ET_EXEC
25DWARF:
26Sections:
27  - Name: '.debug_info.dwo'
28    Type: SHT_PROGBITS
29    Content: "0700000004000000000004"
30  - Name: '.debug_str_offsets.dwo'
31    Type: SHT_PROGBITS
32    Content: "000000000400000002000000"
33  - Name: 'debug_str.dwo'
34    Type: SHT_PROGBITS
35    Content: "666F6F0062617200"
36
37
38#--- v5.yaml
39--- !ELF
40FileHeader:
41  Class: ELFCLASS64
42  Data:  ELFDATA2LSB
43  Type:  ET_EXEC
44DWARF:
45  debug_str:
46    - 'foo'
47    - 'bar'
48  debug_info:
49    - Version: 5
50      UnitType:        DW_UT_compile
51      AddrSize:        8
52  debug_str_offsets:
53    - Offsets:
54        - 0x00000000
55        - 0x00000004
56        - 0x00000001
57        - 0x00000042
58    - Version: 42
59    - Length: 5
60    - Length: 8
61