llvm.org GIT mirror llvm / 7eed737
[DWARF] Added verification checks for the .apple_names section. This patch verifies the number of atoms, the validity of the form for each atom, as well as the validity of the hashdata. For hashdata, we're verifying that the hashdata offset is correct and that the offset in the .debug_info for each DIE in the hashdata is also valid. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306735 91177308-0d34-0410-b5e6-96231b3b80d8 Spyridoula Gravani 3 years ago
11 changed file(s) with 336 addition(s) and 369 deletion(s). Raw diff Collapse all Expand all
6060 // Not inside an enum because a 64-bit value is needed.
6161 const uint32_t DW_CIE_ID = UINT32_MAX;
6262 const uint64_t DW64_CIE_ID = UINT64_MAX;
63
64 // Identifier of an invalid DIE offset in the .debug_info section.
65 const uint32_t DW_INVALID_OFFSET = UINT32_MAX;
6366
6467 enum Tag : uint16_t {
6568 #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) DW_TAG_##NAME = ID,
5353 uint32_t getNumHashes();
5454 uint32_t getSizeHdr();
5555 uint32_t getHeaderDataLength();
56 ArrayRef> getAtomsDesc();
57 bool validateForms();
58
59 /// Return information related to the DWARF DIE we're looking for when
60 /// performing a lookup by name.
61 ///
62 /// \param HashDataOffset an offset into the hash data table
63 /// \returns DIEOffset the offset into the .debug_info section for the DIE
64 /// related to the input hash data offset. Currently this function returns
65 /// only the DIEOffset but it can be modified to return more data regarding
66 /// the DIE
67 uint32_t readAtoms(uint32_t &HashDataOffset);
5668 void dump(raw_ostream &OS) const;
5769 };
5870
5959 uint32_t DWARFAcceleratorTable::getSizeHdr() { return sizeof(Hdr); }
6060 uint32_t DWARFAcceleratorTable::getHeaderDataLength() {
6161 return Hdr.HeaderDataLength;
62 }
63
64 ArrayRef
65 DWARFAcceleratorTable::HeaderData::Form>>
66 DWARFAcceleratorTable::getAtomsDesc() {
67 return HdrData.Atoms;
68 }
69
70 bool DWARFAcceleratorTable::validateForms() {
71 for (auto Atom : getAtomsDesc()) {
72 DWARFFormValue FormValue(Atom.second);
73 switch (Atom.first) {
74 case dwarf::DW_ATOM_die_offset:
75 if ((!FormValue.isFormClass(DWARFFormValue::FC_Constant) &&
76 !FormValue.isFormClass(DWARFFormValue::FC_Flag)) ||
77 FormValue.getForm() == dwarf::DW_FORM_sdata)
78 return false;
79 default:
80 break;
81 }
82 }
83 return true;
84 }
85
86 uint32_t DWARFAcceleratorTable::readAtoms(uint32_t &HashDataOffset) {
87 uint32_t DieOffset = dwarf::DW_INVALID_OFFSET;
88
89 for (auto Atom : getAtomsDesc()) {
90 DWARFFormValue FormValue(Atom.second);
91 FormValue.extractValue(AccelSection, &HashDataOffset, NULL);
92 switch (Atom.first) {
93 case dwarf::DW_ATOM_die_offset:
94 DieOffset = *FormValue.getAsUnsignedConstant();
95 break;
96 default:
97 break;
98 }
99 }
100 return DieOffset;
62101 }
63102
64103 LLVM_DUMP_METHOD void DWARFAcceleratorTable::dump(raw_ostream &OS) const {
290290
291291 OS << "Verifying .apple_names...\n";
292292
293 // Verify that all buckets have a valid hash index or are empty
293 // Verify that all buckets have a valid hash index or are empty.
294294 uint32_t NumBuckets = AppleNames.getNumBuckets();
295295 uint32_t NumHashes = AppleNames.getNumHashes();
296296
297297 uint32_t BucketsOffset =
298298 AppleNames.getSizeHdr() + AppleNames.getHeaderDataLength();
299 uint32_t HashesBase = BucketsOffset + NumBuckets * 4;
300 uint32_t OffsetsBase = HashesBase + NumHashes * 4;
299301
300302 for (uint32_t BucketIdx = 0; BucketIdx < NumBuckets; ++BucketIdx) {
301303 uint32_t HashIdx = AppleNamesSection.getU32(&BucketsOffset);
302304 if (HashIdx >= NumHashes && HashIdx != UINT32_MAX) {
303 OS << format("error: Bucket[%d] has invalid hash index: [%d]\n",
304 BucketIdx, HashIdx);
305 OS << format("error: Bucket[%d] has invalid hash index: %u\n", BucketIdx,
306 HashIdx);
305307 ++NumAppleNamesErrors;
306308 }
307309 }
310
311 uint32_t NumAtoms = AppleNames.getAtomsDesc().size();
312 if (NumAtoms == 0) {
313 OS << "error: no atoms; failed to read HashData\n";
314 ++NumAppleNamesErrors;
315 return false;
316 }
317
318 if (!AppleNames.validateForms()) {
319 OS << "error: unsupported form; failed to read HashData\n";
320 ++NumAppleNamesErrors;
321 return false;
322 }
323
324 for (uint32_t HashIdx = 0; HashIdx < NumHashes; ++HashIdx) {
325 uint32_t HashOffset = HashesBase + 4 * HashIdx;
326 uint32_t DataOffset = OffsetsBase + 4 * HashIdx;
327 uint32_t Hash = AppleNamesSection.getU32(&HashOffset);
328 uint32_t HashDataOffset = AppleNamesSection.getU32(&DataOffset);
329 if (!AppleNamesSection.isValidOffsetForDataOfSize(HashDataOffset,
330 sizeof(uint64_t))) {
331 OS << format("error: Hash[%d] has invalid HashData offset: 0x%08x\n",
332 HashIdx, HashDataOffset);
333 ++NumAppleNamesErrors;
334 }
335
336 uint32_t StrpOffset;
337 uint32_t StringOffset;
338 uint32_t StringCount = 0;
339 uint32_t DieOffset = dwarf::DW_INVALID_OFFSET;
340
341 while ((StrpOffset = AppleNamesSection.getU32(&HashDataOffset)) != 0) {
342 const uint32_t NumHashDataObjects =
343 AppleNamesSection.getU32(&HashDataOffset);
344 for (uint32_t HashDataIdx = 0; HashDataIdx < NumHashDataObjects;
345 ++HashDataIdx) {
346 DieOffset = AppleNames.readAtoms(HashDataOffset);
347 if (!DCtx.getDIEForOffset(DieOffset)) {
348 const uint32_t BucketIdx =
349 NumBuckets ? (Hash % NumBuckets) : UINT32_MAX;
350 StringOffset = StrpOffset;
351 const char *Name = StrData.getCStr(&StringOffset);
352 if (!Name)
353 Name = "";
354
355 OS << format(
356 "error: .apple_names Bucket[%d] Hash[%d] = 0x%08x "
357 "Str[%u] = 0x%08x "
358 "DIE[%d] = 0x%08x is not a valid DIE offset for \"%s\".\n",
359 BucketIdx, HashIdx, Hash, StringCount, StrpOffset, HashDataIdx,
360 DieOffset, Name);
361
362 ++NumAppleNamesErrors;
363 }
364 }
365 ++StringCount;
366 }
367 }
308368 return NumAppleNamesErrors == 0;
309369 }
0 RUN: llvm-dwarfdump %p/Inputs/dwarfdump-objc.x86_64.o | FileCheck %s
1 RUN: llvm-dwarfdump -verify %p/Inputs/dwarfdump-objc.x86_64.o | FileCheck %s --check-prefix=VERIFY
12
23 Gather some DIE indexes to verify the accelerator table contents.
34 CHECK: .debug_info contents
6263 CHECK: {Atom[0]: [[READONLY]]}
6364 CHECK: {Atom[0]: [[ASSIGN]]}
6465 CHECK: {Atom[0]: [[SETASSIGN]]}
66
67 Verify the debug info in the apple_names accelerator table.
68 VERIFY: Verifying .apple_names
69 VERIFY-NEXT: No errors.
+0
-192
test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s less more
None # RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
1 # RUN: | not llvm-dwarfdump -verify - \
2 # RUN: | FileCheck %s
3
4 # CHECK: Verifying .apple_names...
5 # CHECK-NEXT: error: Bucket[0] has invalid hash index: [-2]
6
7 # This test is meant to verify that the -verify option
8 # in llvm-dwarfdump, correctly identifies
9 # an invalid hash index for bucket[0] in the .apple_names section.
10
11 .section __TEXT,__text,regular,pure_instructions
12 .file 1 "basic.c"
13 .comm _i,4,2 ## @i
14 .section __DWARF,__debug_str,regular,debug
15 Linfo_string:
16 .asciz "basic.c" ## string offset=42
17 .asciz "i" ## string offset=84
18 .asciz "int" ## string offset=86
19 .section __DWARF,__debug_loc,regular,debug
20 Lsection_debug_loc:
21 .section __DWARF,__debug_abbrev,regular,debug
22 Lsection_abbrev:
23 .byte 1 ## Abbreviation Code
24 .byte 17 ## DW_TAG_compile_unit
25 .byte 1 ## DW_CHILDREN_yes
26 .byte 37 ## DW_AT_producer
27 .byte 14 ## DW_FORM_strp
28 .byte 19 ## DW_AT_language
29 .byte 5 ## DW_FORM_data2
30 .byte 3 ## DW_AT_name
31 .byte 14 ## DW_FORM_strp
32 .byte 16 ## DW_AT_stmt_list
33 .byte 23 ## DW_FORM_sec_offset
34 .byte 27 ## DW_AT_comp_dir
35 .byte 14 ## DW_FORM_strp
36 .byte 0 ## EOM(1)
37 .byte 0 ## EOM(2)
38 .byte 2 ## Abbreviation Code
39 .byte 52 ## DW_TAG_variable
40 .byte 0 ## DW_CHILDREN_no
41 .byte 3 ## DW_AT_name
42 .byte 14 ## DW_FORM_strp
43 .byte 73 ## DW_AT_type
44 .byte 19 ## DW_FORM_ref4
45 .byte 63 ## DW_AT_external
46 .byte 25 ## DW_FORM_flag_present
47 .byte 58 ## DW_AT_decl_file
48 .byte 11 ## DW_FORM_data1
49 .byte 59 ## DW_AT_decl_line
50 .byte 11 ## DW_FORM_data1
51 .byte 2 ## DW_AT_location
52 .byte 24 ## DW_FORM_exprloc
53 .byte 0 ## EOM(1)
54 .byte 0 ## EOM(2)
55 .byte 3 ## Abbreviation Code
56 .byte 36 ## DW_TAG_base_type
57 .byte 0 ## DW_CHILDREN_no
58 .byte 3 ## DW_AT_name
59 .byte 14 ## DW_FORM_strp
60 .byte 62 ## DW_AT_encoding
61 .byte 11 ## DW_FORM_data1
62 .byte 11 ## DW_AT_byte_size
63 .byte 11 ## DW_FORM_data1
64 .byte 0 ## EOM(1)
65 .byte 0 ## EOM(2)
66 .byte 0 ## EOM(3)
67 .section __DWARF,__debug_info,regular,debug
68 Lsection_info:
69 Lcu_begin0:
70 .long 55 ## Length of Unit
71 .short 4 ## DWARF version number
72 Lset0 = Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section
73 .long Lset0
74 .byte 8 ## Address Size (in bytes)
75 .byte 1 ## Abbrev [1] 0xb:0x30 DW_TAG_compile_unit
76 .long 0 ## DW_AT_producer
77 .short 12 ## DW_AT_language
78 .long 42 ## DW_AT_name
79 Lset1 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
80 .long Lset1
81 .long 50 ## DW_AT_comp_dir
82 .byte 2 ## Abbrev [2] 0x1e:0x15 DW_TAG_variable
83 .long 84 ## DW_AT_name
84 .long 51 ## DW_AT_type
85 ## DW_AT_external
86 .byte 1 ## DW_AT_decl_file
87 .byte 1 ## DW_AT_decl_line
88 .byte 9 ## DW_AT_location
89 .byte 3
90 .quad _i
91 .byte 3 ## Abbrev [3] 0x33:0x7 DW_TAG_base_type
92 .long 86 ## DW_AT_name
93 .byte 5 ## DW_AT_encoding
94 .byte 4 ## DW_AT_byte_size
95 .byte 0 ## End Of Children Mark
96 .section __DWARF,__debug_ranges,regular,debug
97 Ldebug_range:
98 .section __DWARF,__debug_macinfo,regular,debug
99 Ldebug_macinfo:
100 Lcu_macro_begin0:
101 .byte 0 ## End Of Macro List Mark
102 .section __DWARF,__apple_names,regular,debug
103 Lnames_begin:
104 .long 1212240712 ## Header Magic
105 .short 1 ## Header Version
106 .short 0 ## Header Hash Function
107 .long 1 ## Header Bucket Count
108 .long 1 ## Header Hash Count
109 .long 12 ## Header Data Length
110 .long 0 ## HeaderData Die Offset Base
111 .long 1 ## HeaderData Atom Count
112 .short 1 ## DW_ATOM_die_offset
113 .short 6 ## DW_FORM_data4
114 .long -2 ## Bucket 0 -- error: Bucket[0] has invalid hash index: [-2]
115 .long 177678 ## Hash in Bucket 0
116 .long LNames0-Lnames_begin ## Offset in Bucket 0
117 LNames0:
118 .long 84 ## i
119 .long 1 ## Num DIEs
120 .long 30
121 .long 0
122 .section __DWARF,__apple_objc,regular,debug
123 Lobjc_begin:
124 .long 1212240712 ## Header Magic
125 .short 1 ## Header Version
126 .short 0 ## Header Hash Function
127 .long 1 ## Header Bucket Count
128 .long 0 ## Header Hash Count
129 .long 12 ## Header Data Length
130 .long 0 ## HeaderData Die Offset Base
131 .long 1 ## HeaderData Atom Count
132 .short 1 ## DW_ATOM_die_offset
133 .short 6 ## DW_FORM_data4
134 .long -1 ## Bucket 0
135 .section __DWARF,__apple_namespac,regular,debug
136 Lnamespac_begin:
137 .long 1212240712 ## Header Magic
138 .short 1 ## Header Version
139 .short 0 ## Header Hash Function
140 .long 1 ## Header Bucket Count
141 .long 0 ## Header Hash Count
142 .long 12 ## Header Data Length
143 .long 0 ## HeaderData Die Offset Base
144 .long 1 ## HeaderData Atom Count
145 .short 1 ## DW_ATOM_die_offset
146 .short 6 ## DW_FORM_data4
147 .long -1 ## Bucket 0
148 .section __DWARF,__apple_types,regular,debug
149 Ltypes_begin:
150 .long 1212240712 ## Header Magic
151 .short 1 ## Header Version
152 .short 0 ## Header Hash Function
153 .long 1 ## Header Bucket Count
154 .long 1 ## Header Hash Count
155 .long 20 ## Header Data Length
156 .long 0 ## HeaderData Die Offset Base
157 .long 3 ## HeaderData Atom Count
158 .short 1 ## DW_ATOM_die_offset
159 .short 6 ## DW_FORM_data4
160 .short 3 ## DW_ATOM_die_tag
161 .short 5 ## DW_FORM_data2
162 .short 4 ## DW_ATOM_type_flags
163 .short 11 ## DW_FORM_data1
164 .long 0 ## Bucket 0
165 .long 193495088 ## Hash in Bucket 0
166 .long Ltypes0-Ltypes_begin ## Offset in Bucket 0
167 Ltypes0:
168 .long 86 ## int
169 .long 1 ## Num DIEs
170 .long 51
171 .short 36
172 .byte 0
173 .long 0
174 .section __DWARF,__apple_exttypes,regular,debug
175 Lexttypes_begin:
176 .long 1212240712 ## Header Magic
177 .short 1 ## Header Version
178 .short 0 ## Header Hash Function
179 .long 1 ## Header Bucket Count
180 .long 0 ## Header Hash Count
181 .long 12 ## Header Data Length
182 .long 0 ## HeaderData Die Offset Base
183 .long 1 ## HeaderData Atom Count
184 .short 7 ## DW_ATOM_ext_types
185 .short 6 ## DW_FORM_data4
186 .long -1 ## Bucket 0
187
188 .subsections_via_symbols
189 .section __DWARF,__debug_line,regular,debug
190 Lsection_line:
191 Lline_table_start0:
0 # RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
1 # RUN: | not llvm-dwarfdump -verify - \
2 # RUN: | FileCheck %s
3
4 # CHECK: Verifying .apple_names...
5 # CHECK-NEXT: error: Bucket[0] has invalid hash index: 4294967294
6 # CHECK-NEXT: error: Hash[0] has invalid HashData offset: 0x000000b4
7 # CHECK-NEXT: error: .apple_names Bucket[1] Hash[1] = 0x0002b60f Str[0] = 0x0000005a DIE[0] = 0x00000001 is not a valid DIE offset for "j".
8
9 # This test is meant to verify that the -verify option
10 # in llvm-dwarfdump, correctly identifies
11 # an invalid hash index for bucket[0] in the .apple_names section,
12 # an invalid HashData offset for Hash[0], as well as
13 # an invalid DIE offset in the .debug_info section.
14 # We're reading an invalid DIE due to the incorrect interpretation of DW_FORM for the DIE.
15 # Instead of DW_FORM_data4 the Atom[0].form is: DW_FORM_flag_present.
16
17 .section __TEXT,__text,regular,pure_instructions
18 .file 1 "basic.c"
19 .comm _i,4,2 ## @i
20 .comm _j,4,2 ## @j
21 .section __DWARF,__debug_str,regular,debug
22 Linfo_string:
23 .asciz "Apple LLVM version 8.1.0 (clang-802.0.35)" ## string offset=0
24 .asciz "basic.c" ## string offset=42
25 .asciz "/Users/sgravani/Development/tests" ## string offset=50
26 .asciz "i" ## string offset=84
27 .asciz "int" ## string offset=86
28 .asciz "j" ## string offset=90
29 .section __DWARF,__debug_info,regular,debug
30 Lsection_info:
31 .section __DWARF,__apple_names,regular,debug
32 Lnames_begin:
33 .long 1212240712 ## Header Magic
34 .short 1 ## Header Version
35 .short 0 ## Header Hash Function
36 .long 2 ## Header Bucket Count
37 .long 2 ## Header Hash Count
38 .long 12 ## Header Data Length
39 .long 0 ## HeaderData Die Offset Base
40 .long 1 ## HeaderData Atom Count
41 .short 1 ## DW_ATOM_die_offset
42 .short 25 ## DW_FORM_data4 -- error: .apple_names Bucket[1] Hash[1] = 0x0002b60f Str[0] = 0x0000005a DIE[0] = 0x00000001 is not a valid DIE offset for "j".
43 .long -2 ## Bucket 0 -- error: Bucket[0] has invalid hash index: 4294967294
44 .long 1 ## Bucket 1
45 .long 177678 ## Hash in Bucket 0
46 .long 177679 ## Hash in Bucket 1
47 .long Lsection_line ## Offset in Bucket 0 -- error: Hash[0] has invalid HashData offset: 0x000000b4
48 .long LNames1-Lnames_begin ## Offset in Bucket 1
49 LNames0:
50 .long 84 ## i
51 .long 1 ## Num DIEs
52 .long 30
53 .long 0
54 LNames1:
55 .long 90 ## j
56 .long 1 ## Num DIEs
57 .long 58
58 .long 0
59
60 .subsections_via_symbols
61 .section __DWARF,__debug_line,regular,debug
62 Lsection_line:
63 Lline_table_start0:
0 # RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
1 # RUN: | not llvm-dwarfdump -verify - \
2 # RUN: | FileCheck %s
3
4 # CHECK: Verifying .apple_names...
5 # CHECK-NEXT: error: unsupported form; failed to read HashData
6
7 # This test is meant to verify that the -verify option
8 # in llvm-dwarfdump, correctly identifies that Atom[0].form is unsupported.
9 # As a result, the hashdata cannot be read.
10
11 .section __TEXT,__text,regular,pure_instructions
12 .file 1 "basic.c"
13 .comm _i,4,2 ## @i
14 .comm _j,4,2 ## @j
15 .section __DWARF,__debug_str,regular,debug
16 Linfo_string:
17 .asciz "Apple LLVM version 8.1.0 (clang-802.0.35)" ## string offset=0
18 .asciz "basic.c" ## string offset=42
19 .asciz "/Users/sgravani/Development/tests" ## string offset=50
20 .asciz "i" ## string offset=84
21 .asciz "int" ## string offset=86
22 .asciz "j" ## string offset=90
23 .section __DWARF,__debug_info,regular,debug
24 Lsection_info:
25 .section __DWARF,__apple_names,regular,debug
26 Lnames_begin:
27 .long 1212240712 ## Header Magic
28 .short 1 ## Header Version
29 .short 0 ## Header Hash Function
30 .long 2 ## Header Bucket Count
31 .long 2 ## Header Hash Count
32 .long 12 ## Header Data Length
33 .long 0 ## HeaderData Die Offset Base
34 .long 1 ## HeaderData Atom Count
35 .short 1 ## DW_ATOM_die_offset
36 .short 400 ## DW_FORM_data4 -- error: unsupported form; failed to read HashData
37 .long 0 ## Bucket 0
38 .long 1 ## Bucket 1
39 .long 177678 ## Hash in Bucket 0
40 .long 177679 ## Hash in Bucket 1
41 .long LNames0-Lnames_begin ## Offset in Bucket 0
42 .long LNames1-Lnames_begin ## Offset in Bucket 1
43 LNames0:
44 .long 84 ## i
45 .long 1 ## Num DIEs
46 .long 30
47 .long 0
48 LNames1:
49 .long 90 ## j
50 .long 1 ## Num DIEs
51 .long 58
52 .long 0
53
54 .subsections_via_symbols
55 .section __DWARF,__debug_line,regular,debug
56 Lsection_line:
57 Lline_table_start0:
0 # RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
1 # RUN: | not llvm-dwarfdump -verify - \
2 # RUN: | FileCheck %s
3
4 # CHECK: Verifying .apple_names...
5 # CHECK-NEXT: error: no atoms; failed to read HashData
6
7 # This test is meant to verify that the -verify option
8 # in llvm-dwarfdump, correctly identifies that there is not Atom.
9 # As a result, the hashdata cannot be read.
10
11 .section __TEXT,__text,regular,pure_instructions
12 .file 1 "basic.c"
13 .comm _i,4,2 ## @i
14 .comm _j,4,2 ## @j
15 .section __DWARF,__debug_str,regular,debug
16 Linfo_string:
17 .asciz "Apple LLVM version 8.1.0 (clang-802.0.35)" ## string offset=0
18 .asciz "basic.c" ## string offset=42
19 .asciz "/Users/sgravani/Development/tests" ## string offset=50
20 .asciz "i" ## string offset=84
21 .asciz "int" ## string offset=86
22 .asciz "j" ## string offset=90
23
24 .section __DWARF,__debug_info,regular,debug
25 Lsection_info:
26 .section __DWARF,__apple_names,regular,debug
27 Lnames_begin:
28 .long 1212240712 ## Header Magic
29 .short 1 ## Header Version
30 .short 0 ## Header Hash Function
31 .long 2 ## Header Bucket Count
32 .long 2 ## Header Hash Count
33 .long 12 ## Header Data Length
34 .long 0 ## HeaderData Die Offset Base
35 .long 0 ## HeaderData Atom Count -- error: no atoms; failed to read HashData
36 .short 1 ## DW_ATOM_die_offset
37 .short 6 ## DW_FORM_data4
38 .long 0 ## Bucket 0
39 .long 1 ## Bucket 1
40 .long 177678 ## Hash in Bucket 0
41 .long 177679 ## Hash in Bucket 1
42 .long LNames0-Lnames_begin ## Offset in Bucket 0
43 .long LNames1-Lnames_begin ## Offset in Bucket 1
44 LNames0:
45 .long 84 ## i
46 .long 1 ## Num DIEs
47 .long 30
48 .long 0
49 LNames1:
50 .long 90 ## j
51 .long 1 ## Num DIEs
52 .long 58
53 .long 0
54
55 .subsections_via_symbols
56 .section __DWARF,__debug_line,regular,debug
57 Lsection_line:
58 Lline_table_start0:
0 # RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
1 # RUN: | llvm-dwarfdump -verify - \
2 # RUN: | FileCheck %s
3
4 # CHECK-NOT: Verifying .apple_names...
5
6 # This test is meant to verify that the -verify option
7 # in llvm-dwarfdump doesn't produce any .apple_names related
8 # output when there's no such section in the object.
9 # The test was manually modified to exclude the
10 # .apple_names section from the apple_names_verify_num_atoms.s
11 # test file in the same directory.
12
13 .section __TEXT,__text,regular,pure_instructions
14 .file 1 "basic.c"
15 .comm _i,4,2 ## @i
16 .comm _j,4,2 ## @j
17 .section __DWARF,__debug_str,regular,debug
18 Linfo_string:
19 .asciz "Apple LLVM version 8.1.0 (clang-802.0.35)" ## string offset=0
20 .asciz "basic.c" ## string offset=42
21 .asciz "/Users/sgravani/Development/tests" ## string offset=50
22 .asciz "i" ## string offset=84
23 .asciz "int" ## string offset=86
24 .asciz "j" ## string offset=90
25
26 .section __DWARF,__debug_info,regular,debug
27 Lsection_info:
28
29 .subsections_via_symbols
30 .section __DWARF,__debug_line,regular,debug
31 Lsection_line:
32 Lline_table_start0:
+0
-174
test/tools/llvm-dwarfdump/X86/no_apple_names_verify_buckets.s less more
None # RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
1 # RUN: | not llvm-dwarfdump -verify - \
2 # RUN: | FileCheck %s
3
4 # CHECK-NOT: Verifying .apple_names...
5
6 # This test is meant to verify that the -verify option
7 # in llvm-dwarfdump doesn't produce any .apple_names related
8 # output when there's no such section int he object.
9 # The test was manually modified to exclude the
10 # .apple_names section from the apple_names_verify_buckets.s
11 # test file in the same directory.
12
13 .section __TEXT,__text,regular,pure_instructions
14 .file 1 "basic.c"
15 .comm _i,4,2 ## @i
16 .section __DWARF,__debug_str,regular,debug
17 Linfo_string:
18 .asciz "basic.c" ## string offset=42
19 .asciz "i" ## string offset=84
20 .asciz "int" ## string offset=86
21 .section __DWARF,__debug_loc,regular,debug
22 Lsection_debug_loc:
23 .section __DWARF,__debug_abbrev,regular,debug
24 Lsection_abbrev:
25 .byte 1 ## Abbreviation Code
26 .byte 17 ## DW_TAG_compile_unit
27 .byte 1 ## DW_CHILDREN_yes
28 .byte 37 ## DW_AT_producer
29 .byte 14 ## DW_FORM_strp
30 .byte 19 ## DW_AT_language
31 .byte 5 ## DW_FORM_data2
32 .byte 3 ## DW_AT_name
33 .byte 14 ## DW_FORM_strp
34 .byte 16 ## DW_AT_stmt_list
35 .byte 23 ## DW_FORM_sec_offset
36 .byte 27 ## DW_AT_comp_dir
37 .byte 14 ## DW_FORM_strp
38 .byte 0 ## EOM(1)
39 .byte 0 ## EOM(2)
40 .byte 2 ## Abbreviation Code
41 .byte 52 ## DW_TAG_variable
42 .byte 0 ## DW_CHILDREN_no
43 .byte 3 ## DW_AT_name
44 .byte 14 ## DW_FORM_strp
45 .byte 73 ## DW_AT_type
46 .byte 19 ## DW_FORM_ref4
47 .byte 63 ## DW_AT_external
48 .byte 25 ## DW_FORM_flag_present
49 .byte 58 ## DW_AT_decl_file
50 .byte 11 ## DW_FORM_data1
51 .byte 59 ## DW_AT_decl_line
52 .byte 11 ## DW_FORM_data1
53 .byte 2 ## DW_AT_location
54 .byte 24 ## DW_FORM_exprloc
55 .byte 0 ## EOM(1)
56 .byte 0 ## EOM(2)
57 .byte 3 ## Abbreviation Code
58 .byte 36 ## DW_TAG_base_type
59 .byte 0 ## DW_CHILDREN_no
60 .byte 3 ## DW_AT_name
61 .byte 14 ## DW_FORM_strp
62 .byte 62 ## DW_AT_encoding
63 .byte 11 ## DW_FORM_data1
64 .byte 11 ## DW_AT_byte_size
65 .byte 11 ## DW_FORM_data1
66 .byte 0 ## EOM(1)
67 .byte 0 ## EOM(2)
68 .byte 0 ## EOM(3)
69 .section __DWARF,__debug_info,regular,debug
70 Lsection_info:
71 Lcu_begin0:
72 .long 55 ## Length of Unit
73 .short 4 ## DWARF version number
74 Lset0 = Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section
75 .long Lset0
76 .byte 8 ## Address Size (in bytes)
77 .byte 1 ## Abbrev [1] 0xb:0x30 DW_TAG_compile_unit
78 .long 0 ## DW_AT_producer
79 .short 12 ## DW_AT_language
80 .long 42 ## DW_AT_name
81 Lset1 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
82 .long Lset1
83 .long 50 ## DW_AT_comp_dir
84 .byte 2 ## Abbrev [2] 0x1e:0x15 DW_TAG_variable
85 .long 84 ## DW_AT_name
86 .long 51 ## DW_AT_type
87 ## DW_AT_external
88 .byte 1 ## DW_AT_decl_file
89 .byte 1 ## DW_AT_decl_line
90 .byte 9 ## DW_AT_location
91 .byte 3
92 .quad _i
93 .byte 3 ## Abbrev [3] 0x33:0x7 DW_TAG_base_type
94 .long 86 ## DW_AT_name
95 .byte 5 ## DW_AT_encoding
96 .byte 4 ## DW_AT_byte_size
97 .byte 0 ## End Of Children Mark
98 .section __DWARF,__debug_ranges,regular,debug
99 Ldebug_range:
100 .section __DWARF,__debug_macinfo,regular,debug
101 Ldebug_macinfo:
102 Lcu_macro_begin0:
103 .byte 0 ## End Of Macro List Mark
104 .section __DWARF,__apple_objc,regular,debug
105 Lobjc_begin:
106 .long 1212240712 ## Header Magic
107 .short 1 ## Header Version
108 .short 0 ## Header Hash Function
109 .long 1 ## Header Bucket Count
110 .long 0 ## Header Hash Count
111 .long 12 ## Header Data Length
112 .long 0 ## HeaderData Die Offset Base
113 .long 1 ## HeaderData Atom Count
114 .short 1 ## DW_ATOM_die_offset
115 .short 6 ## DW_FORM_data4
116 .long -1 ## Bucket 0
117 .section __DWARF,__apple_namespac,regular,debug
118 Lnamespac_begin:
119 .long 1212240712 ## Header Magic
120 .short 1 ## Header Version
121 .short 0 ## Header Hash Function
122 .long 1 ## Header Bucket Count
123 .long 0 ## Header Hash Count
124 .long 12 ## Header Data Length
125 .long 0 ## HeaderData Die Offset Base
126 .long 1 ## HeaderData Atom Count
127 .short 1 ## DW_ATOM_die_offset
128 .short 6 ## DW_FORM_data4
129 .long -1 ## Bucket 0
130 .section __DWARF,__apple_types,regular,debug
131 Ltypes_begin:
132 .long 1212240712 ## Header Magic
133 .short 1 ## Header Version
134 .short 0 ## Header Hash Function
135 .long 1 ## Header Bucket Count
136 .long 1 ## Header Hash Count
137 .long 20 ## Header Data Length
138 .long 0 ## HeaderData Die Offset Base
139 .long 3 ## HeaderData Atom Count
140 .short 1 ## DW_ATOM_die_offset
141 .short 6 ## DW_FORM_data4
142 .short 3 ## DW_ATOM_die_tag
143 .short 5 ## DW_FORM_data2
144 .short 4 ## DW_ATOM_type_flags
145 .short 11 ## DW_FORM_data1
146 .long 0 ## Bucket 0
147 .long 193495088 ## Hash in Bucket 0
148 .long Ltypes0-Ltypes_begin ## Offset in Bucket 0
149 Ltypes0:
150 .long 86 ## int
151 .long 1 ## Num DIEs
152 .long 51
153 .short 36
154 .byte 0
155 .long 0
156 .section __DWARF,__apple_exttypes,regular,debug
157 Lexttypes_begin:
158 .long 1212240712 ## Header Magic
159 .short 1 ## Header Version
160 .short 0 ## Header Hash Function
161 .long 1 ## Header Bucket Count
162 .long 0 ## Header Hash Count
163 .long 12 ## Header Data Length
164 .long 0 ## HeaderData Die Offset Base
165 .long 1 ## HeaderData Atom Count
166 .short 7 ## DW_ATOM_ext_types
167 .short 6 ## DW_FORM_data4
168 .long -1 ## Bucket 0
169
170 .subsections_via_symbols
171 .section __DWARF,__debug_line,regular,debug
172 Lsection_line:
173 Lline_table_start0: