================
@@ -227,6 +237,56 @@ TEST_F(MemoryTest, TesetMemoryCacheRead) {
// old cache
}
+TEST_F(MemoryTest, TestProcessReadSignedInteger) {
+ ArchSpec arch("x86_64-apple-macosx-");
+
+ Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
+
+ DebuggerSP debugger_sp = Debugger::CreateInstance();
+ ASSERT_TRUE(debugger_sp);
+
+ TargetSP target_sp = CreateTarget(debugger_sp, arch);
+ ASSERT_TRUE(target_sp);
+
+ ListenerSP listener_sp(Listener::MakeListener("dummy"));
+ ProcessSP process_sp = std::make_shared<DummyProcess>(target_sp,
listener_sp);
+ ASSERT_TRUE(process_sp);
+
+ DummyProcess *process = static_cast<DummyProcess *>(process_sp.get());
+ process->SetFiller(0xff);
+ process->SetMaxReadSize(4);
+
+ Status error;
+ int64_t val = process->ReadSignedIntegerFromMemory(0, 4, 0, error);
+ EXPECT_EQ(val, -1);
+}
+
+TEST_F(MemoryTest, TestTargetReadSignedInteger) {
+ ArchSpec arch("x86_64-apple-macosx-");
+
+ Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
+
+ DebuggerSP debugger_sp = Debugger::CreateInstance();
+ ASSERT_TRUE(debugger_sp);
+
+ TargetSP target_sp = CreateTarget(debugger_sp, arch);
+ ASSERT_TRUE(target_sp);
+
+ ListenerSP listener_sp(Listener::MakeListener("dummy"));
+ ProcessSP process_sp = std::make_shared<DummyProcess>(target_sp,
listener_sp);
+ ASSERT_TRUE(process_sp);
+ OverrideTargetProcess(target_sp.get(), process_sp);
+
+ DummyProcess *process = static_cast<DummyProcess *>(process_sp.get());
+ process->SetFiller(0xff);
+ process->SetMaxReadSize(4);
+ process->SetPrivateState(eStateStopped);
+
+ Status error;
+ int64_t val = target_sp->ReadSignedIntegerFromMemory(Address(0), 4, 0,
error);
+ EXPECT_EQ(val, -1);
+}
----------------
DavidSpickett wrote:
If you can, I would be fine with the two tests as one. Looks like the setup is
largely the same.
https://github.com/llvm/llvm-project/pull/169150
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits