[lldb/Plugins] Add memory writing capabilities to Scripted Process

This patch adds memory writing capabilities to the Scripted Process plugin.

This allows to user to get a target address and a memory buffer on the
python scripted process implementation that the user can make processing
on before performing the actual write.

This will also be used to write trap instruction to a real process
memory to set a breakpoint.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani
2023-03-03 19:30:56 -08:00
parent e02a355f98
commit f190ec6882
13 changed files with 107 additions and 8 deletions

View File

@@ -98,6 +98,21 @@ class ScriptedProcess(metaclass=ABCMeta):
"""
pass
def write_memory_at_address(self, addr, data, error):
""" Write a buffer to the scripted process memory.
Args:
addr (int): Address from which we should start reading.
data (lldb.SBData): An `lldb.SBData` buffer to write to the
process memory.
error (lldb.SBError): Error object.
Returns:
size (int): Size of the memory to read.
"""
error.SetErrorString("%s doesn't support memory writes." % self.__class__.__name__)
return 0
def get_loaded_images(self):
""" Get the list of loaded images for the scripted process.