Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / llvm-dwarfdump / X86 / debug_pub_tables_error_cases.s
blob8daea1e0f80d7c72a28fd2131668e68459956fe5
1 # RUN: llvm-mc -triple x86_64 %s -filetype=obj -o %t
3 ## All four name lookup table sections share the same parser, but slightly
4 ## different code paths are used to reach it. Do a comprehensive check for one
5 ## of the sections and minimal checks for the others.
7 # RUN: not llvm-dwarfdump -debug-gnu-pubnames %t 2> %t.err | FileCheck %s
8 # RUN: FileCheck %s --input-file=%t.err --check-prefix=ERR
10 # RUN: not llvm-dwarfdump -debug-pubnames -debug-pubtypes -debug-gnu-pubtypes %t 2>&1 | \
11 # RUN: FileCheck %s --check-prefix=ERR-MIN
13 .section .debug_gnu_pubnames,"",@progbits
14 # CHECK: .debug_gnu_pubnames contents:
16 ## The next few sets do not contain all required fields in the header.
17 # ERR: error: name lookup table at offset 0x0 does not have a complete header: unexpected end of data at offset 0x5 while reading [0x4, 0x6)
18 # CHECK-NEXT: length = 0x00000001, format = DWARF32, version = 0x0000, unit_offset = 0x00000000, unit_size = 0x00000000
19 # CHECK-NEXT: Offset Linkage Kind Name
20 # CHECK-NOT: 0x
21 .long .LSet0End-.LSet0 # Length
22 .LSet0:
23 .byte 1 # Version (truncated)
24 .LSet0End:
26 # ERR: error: name lookup table at offset 0x5 does not have a complete header: unexpected end of data at offset 0xe while reading [0xb, 0xf)
27 # CHECK-NEXT: length = 0x00000005, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000000
28 # CHECK-NEXT: Offset Linkage Kind Name
29 # CHECK-NOT: 0x
30 .long .LSet1End-.LSet1 # Length
31 .LSet1:
32 .short 2 # Version
33 .byte 1, 2, 3 # Debug Info Offset (truncated)
34 .LSet1End:
36 # ERR: error: name lookup table at offset 0xe does not have a complete header: unexpected end of data at offset 0x1b while reading [0x18, 0x1c)
37 # CHECK-NEXT: length = 0x00000009, format = DWARF32, version = 0x0002, unit_offset = 0x00000032, unit_size = 0x00000000
38 # CHECK-NEXT: Offset Linkage Kind Name
39 # CHECK-NOT: 0x
40 .long .LSet2End-.LSet2 # Length
41 .LSet2:
42 .short 2 # Version
43 .long 0x32 # Debug Info Offset
44 .byte 1, 2, 3 # Debug Info Length (truncated)
45 .LSet2End:
47 ## This set is terminated just after the header.
48 # ERR: error: name lookup table at offset 0x1b parsing failed: unexpected end of data at offset 0x29 while reading [0x29, 0x2d)
49 # CHECK-NEXT: length = 0x0000000a, format = DWARF32, version = 0x0002, unit_offset = 0x00000048, unit_size = 0x00000064
50 # CHECK-NEXT: Offset Linkage Kind Name
51 # CHECK-NOT: 0x
52 .long .LSet3End-.LSet3 # Length
53 .LSet3:
54 .short 2 # Version
55 .long 0x48 # Debug Info Offset
56 .long 0x64 # Debug Info Length
57 .LSet3End:
59 ## The offset in the first pair is truncated.
60 # ERR: error: name lookup table at offset 0x29 parsing failed: unexpected end of data at offset 0x3a while reading [0x37, 0x3b)
61 # CHECK-NEXT: length = 0x0000000d, format = DWARF32, version = 0x0002, unit_offset = 0x000000ac, unit_size = 0x00000036
62 # CHECK-NEXT: Offset Linkage Kind Name
63 # CHECK-NOT: 0x
64 .long .LSet4End-.LSet4 # Length
65 .LSet4:
66 .short 2 # Version
67 .long 0xac # Debug Info Offset
68 .long 0x36 # Debug Info Length
69 .byte 1, 2, 3 # Offset (truncated)
70 .LSet4End:
72 ## The set is truncated just after the offset of the first pair.
73 # ERR: error: name lookup table at offset 0x3a parsing failed: unexpected end of data at offset 0x4c while reading [0x4c, 0x4d)
74 # CHECK-NEXT: length = 0x0000000e, format = DWARF32, version = 0x0002, unit_offset = 0x000000e2, unit_size = 0x00000015
75 # CHECK-NEXT: Offset Linkage Kind Name
76 # CHECK-NOT: 0x
77 .long .LSet5End-.LSet5 # Length
78 .LSet5:
79 .short 2 # Version
80 .long 0xe2 # Debug Info Offset
81 .long 0x15 # Debug Info Length
82 .long 0xf4 # Offset
83 .LSet5End:
85 ## The set is truncated just after the index entry field of the first pair.
86 # ERR: error: name lookup table at offset 0x4c parsing failed: no null terminated string at offset 0x5f
87 # CHECK-NEXT: length = 0x0000000f, format = DWARF32, version = 0x0002, unit_offset = 0x000000f7, unit_size = 0x00000010
88 # CHECK-NEXT: Offset Linkage Kind Name
89 # CHECK-NOT: 0x
90 .long .LSet6End-.LSet6 # Length
91 .LSet6:
92 .short 2 # Version
93 .long 0xf7 # Debug Info Offset
94 .long 0x10 # Debug Info Length
95 .long 0xf4 # Offset
96 .byte 0x30 # Index Entry
97 .LSet6End:
99 ## This set contains a string which is not properly terminated.
100 # ERR: error: name lookup table at offset 0x5f parsing failed: no null terminated string at offset 0x72
101 # CHECK-NEXT: length = 0x00000012, format = DWARF32, version = 0x0002, unit_offset = 0x00000107, unit_size = 0x0000004b
102 # CHECK-NEXT: Offset Linkage Kind Name
103 # CHECK-NOT: 0x
104 .long .LSet7End-.LSet7 # Length
105 .LSet7:
106 .short 2 # Version
107 .long 0x107 # Debug Info Offset
108 .long 0x4b # Debug Info Length
109 .long 0x111 # Offset
110 .byte 0x30 # Index Entry
111 .ascii "foo" # The string does not terminate before the set data ends.
112 .LSet7End:
114 ## This set occupies some space after the terminator.
115 # ERR: error: name lookup table at offset 0x75 has a terminator at offset 0x8c before the expected end at 0x8d
116 # CHECK-NEXT: length = 0x00000018, format = DWARF32, version = 0x0002, unit_offset = 0x00000154, unit_size = 0x000002ac
117 # CHECK-NEXT: Offset Linkage Kind Name
118 # CHECK-NEXT: 0x0000018e EXTERNAL FUNCTION "foo"
119 # CHECK-NOT: 0x
120 .long .LSet8End-.LSet8 # Length
121 .LSet8:
122 .short 2 # Version
123 .long 0x154 # Debug Info Offset
124 .long 0x2ac # Debug Info Length
125 .long 0x18e # Offset
126 .byte 0x30 # Index Entry
127 .asciz "foo" # Name
128 .long 0 # Terminator
129 .space 1
130 .LSet8End:
132 ## The remaining space in the section is too short to even contain a unit length
133 ## field.
134 # ERR: error: name lookup table at offset 0x91 parsing failed: unexpected end of data at offset 0x94 while reading [0x91, 0x95)
135 # CHECK-NOT: length =
136 .space 3
138 # ERR-MIN: .debug_pubnames contents:
139 # ERR-MIN-NEXT: error: name lookup table at offset 0x0 parsing failed: unexpected end of data at offset 0x1 while reading [0x0, 0x4)
140 # ERR-MIN: .debug_pubtypes contents:
141 # ERR-MIN-NEXT: error: name lookup table at offset 0x0 parsing failed: unexpected end of data at offset 0x1 while reading [0x0, 0x4)
142 # ERR-MIN: .debug_gnu_pubtypes contents:
143 # ERR-MIN-NEXT: error: name lookup table at offset 0x0 parsing failed: unexpected end of data at offset 0x1 while reading [0x0, 0x4)
145 .section .debug_pubnames,"",@progbits
146 .byte 0
147 .section .debug_pubtypes,"",@progbits
148 .byte 0
149 .section .debug_gnu_pubtypes,"",@progbits
150 .byte 0