[lldb/Plugins] Clean-up Scripted Process interface requirements (NFC)

The goal of the simple patch is to clean-up the scripted process
interface by removing methods that were introduced with the interface
originally, but that were never really implemented (get_thread_with_id &
get_registers_for_thread).

This patch also changes `get_memory_region_containing_address` to have a
base implementation (that retunrs `None`), instead of forcing the user
to override it in their derived class.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani
2023-02-16 15:15:52 -08:00
parent b9d4c94a60
commit e02a355f98
8 changed files with 2 additions and 95 deletions

View File

@@ -94,15 +94,6 @@ class CrashLogScriptedProcess(ScriptedProcess):
self.extended_thread_info = None
self.parse_crashlog()
def get_memory_region_containing_address(self, addr: int) -> lldb.SBMemoryRegionInfo:
return None
def get_thread_with_id(self, tid: int):
return {}
def get_registers_for_thread(self, tid: int):
return {}
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()

View File

@@ -58,7 +58,6 @@ class ScriptedProcess(metaclass=ABCMeta):
"""
return self.capabilities
@abstractmethod
def get_memory_region_containing_address(self, addr):
""" Get the memory region for the scripted process, containing a
specific address.
@@ -71,7 +70,7 @@ class ScriptedProcess(metaclass=ABCMeta):
lldb.SBMemoryRegionInfo: The memory region containing the address.
None if out of bounds.
"""
pass
return None
def get_threads_info(self):
""" Get the dictionary describing the process' Scripted Threads.
@@ -83,35 +82,6 @@ class ScriptedProcess(metaclass=ABCMeta):
"""
return self.threads
@abstractmethod
def get_thread_with_id(self, tid):
""" Get the scripted process thread with a specific ID.
Args:
tid (int): Thread ID to look for in the scripted process.
Returns:
Dict: The thread represented as a dictionary, with the
tid thread ID. None if tid doesn't match any of the scripted
process threads.
"""
pass
@abstractmethod
def get_registers_for_thread(self, tid):
""" Get the register context dictionary for a certain thread of
the scripted process.
Args:
tid (int): Thread ID for the thread's register context.
Returns:
Dict: The register context represented as a dictionary, for the
tid thread. None if tid doesn't match any of the scripted
process threads.
"""
pass
@abstractmethod
def read_memory_at_address(self, addr, size, error):
""" Get a memory buffer from the scripted process at a certain address,