[Lldb-commits] [lldb] [lldb] Fix reading 32-bit signed integers (PR #169150)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 24 03:02:03 PST 2025
================
@@ -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);
----------------
DavidSpickett wrote:
Oh actually I see now. You are reading 32-bit and expecting it to sign extend into the int64_t. Please add a comment stating that that is the intent.
https://github.com/llvm/llvm-project/pull/169150
More information about the lldb-commits
mailing list