Matej =?utf-8?q?Ko=C5=A1=C3=ADk?= <[email protected]>,
Matej =?utf-8?q?Ko=C5=A1=C3=ADk?= <[email protected]>,
Matej =?utf-8?q?Ko=C5=A1=C3=ADk?= <[email protected]>,
Matej =?utf-8?q?Ko=C5=A1=C3=ADk?= <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>


================
@@ -54,3 +56,56 @@ TEST(RegisterValueTest, GetScalarValue) {
             Scalar((APInt(128, 0xffeeddccbbaa9988ull) << 64) |
                    APInt(128, 0x7766554433221100)));
 }
+
+static const Scalar etalon128(APInt(128, 0xffeeddccbbaa9988ull) << 64 |
+                              APInt(128, 0x7766554433221100ull));
+
+void TestSetValueFromData128(const RegisterInfo &ri, void *src,
+                             const lldb::ByteOrder endianness) {
+  DataExtractor src_extractor(src, 16, endianness, 8);
+  RegisterValue rv;
+  EXPECT_TRUE(rv.SetValueFromData(ri, src_extractor, 0, false).Success());
+  Scalar s;
+  EXPECT_TRUE(rv.GetScalarValue(s));
+  EXPECT_EQ(s, etalon128);
+}
+
+// Test that the "RegisterValue::SetValueFromData" method works correctly
+// with 128-bit little-endian data that represents an integer.
+TEST(RegisterValueTest, SetValueFromData_128_le) {
+  RegisterValue rv;
+  RegisterInfo ri{"uint128_register",
+                  nullptr,
+                  16,
+                  0,
+                  lldb::Encoding::eEncodingUint,
+                  lldb::Format::eFormatDefault,
+                  {0, 0, 0, LLDB_INVALID_REGNUM, 0},
+                  nullptr,
+                  nullptr,
+                  nullptr};
+
+  uint8_t src[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+                   0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
+  TestSetValueFromData128(ri, src, lldb::ByteOrder::eByteOrderLittle);
+}
+
+// Test that the "RegisterValue::SetValueFromData" method works correctly
+// with 128-bit big-endian data that represents an integer.
+TEST(RegisterValueTest, SetValueFromData_128_be) {
+  RegisterValue rv;
----------------
DavidSpickett wrote:

Is now unused.

https://github.com/llvm/llvm-project/pull/163646
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to