[llvm] 670dbad - [DebugInfo] Fix LineTest byteswap for cross-targeting builds
David Tenty via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 11:39:48 PDT 2020
Author: David Tenty
Date: 2020-07-02T14:39:42-04:00
New Revision: 670dbad473270a2bd46fc611bd48472685403ed6
URL: https://github.com/llvm/llvm-project/commit/670dbad473270a2bd46fc611bd48472685403ed6
DIFF: https://github.com/llvm/llvm-project/commit/670dbad473270a2bd46fc611bd48472685403ed6.diff
LOG: [DebugInfo] Fix LineTest byteswap for cross-targeting builds
Summary:
The byte swap fix for big endian hosts in 9782c922cb21 (for D81570)
swaps based on the host endianess, but for cross-targeting builds (i.e.
big endian host targeting little endian) the host-endianess won't
necessarily match the generated DWARF. This change updates the test
to use symmetrical constants so the results aren't endian dependent.
Reviewers: jhenderson, hubert.reinterpretcast, stevewan, ikudrin
Reviewed By: ikudrin
Subscribers: ikudrin, aprantl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82827
Added:
Modified:
llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
index ad59098ff405..62d506c66943 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -1443,21 +1443,6 @@ struct TruncatedExtendedOpcodeFixture
void SetUp() {
std::tie(BodyLength, OpcodeLength, Opcode, Operands, ExpectedOutput,
ExpectedErr) = GetParam();
- // Swap the byte order of the operands on big endian hosts, so that the raw
- // bytes are always in the same order. ValLen.Value is a uint64_t, so make
- // sure to shift the value back to the actually used bits for the
- // appropriate type.
- if (sys::IsBigEndianHost)
- for (LineTable::ValueAndLength &ValLen : Operands)
- if (ValLen.Length != LineTable::SLEB &&
- ValLen.Length != LineTable::ULEB &&
- ValLen.Length != LineTable::Byte) {
- sys::swapByteOrder(ValLen.Value);
- if (ValLen.Length == LineTable::Long)
- ValLen.Value >>= 32;
- if (ValLen.Length == LineTable::Half)
- ValLen.Value >>= 48;
- }
}
uint64_t OpcodeLength;
@@ -1492,8 +1477,8 @@ INSTANTIATE_TEST_CASE_P(
"unexpected end of data at offset 0x32 while reading [0x32, 0x3a)"),
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)",
+ ValueAndLengths{{0x1234567878563412, LineTable::Quad}},
+ "DW_LNE_set_address (<parsing error> 12 34 56 78 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},
@@ -1537,8 +1522,8 @@ INSTANTIATE_TEST_CASE_P(
"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)",
+ ValueAndLengths{{0x12343412, LineTable::Long}},
+ "Unrecognized extended op 0x7f length 5 (<parsing error> 12 34 34)",
"unexpected end of data at offset 0x35 while reading [0x32, "
"0x36)")), );
More information about the llvm-commits
mailing list