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
21 .long .LSet0End-.LSet0 # Length
23 .byte 1 # Version (truncated)
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
30 .long .LSet1End-.LSet1 # Length
33 .byte 1, 2, 3 # Debug Info Offset (truncated)
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
40 .long .LSet2End-.LSet2 # Length
43 .long 0x32 # Debug Info Offset
44 .byte 1, 2, 3 # Debug Info Length (truncated)
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
52 .long .LSet3End-.LSet3 # Length
55 .long 0x48 # Debug Info Offset
56 .long 0x64 # Debug Info Length
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
64 .long .LSet4End-.LSet4 # Length
67 .long 0xac # Debug Info Offset
68 .long 0x36 # Debug Info Length
69 .byte 1, 2, 3 # Offset (truncated)
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
77 .long .LSet5End-.LSet5 # Length
80 .long 0xe2 # Debug Info Offset
81 .long 0x15 # Debug Info Length
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
90 .long .LSet6End-.LSet6 # Length
93 .long 0xf7 # Debug Info Offset
94 .long 0x10 # Debug Info Length
96 .byte 0x30 # Index Entry
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
104 .long .LSet7End-.LSet7 # Length
107 .long 0x107 # Debug Info Offset
108 .long 0x4b # Debug Info Length
110 .byte 0x30 # Index Entry
111 .ascii "foo" # The string does not terminate before the set data ends.
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"
120 .long .LSet8End-.LSet8 # Length
123 .long 0x154 # Debug Info Offset
124 .long 0x2ac # Debug Info Length
126 .byte 0x30 # Index Entry
132 ## The remaining space in the section is too short to even contain a unit length
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 =
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
147 .section .debug_pubtypes,"",@progbits
149 .section .debug_gnu_pubtypes,"",@progbits