summaryrefslogtreecommitdiff
path: root/lldb/bindings/python
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2021-01-08 21:23:34 +0100
committerMed Ismail Bennani <medismail.bennani@gmail.com>2021-01-08 21:23:34 +0100
commit68e63210aeb74d2ef6ef0110da80d1aa78ba4148 (patch)
treef16c4018b1de4df591a2abf66ec44788222166aa /lldb/bindings/python
parent0386f3d4f4183a93d7e029abef8110ae4f148335 (diff)
downloadllvm-scripted-process.tar.gz
[lldb/Target] Add Scripted Processes (WIP)scripted-process
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/bindings/python')
-rw-r--r--lldb/bindings/python/python-scripted-process.swig53
-rw-r--r--lldb/bindings/python/python.swig1
2 files changed, 54 insertions, 0 deletions
diff --git a/lldb/bindings/python/python-scripted-process.swig b/lldb/bindings/python/python-scripted-process.swig
new file mode 100644
index 000000000000..4b6888f86b77
--- /dev/null
+++ b/lldb/bindings/python/python-scripted-process.swig
@@ -0,0 +1,53 @@
+%pythoncode %{
+from abc import ABC, abstractmethod
+from typing import List
+
+import lldb
+
+class ScriptedProcess(ABC):
+ @abstractmethod
+ def __init__(self):
+ pass
+
+ # Optional initializer
+ def __init__(self, dictionary: lldb.SBStructuredData):
+ pass
+
+ ### Main funcitonnalities
+ @abstractmethod
+ def get_num_memory_regions(self) -> int:
+ pass
+
+ @abstractmethod
+ def get_memory_region_at_index(self, idx: int) -> lldb.SBMemoryRegionInfo:
+ pass
+
+ @abstractmethod
+ def get_num_threads(self):
+ pass
+
+ @abstractmethod
+ def get_thread_at_index(self, idx: int) -> lldb.SBThread:
+ pass
+
+ @abstractmethod
+ def get_register_for_thread(self, tid:int):
+ pass
+
+ @abstractmethod
+ def read_memory_at_address(self, addr:int) -> lldb.SBData:
+ pass
+
+ @abstractmethod
+ def get_loaded_images(self) -> List[str]: # -> List[lldb.SBModule]:
+ pass
+
+ ### Process state
+ @abstractmethod
+ def can_debug(self) -> bool:
+ pass
+
+ @abstractmethod
+ def is_alive(self) -> bool:
+ pass
+%}
diff --git a/lldb/bindings/python/python.swig b/lldb/bindings/python/python.swig
index 66a75328d1e7..9459c8c7be2e 100644
--- a/lldb/bindings/python/python.swig
+++ b/lldb/bindings/python/python.swig
@@ -126,6 +126,7 @@ using namespace lldb;
%include "interfaces.swig"
%include "python-extensions.swig"
%include "python-wrapper.swig"
+%include "python-scripted-process.swig"
%pythoncode%{
_initialize = True