Files
clang-p2996/lldb/test/API/functionalities/gdb_remote_client/TestWriteMemory.py
Jonas Devlieghere 2238dcc393 [NFC][Py Reformat] Reformat python files in lldb
This is an ongoing series of commits that are reformatting our Python
code. Reformatting is done with `black` (23.1.0).

If you end up having problems merging this commit because you have made
changes to a python file, the best way to handle that is to run `git
checkout --ours <yourfile>` and then reformat it with black.

RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Differential revision: https://reviews.llvm.org/D151460
2023-05-25 12:54:09 -07:00

28 lines
924 B
Python

import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
from lldbsuite.test.gdbclientutils import *
from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
class TestWriteMemory(GDBRemoteTestBase):
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)