================ @@ -112,3 +112,23 @@ def test_readMemory(self): # Reads at offset 0x0 fail mem = self.dap_server.request_readMemory("0x0", 0, 6) self.assertEqual(mem["success"], False) + + def test_writeMemory(self): + """ + Tests the 'writeMemory' request + """ + program = self.getBuildArtifact("a.out") + self.build_and_launch(program) + source = "main.cpp" + self.source_path = os.path.join(os.getcwd(), source) + self.set_source_breakpoints( + source, + [line_number(source, "// Breakpoint")], + ) + self.continue_to_next_stop() + + ptr_deref = self.dap_server.request_evaluate("not_a_ptr")["body"] + memref = ptr_deref["memoryReference"] + + mem = self.dap_server.request_writeMemory(memref, 0, "0x11")["body"] + self.assertEqual(mem["bytesWritten"], 8) ---------------- ashgti wrote:
Sure, I meant that if we write `0x11` into the memory address, we should have some way of verifying that the value took effect. For example, if we evaluate an expression or fetch the local variables we should have some way to observe the write took effect. As far as the cases where this might fail, I suspect we cannot write to address 0x0 for example, same as reading from address 0x0 fails in `test_readMemory`. https://github.com/llvm/llvm-project/pull/131820 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits