112 lines · plain
1## Test llvm-dwarfdump detects and reports invalid DWARF format of the file.2 3# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym=CUEND=1 \4# RUN: | llvm-dwarfdump - 2>&1 | FileCheck --check-prefix=CUEND %s5# CUEND: warning: DWARF unit from offset 0x0000000c incl. to offset 0x0000002b excl. tries to read DIEs at offset 0x0000002b6 7# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym=ABBREVSETINVALID=1 \8# RUN: | llvm-dwarfdump - 2>&1 | FileCheck --check-prefix=ABBREVSETINVALID %s9# ABBREVSETINVALID: warning: DWARF unit at offset 0x0000000c contains invalid abbreviation set offset 0x010 11# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym=ABBREVNO=2 \12# RUN: | llvm-dwarfdump - 2>&1 | FileCheck --check-prefix=ABBREVNO %s13# ABBREVNO: warning: DWARF unit at offset 0x0000000c contains invalid abbreviation 2 at offset 0x00000018, valid abbreviations are 1, 5, 3-414 15# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym=FORMNO=0xdead \16# RUN: | llvm-dwarfdump - 2>&1 | FileCheck --check-prefix=FORMNO %s17# FORMNO: warning: DWARF unit at offset 0x0000000c contains invalid FORM_* 0xdead at offset 0x0000001818 19# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym=SHORTINITLEN=1 \20# RUN: | llvm-dwarfdump - 2>&1 | FileCheck --check-prefix=SHORTINITLEN %s21# SHORTINITLEN: warning: DWARF unit at 0x0000002c cannot be parsed:22# SHORTINITLEN-NEXT: warning: unexpected end of data at offset 0x2d while reading [0x2c, 0x30)23 24# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym=BADTYPEUNIT=1 \25# RUN: | llvm-dwarfdump - 2>&1 | FileCheck --check-prefix=BADTYPEUNITBEFORE %s26# BADTYPEUNITBEFORE: warning: DWARF type unit at offset 0x0000002c has its relocated type_offset 0x0000002d pointing inside the header27 28# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym=BADTYPEUNIT=0x100 \29# RUN: | llvm-dwarfdump - 2>&1 | FileCheck --check-prefix=BADTYPEUNITAFTER %s30# BADTYPEUNITAFTER: warning: DWARF type unit from offset 0x0000002c incl. to offset 0x00000045 excl. has its relocated type_offset 0x0000012c pointing past the unit end31 32# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj --defsym=TOOLONG=1 \33# RUN: | llvm-dwarfdump - 2>&1 | FileCheck --check-prefix=TOOLONG %s34# TOOLONG: warning: DWARF unit from offset 0x0000000c incl. to offset 0x0000002d excl. extends past section size 0x0000002c35 36 .section .debug_abbrev,"",@progbits37.ifndef ABBREVSETINVALID38 .uleb128 1 # Abbreviation Code39 .uleb128 17 # DW_TAG_compile_unit40 .uleb128 1 # DW_CHILDREN_yes41 .uleb128 37 # DW_AT_producer42.ifndef FORMNO43 .uleb128 8 # DW_FORM_string44.else45 .uleb128 FORMNO 46.endif47 .uleb128 0 # end abbrev 1 DW_AT_*48 .uleb128 0 # end abbrev 1 DW_FORM_*49 .uleb128 5 # Abbreviation Code50 .uleb128 10 # DW_TAG_label51 .uleb128 0 # DW_CHILDREN_no52 .uleb128 0 # end abbrev 4 DW_AT_*53 .uleb128 0 # end abbrev 4 DW_FORM_*54 .uleb128 3 # Abbreviation Code55 .uleb128 10 # DW_TAG_label56 .uleb128 0 # DW_CHILDREN_no57 .uleb128 0 # end abbrev 3 DW_AT_*58 .uleb128 0 # end abbrev 3 DW_FORM_*59 .uleb128 4 # Abbreviation Code60 .uleb128 10 # DW_TAG_label61 .uleb128 0 # DW_CHILDREN_no62 .uleb128 0 # end abbrev 4 DW_AT_*63 .uleb128 0 # end abbrev 4 DW_FORM_*64 .uleb128 0 # end abbrevs section65.endif66 67 .section .debug_info,"",@progbits68## The first CU is here to shift the next CU being really tested to non-zero CU69## offset to check more for error messages.70 .long .Lcu_endp-.Lcu_startp # Length of Unit71.Lcu_startp:72 .short 4 # DWARF version number73 .long .debug_abbrev # Offset Into Abbrev. Section74 .byte 8 # Address Size (in bytes)75 .uleb128 0 # End Of Children Mark76.Lcu_endp:77 78.ifndef TOOLONG79.equ TOOLONG, 080.endif81 .long .Lcu_end0-.Lcu_start0 + TOOLONG # Length of Unit82.Lcu_start0:83 .short 4 # DWARF version number84 .long .debug_abbrev # Offset Into Abbrev. Section85 .byte 8 # Address Size (in bytes)86.ifndef ABBREVNO87 .uleb128 1 # Abbrev [1] DW_TAG_compile_unit88.else89 .uleb128 ABBREVNO 90.endif91 .asciz "hand-written DWARF" # DW_AT_producer92.ifndef CUEND93 .uleb128 0 # End Of Children Mark94.endif95.Lcu_end0:96 97.ifdef SHORTINITLEN98 .byte 0x55 # Too short Length of Unit99.endif100.ifdef BADTYPEUNIT101 .long .Lcu_end1-.Lcu_start1 # Length of Unit102.Lcu_start1: 103 .short 5 # DWARF version number104 .byte 2 # DW_UT_type105 .byte 8 # Address Size (in bytes)106 .long .debug_abbrev # Offset Into Abbrev. Section107 .quad 0xbaddefacedfacade # Type Signature108 .long BADTYPEUNIT # Type DIE Offset109 .uleb128 0 # End Of Children Mark110.Lcu_end1:111.endif112