2 from lldbsuite
.test
.lldbtest
import *
3 from lldbsuite
.test
.decorators
import *
4 from lldbsuite
.test
.gdbclientutils
import *
5 from lldbsuite
.test
.lldbgdbclient
import GDBRemoteTestBase
8 class TestWriteMemory(GDBRemoteTestBase
):
10 class MyResponder(MockGDBServerResponder
):
11 def setBreakpoint(self
, packet
):
14 self
.server
.responder
= MyResponder()
15 target
= self
.dbg
.CreateTargetWithFileAndTargetTriple("", "x86_64-pc-linux")
16 process
= self
.connect(target
)
18 bp
= target
.BreakpointCreateByAddress(0x1000)
19 self
.assertTrue(bp
.IsValid())
20 self
.assertEqual(bp
.GetNumLocations(), 1)
22 self
.assertTrue(bp
.IsEnabled())
25 data
= str("\x01\x02\x03\x04")
26 result
= process
.WriteMemory(0x1000, data
, err
)
27 self
.assertEqual(result
, 4)