File: verify_invalid_str_offsets.yaml

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (59 lines) | stat: -rw-r--r-- 1,984 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# RUN: rm -rf %t && split-file %s %t
# RUN: yaml2obj %t/v5.yaml -o %t/v5.o
# RUN: not llvm-dwarfdump -debug-str-offsets -verify %t/v5.o | FileCheck %s
# RUN: yaml2obj %t/v4.yaml -o %t/v4.o
# RUN: not llvm-dwarfdump -debug-str-offsets -verify %t/v4.o | FileCheck --check-prefix=V4 %s

#      CHECK: Verifying .debug_abbrev...
#      CHECK: Verifying .debug_str_offsets...
# CHECK-NEXT: error: .debug_str_offsets: contribution 0x0: index 0x2: invalid string offset *0x10 == 0x1, is neither zero nor immediately following a null character
# 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
# CHECK-NEXT: error: .debug_str_offsets: contribution 0x18: invalid version 42
# CHECK-NEXT: error: .debug_str_offsets: contribution 0x20: invalid length ((length (0x5) - header (0x4)) % offset size 0x4 == 0x1 != 0)
# 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)
# Errors detected.

# V4: error: .debug_str_offsets: contribution 0x0: index 0x2: invalid string offset *0x8 == 0x2, is neither zero nor immediately following a null character


#--- v4.yaml
--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_EXEC
DWARF:
  debug_str:
    - 'foo'
    - 'bar'
  debug_info:
    - Version: 4
      AddrSize: 4
Sections:
  - Name: '.debug_str_offsets'
    Type: SHT_PROGBITS
    Content: "000000000400000002000000"

#--- v5.yaml
--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_EXEC
DWARF:
  debug_str:
    - 'foo'
    - 'bar'
  debug_info:
    - Version: 5
      UnitType:        DW_UT_compile
      AddrSize:        8
  debug_str_offsets:
    - Offsets:
        - 0x00000000
        - 0x00000004
        - 0x00000001
        - 0x00000042
    - Version: 42
    - Length: 5
    - Length: 8