forked from OSchip/llvm-project
[test][llvm-dwarfdump] Add extra test case for invalid MD5 form
A subsequent patch will change how an invalid file name table is handled to allow parsing to continue. This patch adds a test case that will demonstrate a difference in behaviour with that change between invalid file tables where the error is before the end of the stated prologue length and where the error occurs after the stated length. Reviewed by: dblaikie Differential Revision: https://reviews.llvm.org/D72157
This commit is contained in:
parent
f1be770ff6
commit
c963b5fbd6
|
@ -288,7 +288,7 @@
|
|||
.byte 0, 1, 1 # DW_LNE_end_sequence
|
||||
.Linvalid_dir_end0:
|
||||
|
||||
# Invalid MD5 hash.
|
||||
# Invalid MD5 hash, where there is data still to be read afterwards.
|
||||
.long .Linvalid_md5_end0-.Linvalid_md5_start0 # Length of Unit
|
||||
.Linvalid_md5_start0:
|
||||
.short 5 # DWARF version number
|
||||
|
@ -314,20 +314,64 @@
|
|||
.byte 3 # 3 elements per file entry
|
||||
.byte 1 # DW_LNCT_path
|
||||
.byte 0x08 # DW_FORM_string
|
||||
.byte 5 # DW_LNCT_MD5
|
||||
.byte 0x0b # DW_FORM_data1
|
||||
.byte 2 # DW_LNCT_directory_index
|
||||
.byte 0x0b # DW_FORM_data1
|
||||
.byte 5 # DW_LNCT_MD5
|
||||
.byte 0x09 # DW_FORM_data1
|
||||
# File table entries
|
||||
.byte 1 # 1 file
|
||||
.asciz "a.c"
|
||||
.byte 0
|
||||
# Data to show that the rest of the prologue is skipped.
|
||||
.byte 6
|
||||
.Linvalid_md5_header_end0:
|
||||
.byte 0, 9, 2 # DW_LNE_set_address
|
||||
.quad 0x1234123412341234
|
||||
.byte 0, 1, 1 # DW_LNE_end_sequence
|
||||
.Linvalid_md5_end0:
|
||||
|
||||
# Invalid MD5 hash, when data beyond the prologue length has
|
||||
# been read before the MD5 problem is identified.
|
||||
.long .Linvalid_md5_end1-.Linvalid_md5_start1 # Length of Unit
|
||||
.Linvalid_md5_start1:
|
||||
.short 5 # DWARF version number
|
||||
.byte 8 # Address Size
|
||||
.byte 0 # Segment Selector Size
|
||||
.long .Linvalid_md5_header_end1-.Linvalid_md5_params1 - 10 # Length of Prologue
|
||||
.Linvalid_md5_params1:
|
||||
.byte 1 # Minimum Instruction Length
|
||||
.byte 1 # Maximum Operations per Instruction
|
||||
.byte 1 # Default is_stmt
|
||||
.byte -5 # Line Base
|
||||
.byte 14 # Line Range
|
||||
.byte 13 # Opcode Base
|
||||
.byte 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 # Standard Opcode Lengths
|
||||
# Directory table format
|
||||
.byte 1 # One element per directory entry
|
||||
.byte 1 # DW_LNCT_path
|
||||
.byte 0x08 # DW_FORM_string
|
||||
# Directory table entries
|
||||
.byte 1 # 1 directory
|
||||
.asciz "/tmp"
|
||||
# File table format
|
||||
.byte 3 # 2 elements per file entry
|
||||
.byte 1 # DW_LNCT_path
|
||||
.byte 0x08 # DW_FORM_string
|
||||
.byte 5 # DW_LNCT_MD5
|
||||
.byte 0x0b # DW_FORM_data1
|
||||
.byte 2 # DW_LNCT_directory_index
|
||||
.byte 0x0b # DW_FORM_data1
|
||||
# File table entries
|
||||
.byte 1 # 1 file
|
||||
.asciz "a.c"
|
||||
.byte 6 # This byte will be consumed when reading the MD5 value.
|
||||
.byte 0xb # This byte will not be read as part of the prologue.
|
||||
.Linvalid_md5_header_end1:
|
||||
.byte 0, 9, 2 # DW_LNE_set_address
|
||||
.quad 0x4321432143214321
|
||||
.byte 0, 1, 1 # DW_LNE_end_sequence
|
||||
.Linvalid_md5_end1:
|
||||
|
||||
# Trailing good section.
|
||||
.long .Lunit_good_end - .Lunit_good_start # Length of Unit (DWARF-32 format)
|
||||
.Lunit_good_start:
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
# RUN: FileCheck %s --input-file=%t-malformed-off-first.err --check-prefix=ALL
|
||||
|
||||
## Don't stop looking for the later unit if non-fatal issues are found.
|
||||
# RUN: llvm-dwarfdump -debug-line=0x2b4 %t-malformed.o 2> %t-malformed-off-last.err \
|
||||
# RUN: llvm-dwarfdump -debug-line=0x2f8 %t-malformed.o 2> %t-malformed-off-last.err \
|
||||
# RUN: | FileCheck %s --check-prefix=LAST --implicit-check-not='debug_line[{{.*}}]'
|
||||
# RUN: FileCheck %s --input-file=%t-malformed-off-last.err --check-prefix=ALL
|
||||
|
||||
|
@ -134,14 +134,22 @@
|
|||
# NONFATAL-NEXT: dir_index: 1
|
||||
# NONFATAL-NOT: Address
|
||||
|
||||
## Case 11: V5 invalid MD5 hash form.
|
||||
## Case 11: V5 invalid MD5 hash form when there is still data to be read.
|
||||
# NONFATAL: debug_line[0x00000272]
|
||||
# NONFATAL-NEXT: Line table prologue
|
||||
# NONFATAL: include_directories[ 0] = "/tmp"
|
||||
# NONFATAL-NOT: file_names
|
||||
# NONFATAL-NOT: Address
|
||||
|
||||
# LAST: debug_line[0x000002b4]
|
||||
## Case 12: V5 invalid MD5 hash form when data beyond the prologue length has
|
||||
## been read before the MD5 problem is identified.
|
||||
# NONFATAL: debug_line[0x000002b5]
|
||||
# NONFATAL-NEXT: Line table prologue
|
||||
# NONFATAL: include_directories[ 0] = "/tmp"
|
||||
# NONFATAL-NOT: file_names
|
||||
# NONFATAL-NOT: Address
|
||||
|
||||
# LAST: debug_line[0x000002f8]
|
||||
# LAST: 0x00000000cafebabe {{.*}} end_sequence
|
||||
|
||||
# RESERVED: warning: parsing line table prologue at offset 0x00000048 unsupported reserved unit length found of value 0xfffffffe
|
||||
|
@ -160,6 +168,8 @@
|
|||
# ALL-NEXT: warning: parsing line table prologue at 0x000001b2 should have ended at 0x000001cd but it ended at 0x000001e4
|
||||
# ALL-NEXT: warning: parsing line table prologue at 0x000001f2 should have ended at 0x0000021d but it ended at 0x00000224
|
||||
# ALL-NEXT: warning: parsing line table prologue at 0x00000232 should have ended at 0x00000254 but it ended at 0x00000264
|
||||
# ALL-NEXT: warning: parsing line table prologue at 0x00000272 found an invalid directory or file table description at 0x000002a7
|
||||
# ALL-NEXT: warning: parsing line table prologue at 0x00000272 found an invalid directory or file table description at 0x000002a6
|
||||
# ALL-NEXT: warning: failed to parse file entry because the MD5 hash is invalid
|
||||
# ALL-NEXT: warning: parsing line table prologue at 0x000002b5 found an invalid directory or file table description at 0x000002e9
|
||||
# ALL-NEXT: warning: failed to parse file entry because the MD5 hash is invalid
|
||||
# ALL-NOT: warning:
|
||||
|
|
Loading…
Reference in New Issue