[lldb/Plugins] Improve error reporting with reading memory in Scripted Process
This patch improves the ScriptedPythonInterface::Dispatch method to support passing lldb_private types to the python implementation. This will allow, for instance, the Scripted Process python implementation to report errors when reading memory back to lldb. To do so, the Dispatch method will transform the private types in the parameter pack into `PythonObject`s to be able to pass them down to the python methods. Then, if the call succeeded, the transformed arguments will be converted back to their original type and re-assigned in the parameter pack, to ensure pointers and references behaviours are preserved. This patch also updates various scripted process python class and tests to reflect this change. rdar://100030995 Differential Revision: https://reviews.llvm.org/D134033 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
@@ -103,7 +103,7 @@ class CrashLogScriptedProcess(ScriptedProcess):
|
||||
def get_registers_for_thread(self, tid: int):
|
||||
return {}
|
||||
|
||||
def read_memory_at_address(self, addr: int, size: int) -> lldb.SBData:
|
||||
def read_memory_at_address(self, addr: int, size: int, error: lldb.SBError) -> lldb.SBData:
|
||||
# NOTE: CrashLogs don't contain any memory.
|
||||
return lldb.SBData()
|
||||
|
||||
|
||||
@@ -98,13 +98,14 @@ class ScriptedProcess(metaclass=ABCMeta):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def read_memory_at_address(self, addr, size):
|
||||
def read_memory_at_address(self, addr, size, error):
|
||||
""" Get a memory buffer from the scripted process at a certain address,
|
||||
of a certain size.
|
||||
|
||||
Args:
|
||||
addr (int): Address from which we should start reading.
|
||||
size (int): Size of the memory to read.
|
||||
error (lldb.SBError): Error object.
|
||||
|
||||
Returns:
|
||||
lldb.SBData: An `lldb.SBData` buffer with the target byte size and
|
||||
|
||||
Reference in New Issue
Block a user