diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp @@ -327,7 +327,7 @@ PrologueOffset, TotalLength); } FormParams.Version = DebugLineData.getU16(OffsetPtr); - if (getVersion() < 2) + if (getVersion() < 2 || getVersion() > 5) // Treat this error as unrecoverable - we cannot be sure what any of // the data represents including the length field, so cannot skip it or make // any reasonable assumptions. diff --git a/llvm/test/tools/llvm-dwarfdump/X86/Inputs/debug_line_malformed.s b/llvm/test/tools/llvm-dwarfdump/X86/Inputs/debug_line_malformed.s --- a/llvm/test/tools/llvm-dwarfdump/X86/Inputs/debug_line_malformed.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/Inputs/debug_line_malformed.s @@ -38,6 +38,12 @@ .short 1 # version .Lunit_v1_end: +# Version greater than the max supported. +.long .Lunit_v6_end - .Lunit_v6_start # unit length +.Lunit_v6_start: +.short 6 # version +.Lunit_v6_end: + # Version 5 malformed line/include table. .long .Lunit_v5_end - .Lunit_v5_start # unit length .Lunit_v5_start: diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_line_invalid.test b/llvm/test/tools/llvm-dwarfdump/X86/debug_line_invalid.test --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_line_invalid.test +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_line_invalid.test @@ -1,186 +1,192 @@ -## 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> %t-reserved.err \ -# RUN: | FileCheck %s --check-prefixes=FIRST,FATAL -# RUN: FileCheck %s --input-file=%t-reserved.err --check-prefix=RESERVED -# RUN: llvm-dwarfdump -debug-line %t-reserved.o -verbose 2> %t-reserved-verbose.err \ -# RUN: | FileCheck %s --check-prefixes=FIRST,FATAL -# RUN: FileCheck %s --input-file=%t-reserved-verbose.err --check-prefix=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> %t-reserved-off-first.err \ -# RUN: | FileCheck %s --check-prefixes=FIRST,NOLATER -# RUN: FileCheck %s --input-file=%t-reserved-off-first.err --check-prefix=RESERVED - -## Stop looking for the specified unit, if a fatally-bad prologue is detected. -# RUN: llvm-dwarfdump -debug-line=0x4b %t-reserved.o 2> %t-reserved-off-last.err \ -# RUN: | FileCheck %s --check-prefixes=NOFIRST,NOLATER -# RUN: FileCheck %s --input-file=%t-reserved-off-last.err --check-prefix=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=0x332 %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] -# FATAL-NEXT: Line table prologue -# FATAL-NEXT: total_length: 0xfffffffe -# FATAL-NOT: debug_line - -## For non-fatal issues, the table data should be dumped. -## Case 1: Version 0 table. -# NONFATAL: debug_line[0x00000048] -# NONFATAL-NEXT: Line table prologue -# NONFATAL-NOT: Address - -## Case 2: Version 1 table. -# NONFATAL: debug_line[0x0000004e] -# NONFATAL-NEXT: Line table prologue -# NONFATAL-NOT: Address - -## Case 3: Malformed directory format with no path component. -# NONFATAL: debug_line[0x00000054] -# NONFATAL-NEXT: Line table prologue -# NONFATAL-NOT: include_directories -# NONFATAL-NOT: file_names -# NONFATAL: 0x8877665544332211 {{.*}} end_sequence - -## Case 4: 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{{$}} - -## Case 5: 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 - -## Case 6: Extended opcode with incorrect length versus expected. -# NONFATAL: debug_line[0x00000111] -# NONFATAL-NEXT: Line table prologue -# NONFATAL: 0x00000000abbadaba {{.*}} end_sequence -# NONFATAL: 0x00000000babb1e45 {{.*}} 10 is_stmt prologue_end end_sequence{{$}} - -## Case 7: No end of sequence. -# NONFATAL: debug_line[0x0000016c] -# NONFATAL-NEXT: Line table prologue -# NONFATAL: 0x00000000deadfade {{.*}} is_stmt -# NONFATAL-NOT: end_sequence - -## Case 8: 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 - -## Case 9: 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 - -## Case 10: 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 - -## Case 11: 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 - -## 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[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 - -## Case 13: 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 - -# LAST: debug_line[0x00000332] -# LAST: 0x00000000cafebabe {{.*}} end_sequence - -# RESERVED: warning: parsing line table prologue at offset 0x00000048 unsupported reserved unit length found of value 0xfffffffe - -# ALL-NOT: warning: -# ALL: warning: parsing line table prologue at offset 0x00000048 found unsupported version 0x00 -# ALL-NEXT: warning: parsing line table prologue at offset 0x0000004e found unsupported version 0x01 -# 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 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-NOT: warning: +## 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> %t-reserved.err \ +# RUN: | FileCheck %s --check-prefixes=FIRST,FATAL +# RUN: FileCheck %s --input-file=%t-reserved.err --check-prefix=RESERVED +# RUN: llvm-dwarfdump -debug-line %t-reserved.o -verbose 2> %t-reserved-verbose.err \ +# RUN: | FileCheck %s --check-prefixes=FIRST,FATAL +# RUN: FileCheck %s --input-file=%t-reserved-verbose.err --check-prefix=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> %t-reserved-off-first.err \ +# RUN: | FileCheck %s --check-prefixes=FIRST,NOLATER +# RUN: FileCheck %s --input-file=%t-reserved-off-first.err --check-prefix=RESERVED + +## Stop looking for the specified unit, if a fatally-bad prologue is detected. +# RUN: llvm-dwarfdump -debug-line=0x4b %t-reserved.o 2> %t-reserved-off-last.err \ +# RUN: | FileCheck %s --check-prefixes=NOFIRST,NOLATER +# RUN: FileCheck %s --input-file=%t-reserved-off-last.err --check-prefix=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=0x338 %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] +# FATAL-NEXT: Line table prologue +# FATAL-NEXT: total_length: 0xfffffffe +# FATAL-NOT: debug_line + +## For non-fatal issues, the table data should be dumped. +## Case 1: Version 0 table. +# NONFATAL: debug_line[0x00000048] +# NONFATAL-NEXT: Line table prologue +# NONFATAL-NOT: Address + +## Case 2: Version 1 table. +# NONFATAL: debug_line[0x0000004e] +# NONFATAL-NEXT: Line table prologue +# NONFATAL-NOT: Address + +## Case 3: Version greater than max supported. +# NONFATAL: debug_line[0x00000054] +# NONFATAL-NEXT: Line table prologue +# NONFATAL-NOT: Address + +## Case 4: Malformed directory format with no path component. +# NONFATAL: debug_line[0x0000005a] +# NONFATAL-NEXT: Line table prologue +# NONFATAL-NOT: include_directories +# NONFATAL-NOT: file_names +# NONFATAL: 0x8877665544332211 {{.*}} end_sequence + +## Case 5: Prologue with length shorter than parsed. +# NONFATAL: debug_line[0x00000087] +# 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{{$}} + +## Case 6: Prologue with length longer than parsed. +# NONFATAL: debug_line[0x000000ce] +# 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 + +## Case 7: Extended opcode with incorrect length versus expected. +# NONFATAL: debug_line[0x00000117] +# NONFATAL-NEXT: Line table prologue +# NONFATAL: 0x00000000abbadaba {{.*}} end_sequence +# NONFATAL: 0x00000000babb1e45 {{.*}} 10 is_stmt prologue_end end_sequence{{$}} + +## Case 8: No end of sequence. +# NONFATAL: debug_line[0x00000172] +# NONFATAL-NEXT: Line table prologue +# NONFATAL: 0x00000000deadfade {{.*}} is_stmt +# NONFATAL-NOT: end_sequence + +## Case 9: Very short prologue length for V5 (ends during parameters). +# NONFATAL: debug_line[0x000001b8] +# 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 + +## Case 10: V5 prologue ends during file table. +# NONFATAL: debug_line[0x000001f4] +# 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 + +## Case 11: V5 prologue ends during directory table. +# NONFATAL: debug_line[0x00000235] +# 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 + +## Case 12: V5 invalid MD5 hash form when there is still data to be read. +# NONFATAL: debug_line[0x00000271] +# NONFATAL-NEXT: Line table prologue +# NONFATAL: include_directories[ 0] = "/tmp" +# NONFATAL-NOT: file_names +# NONFATAL-NOT: is_stmt +# NONFATAL: 0x1234123412341234 {{.*}} end_sequence + +## Case 13: V5 invalid MD5 hash form when data beyond the prologue length has +## been read before the MD5 problem is identified. +# NONFATAL: debug_line[0x000002b4] +# NONFATAL-NEXT: Line table prologue +# NONFATAL: include_directories[ 0] = "/tmp" +# NONFATAL-NOT: file_names +# NONFATAL: 0x0000000000000000 {{.*}} epilogue_begin +# NONFATAL: 0x4321432143214321 {{.*}} is_stmt end_sequence + +## Case 14: V5 invalid directory content description has unsupported form. +# NONFATAL: debug_line[0x000002f2] +# NONFATAL-NEXT: Line table prologue +# NONFATAL: include_directories[ 0] = "/foo" +# NONFATAL-NOT: include_directories +# NONFATAL-NOT: file_names +# NONFATAL: 0xaaaabbbbccccdddd {{.*}} is_stmt end_sequence + +# LAST: debug_line[0x00000338] +# LAST: 0x00000000cafebabe {{.*}} end_sequence + +# RESERVED: warning: parsing line table prologue at offset 0x00000048 unsupported reserved unit length found of value 0xfffffffe + +# ALL-NOT: warning: +# ALL: warning: parsing line table prologue at offset 0x00000048 found unsupported version 0x00 +# ALL-NEXT: warning: parsing line table prologue at offset 0x0000004e found unsupported version 0x01 +# ALL-NEXT: warning: parsing line table prologue at offset 0x00000054 found unsupported version 0x06 +# ALL-NEXT: warning: parsing line table prologue at 0x0000005a found an invalid directory or file table description at 0x00000079 +# ALL-NEXT: warning: failed to parse entry content descriptions because no path was found +# ALL-NEXT: warning: parsing line table prologue at 0x00000087 should have ended at 0x000000bf but it ended at 0x000000c0 +# ALL-NEXT: warning: parsing line table prologue at 0x000000ce should have ended at 0x00000109 but it ended at 0x00000108 +# OTHER-NEXT: warning: unexpected line op length at offset 0x0000015e expected 0x02 found 0x01 +# OTHER-NEXT: warning: unexpected line op length at offset 0x00000162 expected 0x01 found 0x02 +# OTHER-NEXT: warning: last sequence in debug line table at offset 0x00000172 is not terminated +# ALL-NEXT: warning: parsing line table prologue at 0x000001b8 should have ended at 0x000001d4 but it ended at 0x000001e7 +# ALL-NEXT: warning: parsing line table prologue at 0x000001f4 should have ended at 0x0000021f but it ended at 0x00000226 +# ALL-NEXT: warning: parsing line table prologue at 0x00000235 should have ended at 0x00000257 but it ended at 0x00000264 +# ALL-NEXT: warning: parsing line table prologue at 0x00000271 found an invalid directory or file table description at 0x000002a5 +# ALL-NEXT: warning: failed to parse file entry because the MD5 hash is invalid +# ALL-NEXT: warning: parsing line table prologue at 0x000002b4 found an invalid directory or file table description at 0x000002e6 +# ALL-NEXT: warning: failed to parse file entry because the MD5 hash is invalid +# ALL-NEXT: warning: parsing line table prologue at 0x000002b4 should have ended at 0x000002df but it ended at 0x000002e6 +# ALL-NEXT: warning: parsing line table prologue at 0x000002f2 found an invalid directory or file table description at 0x0000031b +# ALL-NEXT: warning: failed to parse directory entry because skipping the form value failed. +# ALL-NOT: warning: diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp --- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp @@ -354,6 +354,21 @@ "0x01"); } +TEST_F(DebugLineBasicFixture, ErrorForHighVersion) { + if (!setupGenerator()) + return; + + LineTable < = Gen->addLineTable(); + LT.setCustomPrologue( + {{LineTable::Half, LineTable::Long}, {6, LineTable::Half}}); + + generate(); + + checkGetOrParseLineTableEmitsFatalError( + "parsing line table prologue at offset 0x00000000 found unsupported " + "version 0x06"); +} + TEST_F(DebugLineBasicFixture, ErrorForInvalidV5IncludeDirTable) { if (!setupGenerator(5)) return;