forked from OSchip/llvm-project
227 lines
11 KiB
Plaintext
227 lines
11 KiB
Plaintext
## Test the different error cases in the debug line parsing and how they prevent
|
|
## or don't prevent further dumping of section contents.
|
|
|
|
## Show that a bad length stops parsing of the section.
|
|
# RUN: llvm-mc -triple x86_64-pc-linux %S/Inputs/debug_line_reserved_length.s -filetype=obj -o %t-reserved.o
|
|
# RUN: llvm-dwarfdump -debug-line %t-reserved.o 2>&1 \
|
|
# RUN: | FileCheck %s --check-prefixes=FIRST,FATAL,RESERVED
|
|
# RUN: llvm-dwarfdump -debug-line %t-reserved.o -verbose 2>&1 \
|
|
# RUN: | FileCheck %s --check-prefixes=FIRST,FATAL,RESERVED
|
|
|
|
## We only produce warnings for malformed tables after the specified unit if
|
|
## parsing can continue.
|
|
# RUN: llvm-dwarfdump -debug-line=0 %t-reserved.o 2>&1 \
|
|
# RUN: | FileCheck %s --check-prefixes=FIRST,NOLATER,RESERVED
|
|
|
|
## Stop looking for the specified unit, if a fatally-bad prologue is detected.
|
|
# RUN: llvm-dwarfdump -debug-line=0x4b %t-reserved.o 2>&1 \
|
|
# RUN: | FileCheck %s --check-prefixes=NOFIRST,NOLATER,RESERVED
|
|
|
|
## Show that non-fatal errors do not prevent parsing the rest of the section.
|
|
# RUN: llvm-mc -triple x86_64-pc-linux %S/Inputs/debug_line_malformed.s -filetype=obj -o %t-malformed.o
|
|
# RUN: llvm-dwarfdump -debug-line %t-malformed.o 2> %t-malformed.err \
|
|
# RUN: | FileCheck %s --check-prefixes=FIRST,NONFATAL,LAST --implicit-check-not='debug_line[{{.*}}]'
|
|
# RUN: FileCheck %s --input-file=%t-malformed.err --check-prefixes=ALL,OTHER
|
|
# RUN: llvm-dwarfdump -debug-line %t-malformed.o -verbose 2> %t-malformed-verbose.err \
|
|
# RUN: | FileCheck %s --check-prefixes=FIRST,NONFATAL,LAST --implicit-check-not='debug_line[{{.*}}]'
|
|
# RUN: FileCheck %s --input-file=%t-malformed-verbose.err --check-prefixes=ALL,OTHER
|
|
|
|
## We should still produce warnings for malformed tables after the specified unit.
|
|
# RUN: llvm-dwarfdump -debug-line=0 %t-malformed.o 2> %t-malformed-off-first.err \
|
|
# RUN: | FileCheck %s --check-prefixes=FIRST,NOLATER
|
|
# 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=0x3c9 %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
|
|
|
|
# FIRST: debug_line[0x00000000]
|
|
# FIRST: 0x000000000badbeef {{.*}} end_sequence
|
|
# NOFIRST-NOT: debug_line[0x00000000]
|
|
# NOFIRST-NOT: 0x000000000badbeef {{.*}} end_sequence
|
|
# NOLATER-NOT: debug_line[{{.*}}]
|
|
# NOLATER-NOT: end_sequence
|
|
|
|
## For fatal issues, the following table(s) should not be dumped:
|
|
# FATAL: debug_line[0x00000048]
|
|
# RESERVED-NOT: prologue
|
|
# RESERVED: warning: parsing line table prologue at offset 0x00000048: unsupported reserved unit length of value 0xfffffffe
|
|
# RESERVED-NOT: prologue
|
|
# FATAL-NOT: debug_line
|
|
|
|
## For non-fatal issues, the table data should be dumped:
|
|
|
|
## Version 0 table.
|
|
# NONFATAL: debug_line[0x00000048]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL-NEXT: total_length: 0x00000002
|
|
# NONFATAL-NEXT: version: 0
|
|
# NONFATAL-NOT: prologue_length
|
|
|
|
## Version 1 table.
|
|
# NONFATAL: debug_line[0x0000004e]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL-NEXT: total_length: 0x00000002
|
|
# NONFATAL-NEXT: version: 1
|
|
# NONFATAL-NOT: prologue_length
|
|
|
|
## Malformed directory format with no path component.
|
|
# NONFATAL: debug_line[0x00000054]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: prologue_length: 0x00000013
|
|
# NONFATAL-NOT: include_directories
|
|
# NONFATAL-NOT: file_names
|
|
# NONFATAL: 0x8877665544332211 {{.*}} end_sequence
|
|
|
|
## Prologue with length shorter than parsed.
|
|
# NONFATAL: debug_line[0x00000081]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: file_names[ 2]:
|
|
# NONFATAL-NEXT: name: "file2"
|
|
# NONFATAL-NEXT: dir_index: 1
|
|
# NONFATAL-NEXT: mod_time: 0x00000002
|
|
# NONFATAL-NEXT: length: 0x00000006
|
|
# NONFATAL: 0x1122334455667788 {{.*}} 0 end_sequence{{$}}
|
|
|
|
## Prologue with length longer than parsed.
|
|
# NONFATAL: debug_line[0x000000c8]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: file_names[ 2]:
|
|
# NONFATAL-NEXT: name: "file2"
|
|
# NONFATAL-NEXT: dir_index: 1
|
|
# NONFATAL-NEXT: mod_time: 0x00000002
|
|
# NONFATAL-NEXT: length: 0x00000003
|
|
# NONFATAL-NOT: file_names
|
|
# NONFATAL: 0x1111222233334444 {{.*}} is_stmt end_sequence
|
|
|
|
## Extended opcode with incorrect length versus expected.
|
|
# NONFATAL: debug_line[0x00000111]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: prologue_length: 0x00000030
|
|
# NONFATAL: 0x00000000abbadaba {{.*}} end_sequence
|
|
# NONFATAL: 0x00000000babb1e45 {{.*}} 10 is_stmt prologue_end end_sequence{{$}}
|
|
|
|
## No end of sequence.
|
|
# NONFATAL: debug_line[0x0000016c]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: prologue_length: 0x00000030
|
|
# NONFATAL: 0x00000000deadfade {{.*}} is_stmt
|
|
# NONFATAL-NOT: end_sequence
|
|
|
|
## Very short prologue length for V5 (ends during parameters).
|
|
# NONFATAL: debug_line[0x000001b2]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: standard_opcode_lengths[DW_LNS_set_isa] = 1
|
|
# NONFATAL-NEXT: include_directories[ 0] = "/tmp"
|
|
# NONFATAL-NEXT: file_names[ 0]:
|
|
# NONFATAL-NEXT: name: "xyz"
|
|
# NONFATAL: 0x0000000000000000 1 0 1 0 0 is_stmt end_sequence
|
|
# NONFATAL: 0x0000babb1ebabb1e {{.*}} end_sequence
|
|
|
|
## V5 prologue ends during file table.
|
|
# NONFATAL: debug_line[0x000001ee]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: include_directories[ 0] = "/tmp"
|
|
# NONFATAL-NEXT: file_names[ 0]:
|
|
# NONFATAL-NEXT: name: "xyz"
|
|
# NONFATAL-NEXT: dir_index: 1
|
|
# NONFATAL: 0x0000000000000000 {{.*}} epilogue_begin
|
|
# NONFATAL: 0x00000ab4acadab4a {{.*}} end_sequence
|
|
|
|
## V5 prologue ends during directory table.
|
|
# NONFATAL: debug_line[0x0000022f]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: include_directories[ 0] = "/tmp"
|
|
# NONFATAL-NEXT: file_names[ 0]:
|
|
# NONFATAL-NEXT: name: "xyz"
|
|
# NONFATAL: 0x0000000000000002 2 0 1 0 0 is_stmt{{$}}
|
|
# NONFATAL: 0x4444333322221111 {{.*}} end_sequence
|
|
|
|
## V5 invalid MD5 hash form when there is still data to be read.
|
|
# NONFATAL: debug_line[0x0000026b]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: include_directories[ 0] = "/tmp"
|
|
# NONFATAL-NOT: file_names
|
|
# NONFATAL-NOT: is_stmt
|
|
# NONFATAL: 0x1234123412341234 {{.*}} end_sequence
|
|
|
|
## V5 invalid MD5 hash form when data beyond the prologue length has
|
|
## been read before the MD5 problem is identified.
|
|
# NONFATAL: debug_line[0x000002ae]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: include_directories[ 0] = "/tmp"
|
|
# NONFATAL-NOT: file_names
|
|
# NONFATAL: 0x0000000000000000 {{.*}} epilogue_begin
|
|
# NONFATAL: 0x4321432143214321 {{.*}} is_stmt end_sequence
|
|
|
|
## V5 invalid directory content description has unsupported form.
|
|
# NONFATAL: debug_line[0x000002ec]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: include_directories[ 0] = "/foo"
|
|
# NONFATAL-NOT: include_directories
|
|
# NONFATAL-NOT: file_names
|
|
# NONFATAL: 0xaaaabbbbccccdddd {{.*}} is_stmt end_sequence
|
|
|
|
## Opcode base field of value zero.
|
|
# NONFATAL: debug_line[0x00000332]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: include_directories[ 1] = "dir1"
|
|
# NONFATAL-NEXT: file_names[ 1]:
|
|
# NONFATAL-NEXT: name: "file1"
|
|
# NONFATAL-NEXT: dir_index: 1
|
|
# NONFATAL-NEXT: mod_time: 0x00000002
|
|
# NONFATAL-NEXT: length: 0x00000003
|
|
# NONFATAL: 0xffffeeeeddddcccd 1 0 1 0 0 is_stmt{{$}}
|
|
# NONFATAL: 0xffffeeeeddddcccd 1 0 1 0 0 is_stmt end_sequence{{$}}
|
|
|
|
## V4 table with unterminated include directory table.
|
|
# NONFATAL: debug_line[0x00000361]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: include_directories[ 1] = "dir1"
|
|
# NONFATAL-NOT: file_names
|
|
# NONFATAL: 0xabcdef0123456789 {{.*}} is_stmt end_sequence
|
|
|
|
## V4 table with unterminated file name table.
|
|
# NONFATAL: debug_line[0x00000390]
|
|
# NONFATAL-NEXT: Line table prologue
|
|
# NONFATAL: file_names[ 1]:
|
|
# NONFATAL-NEXT: name: "foo.c"
|
|
# NONFATAL-NEXT: dir_index: 1
|
|
# NONFATAL-NEXT: mod_time: 0x00000002
|
|
# NONFATAL-NEXT: length: 0x00000003
|
|
# NONFATAL-NOT: file_names
|
|
# NONFATAL: 0xababcdcdefef0909 {{.*}} is_stmt end_sequence
|
|
|
|
# LAST: debug_line[0x000003c9]
|
|
# LAST: 0x00000000cafebabe {{.*}} end_sequence
|
|
|
|
# ALL-NOT: warning:
|
|
# ALL: warning: parsing line table prologue at offset 0x00000048: unsupported version 0
|
|
# ALL-NEXT: warning: parsing line table prologue at offset 0x0000004e: unsupported version 1
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x00000054 found an invalid directory or file table description at 0x00000073
|
|
# ALL-NEXT: warning: failed to parse entry content descriptions because no path was found
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x00000081 found an invalid directory or file table description at 0x000000ba
|
|
# ALL-NEXT: warning: file names table was not null terminated before the end of the prologue
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x00000081 should have ended at 0x000000b9 but it ended at 0x000000ba
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x000000c8 should have ended at 0x00000103 but it ended at 0x00000102
|
|
# OTHER-NEXT: warning: unexpected line op length at offset 0x00000158 expected 0x02 found 0x01
|
|
# OTHER-NEXT: warning: unexpected line op length at offset 0x0000015c expected 0x01 found 0x02
|
|
# OTHER-NEXT: warning: last sequence in debug line table at offset 0x0000016c is not terminated
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x000001b2 should have ended at 0x000001ce but it ended at 0x000001e1
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x000001ee should have ended at 0x00000219 but it ended at 0x00000220
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x0000022f should have ended at 0x00000251 but it ended at 0x0000025e
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x0000026b found an invalid directory or file table description at 0x0000029f
|
|
# ALL-NEXT: warning: failed to parse file entry because the MD5 hash is invalid
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x000002ae found an invalid directory or file table description at 0x000002e0
|
|
# ALL-NEXT: warning: failed to parse file entry because the MD5 hash is invalid
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x000002ae should have ended at 0x000002d9 but it ended at 0x000002e0
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x000002ec found an invalid directory or file table description at 0x00000315
|
|
# ALL-NEXT: warning: failed to parse directory entry because skipping the form value failed.
|
|
# ALL-NEXT: warning: parsing line table prologue at offset 0x00000332 found opcode base of 0. Assuming no standard opcodes
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x00000361 found an invalid directory or file table description at 0x00000382
|
|
# ALL-NEXT: warning: include directories table was not null terminated before the end of the prologue
|
|
# ALL-NEXT: warning: parsing line table prologue at 0x00000390 found an invalid directory or file table description at 0x000003bb
|
|
# ALL-NEXT: warning: file names table was not null terminated before the end of the prologue
|
|
# ALL-NOT: warning:
|