1 # RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
2 # RUN: | not llvm-dwarfdump -verify - \
5 # CHECK: Verifying .apple_names...
6 # CHECK-NEXT: error: Bucket[0] has invalid hash index: 4294967294.
7 # CHECK-NEXT: error: Hash[0] has invalid HashData offset: 0x000000b4.
8 # CHECK-NEXT: error: .apple_names Bucket[1] Hash[1] = 0x0002b60f Str[0] = 0x0000005a DIE[0] = 0x00000001 is not a valid DIE offset for "j".
10 # This test is meant to verify that the -verify option
11 # in llvm-dwarfdump, correctly identifies
12 # an invalid hash index for bucket[0] in the .apple_names section,
13 # an invalid HashData offset for Hash[0], as well as
14 # an invalid DIE offset in the .debug_info section.
15 # We're reading an invalid DIE due to the incorrect interpretation of DW_FORM for the DIE.
16 # Instead of DW_FORM_data4 the Atom[0].form is: DW_FORM_flag_present.
18 .section __TEXT,__text,regular,pure_instructions
22 .section __DWARF,__debug_str,regular,debug
24 .asciz "Apple LLVM version 8.1.0 (clang-802.0.35)" ## string offset=0
25 .asciz "basic.c" ## string offset=42
26 .asciz "/Users/sgravani/Development/tests" ## string offset=50
27 .asciz "i" ## string offset=84
28 .asciz "int" ## string offset=86
29 .asciz "j" ## string offset=90
30 .section __DWARF,__debug_info,regular,debug
32 .section __DWARF,__apple_names,regular,debug
34 .long 1212240712 ## Header Magic
35 .short 1 ## Header Version
36 .short 0 ## Header Hash Function
37 .long 2 ## Header Bucket Count
38 .long 2 ## Header Hash Count
39 .long 12 ## Header Data Length
40 .long 0 ## HeaderData Die Offset Base
41 .long 1 ## HeaderData Atom Count
42 .short 1 ## DW_ATOM_die_offset
43 .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".
44 .long -2 ## Bucket 0 -- error: Bucket[0] has invalid hash index: 4294967294.
46 .long 177678 ## Hash in Bucket 0
47 .long 177679 ## Hash in Bucket 1
48 .long Lsection_line ## Offset in Bucket 0 -- error: Hash[0] has invalid HashData offset: 0x000000b4.
49 .long LNames1-Lnames_begin ## Offset in Bucket 1
61 .subsections_via_symbols
62 .section __DWARF,__debug_line,regular,debug