Files
clang-p2996/lldb/test/API/functionalities/gdb_remote_client/TestWriteMemory.py
Jonas Devlieghere 5238b80058 [lldb/Reproducers] Skip or fix the remaining tests.
After this patch all remaining tests should pass on macOS when replayed
from a reproducer.

To capture the reproducers:

  ./bin/llvm-lit ../llvm-project/lldb/test/ --param lldb-run-with-repro=capture

To replay the reproducers:

  ./bin/llvm-lit ../llvm-project/lldb/test/ --param lldb-run-with-repro=replay
2020-05-27 21:02:36 -07:00

30 lines
920 B
Python

import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
from gdbclientutils import *
class TestWriteMemory(GDBRemoteTestBase):
@skipIfReproducer # SBProcess::WriteMemory is not instrumented.
def test(self):
class MyResponder(MockGDBServerResponder):
def setBreakpoint(self, packet):
return "OK"
self.server.responder = MyResponder()
target = self.dbg.CreateTargetWithFileAndTargetTriple('', 'x86_64-pc-linux')
process = self.connect(target)
bp = target.BreakpointCreateByAddress(0x1000)
self.assertTrue(bp.IsValid())
self.assertEqual(bp.GetNumLocations(), 1)
bp.SetEnabled(True)
self.assertTrue(bp.IsEnabled())
err = lldb.SBError()
data = str("\x01\x02\x03\x04")
result = process.WriteMemory(0x1000, data, err)
self.assertEqual(result, 4)