summaryrefslogtreecommitdiff
path: root/lldb/examples
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2023-02-16 15:15:52 -0800
committerMed Ismail Bennani <medismail.bennani@gmail.com>2023-03-03 19:33:02 -0800
commite02a355f9846d5ec9cd64b086674770ecc795c26 (patch)
tree8cc5c308c3d1d76ea4ac35f20629442ec84abeda /lldb/examples
parentb9d4c94a603d3cc1f44ab7dd1d4f3ae9c80da98b (diff)
downloadllvm-e02a355f9846d5ec9cd64b086674770ecc795c26.tar.gz
[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>
Diffstat (limited to 'lldb/examples')
-rw-r--r--lldb/examples/python/scripted_process/crashlog_scripted_process.py9
-rw-r--r--lldb/examples/python/scripted_process/scripted_process.py32
2 files changed, 1 insertions, 40 deletions
diff --git a/lldb/examples/python/scripted_process/crashlog_scripted_process.py b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
index dfb32aae6d3f..8c32b40d8c8a 100644
--- a/lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -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()
diff --git a/lldb/examples/python/scripted_process/scripted_process.py b/lldb/examples/python/scripted_process/scripted_process.py
index 8f896fc5acce..60b65fc4b4c9 100644
--- a/lldb/examples/python/scripted_process/scripted_process.py
+++ b/lldb/examples/python/scripted_process/scripted_process.py
@@ -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.
@@ -84,35 +83,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,
of a certain size.