aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
diff options
context:
space:
mode:
authorJames Henderson <james.henderson@sony.com>2020-06-17 11:29:29 +0100
committerJames Henderson <james.henderson@sony.com>2020-06-23 10:04:02 +0100
commit9782c922cb218cd39b7510be469f61f586414cb7 (patch)
treef5245a1aecae4d7ce7d77b21550c00b4285ae22d /llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
parent7a55d984971c11daa55e9423934f98bdc9c04f2f (diff)
downloadllvm-9782c922cb218cd39b7510be469f61f586414cb7.zip
llvm-9782c922cb218cd39b7510be469f61f586414cb7.tar.gz
llvm-9782c922cb218cd39b7510be469f61f586414cb7.tar.bz2
[DebugInfo] Print line table extended opcode bytes if parsing fails
Previously, if there was an error whilst parsing the operands of an extended opcode, the operands would be treated as zero and printed. This could potentially be slightly confusing. This patch changes the behaviour to print the raw bytes instead. Reviewed by: ikudrin Differential Revision: https://reviews.llvm.org/D81570
Diffstat (limited to 'llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp')
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp49
1 files changed, 28 insertions, 21 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
index 1125661..c8b7535 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -1461,64 +1461,71 @@ TEST_P(TruncatedExtendedOpcodeFixture, ErrorForTruncatedExtendedOpcode) {
INSTANTIATE_TEST_CASE_P(
TruncatedExtendedOpcodeParams, TruncatedExtendedOpcodeFixture,
Values(
- std::make_tuple(1, 1, DW_LNE_end_sequence, ValueAndLengths(),
- "Badly formed extended line op (length 0)",
+ // Truncated length:
+ std::make_tuple(1, 1, /*ArbitraryOpcode=*/0x7f, ValueAndLengths(), "",
"unable to decode LEB128 at offset 0x00000030: "
"malformed uleb128, extends past end"),
+ // Truncated opcode:
std::make_tuple(
- 2, 9, DW_LNE_set_address,
- ValueAndLengths{{0x12345678, LineTable::Quad}},
- "Unrecognized extended op 0x00 length 9",
+ 2, 9, /*ArbitraryOpcode=*/0x7f, ValueAndLengths(), "",
"unexpected end of data at offset 0x31 while reading [0x31, 0x32)"),
+ // Truncated operands:
std::make_tuple(
3, 9, DW_LNE_set_address,
- ValueAndLengths{{0x12345678, LineTable::Quad}},
- "DW_LNE_set_address (0x0000000000000000)",
+ ValueAndLengths{{0x1234567890abcdef, LineTable::Quad}},
+ "DW_LNE_set_address",
"unexpected end of data at offset 0x32 while reading [0x32, 0x3a)"),
- std::make_tuple(3, 5, DW_LNE_define_file,
+ std::make_tuple(
+ 10, 9, DW_LNE_set_address,
+ ValueAndLengths{{0x1234567890abcdef, LineTable::Quad}},
+ "DW_LNE_set_address (<parsing error> ef cd ab 90 78 56 34)",
+ "unexpected end of data at offset 0x39 while reading [0x32, 0x3a)"),
+ std::make_tuple(3, 6, DW_LNE_define_file,
ValueAndLengths{{'a', LineTable::Byte},
{'\0', LineTable::Byte},
{1, LineTable::ULEB},
{1, LineTable::ULEB},
{1, LineTable::ULEB}},
- "DW_LNE_define_file (, dir=0, "
- "mod_time=(0x0000000000000000), length=0)",
+ "DW_LNE_define_file",
"no null terminated string at offset 0x32"),
- std::make_tuple(5, 5, DW_LNE_define_file,
+ std::make_tuple(5, 6, DW_LNE_define_file,
ValueAndLengths{{'a', LineTable::Byte},
{'\0', LineTable::Byte},
{1, LineTable::ULEB},
{1, LineTable::ULEB},
{1, LineTable::ULEB}},
- "DW_LNE_define_file (a, dir=0, "
- "mod_time=(0x0000000000000000), length=0)",
+ "DW_LNE_define_file (<parsing error> 61 00)",
"unable to decode LEB128 at offset 0x00000034: "
"malformed uleb128, extends past end"),
- std::make_tuple(6, 5, DW_LNE_define_file,
+ std::make_tuple(6, 6, DW_LNE_define_file,
ValueAndLengths{{'a', LineTable::Byte},
{'\0', LineTable::Byte},
{1, LineTable::ULEB},
{1, LineTable::ULEB},
{1, LineTable::ULEB}},
- "DW_LNE_define_file (a, dir=1, "
- "mod_time=(0x0000000000000000), length=0)",
+ "DW_LNE_define_file (<parsing error> 61 00 01)",
"unable to decode LEB128 at offset 0x00000035: "
"malformed uleb128, extends past end"),
- std::make_tuple(7, 5, DW_LNE_define_file,
+ std::make_tuple(7, 6, DW_LNE_define_file,
ValueAndLengths{{'a', LineTable::Byte},
{'\0', LineTable::Byte},
{1, LineTable::ULEB},
{1, LineTable::ULEB},
{1, LineTable::ULEB}},
- "DW_LNE_define_file (a, dir=1, "
- "mod_time=(0x0000000000000001), length=0)",
+ "DW_LNE_define_file (<parsing error> 61 00 01 01)",
"unable to decode LEB128 at offset 0x00000036: "
"malformed uleb128, extends past end"),
std::make_tuple(3, 2, DW_LNE_set_discriminator,
ValueAndLengths{{1, LineTable::ULEB}},
- "DW_LNE_set_discriminator (0)",
+ "DW_LNE_set_discriminator",
"unable to decode LEB128 at offset 0x00000032: "
- "malformed uleb128, extends past end")), );
+ "malformed uleb128, extends past end"),
+ std::make_tuple(
+ 6, 5, /*Unknown=*/0x7f,
+ ValueAndLengths{{0x12345678, LineTable::Long}},
+ "Unrecognized extended op 0x7f length 5 (<parsing error> 78 56 34)",
+ "unexpected end of data at offset 0x35 while reading [0x32, "
+ "0x36)")), );
TEST_P(TruncatedStandardOpcodeFixture, ErrorForTruncatedStandardOpcode) {
if (!setupGenerator())