reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
   60
   61
   62
   63
   64
# RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
# RUN: | not llvm-dwarfdump -verify - \
# RUN: | FileCheck %s

# CHECK: Verifying .apple_names...
# CHECK-NEXT:	error: Bucket[0] has invalid hash index: 4294967294.
# CHECK-NEXT:	error: Hash[0] has invalid HashData offset: 0x000000b4.
# CHECK-NEXT:	error: .apple_names Bucket[1] Hash[1] = 0x0002b60f Str[0] = 0x0000005a DIE[0] = 0x00000001 is not a valid DIE offset for "j".

# This test is meant to verify that the -verify option 
# in llvm-dwarfdump, correctly identifies
# an invalid hash index for bucket[0] in the .apple_names section, 
# an invalid HashData offset for Hash[0], as well as
# an invalid DIE offset in the .debug_info section.
# We're reading an invalid DIE due to the incorrect interpretation of DW_FORM for the DIE.
# Instead of DW_FORM_data4 the Atom[0].form is: DW_FORM_flag_present.

	.section	__TEXT,__text,regular,pure_instructions
	.file	1 "basic.c"
	.comm	_i,4,2                  ## @i
	.comm	_j,4,2                  ## @j
	.section	__DWARF,__debug_str,regular,debug
Linfo_string:
	.asciz	"Apple LLVM version 8.1.0 (clang-802.0.35)" ## string offset=0
	.asciz	"basic.c"               ## string offset=42
	.asciz	"/Users/sgravani/Development/tests" ## string offset=50
	.asciz	"i"                     ## string offset=84
	.asciz	"int"                   ## string offset=86
	.asciz	"j"                     ## string offset=90
	.section	__DWARF,__debug_info,regular,debug
Lsection_info:
	.section	__DWARF,__apple_names,regular,debug
Lnames_begin:
	.long	1212240712              ## Header Magic
	.short	1                       ## Header Version
	.short	0                       ## Header Hash Function
	.long	2                       ## Header Bucket Count
	.long	2                       ## Header Hash Count
	.long	12                      ## Header Data Length
	.long	0                       ## HeaderData Die Offset Base
	.long	1                       ## HeaderData Atom Count
	.short	1                       ## DW_ATOM_die_offset
	.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".
	.long	-2                      ## Bucket 0 -- error: Bucket[0] has invalid hash index: 4294967294.
	.long	1                       ## Bucket 1
	.long	177678                  ## Hash in Bucket 0
	.long	177679                  ## Hash in Bucket 1
	.long	Lsection_line    ## Offset in Bucket 0 -- error: Hash[0] has invalid HashData offset: 0x000000b4.
	.long	LNames1-Lnames_begin    ## Offset in Bucket 1
LNames0:
	.long	84                      ## i
	.long	1                       ## Num DIEs
	.long	30
	.long	0
LNames1:
	.long	90                      ## j
	.long	1                       ## Num DIEs
	.long	58
	.long	0

.subsections_via_symbols
	.section	__DWARF,__debug_line,regular,debug
Lsection_line:
Lline_table_start0: