[lldb/Plugins] Add ScriptedProcess Process Plugin
This patch introduces Scripted Processes to lldb. The goal, here, is to be able to attach in the debugger to fake processes that are backed by script files (in Python, Lua, Swift, etc ...) and inspect them statically. Scripted Processes can be used in cooperative multithreading environments like the XNU Kernel or other real-time operating systems, but it can also help us improve the debugger testing infrastructure by writting synthetic tests that simulates hard-to-reproduce process/thread states. Although ScriptedProcess is not feature-complete at the moment, it has basic execution capabilities and will improve in the following patches. rdar://65508855 Differential Revision: https://reviews.llvm.org/D100384 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
@@ -29,6 +29,9 @@ class MyScriptedProcess(ScriptedProcess):
|
||||
def get_process_id(self) -> int:
|
||||
return 42
|
||||
|
||||
def should_stop(self) -> bool:
|
||||
return True
|
||||
|
||||
def is_alive(self) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
@@ -137,6 +137,24 @@ class ScriptedProcess:
|
||||
"""
|
||||
return lldb.SBError()
|
||||
|
||||
@abstractmethod
|
||||
def should_stop(self):
|
||||
""" Check if the scripted process plugin should produce the stop event.
|
||||
|
||||
Returns:
|
||||
bool: True if scripted process should broadcast a stop event.
|
||||
False otherwise.
|
||||
"""
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
""" Trigger the scripted process stop.
|
||||
|
||||
Returns:
|
||||
lldb.SBError: An `lldb.SBError` with error code 0.
|
||||
"""
|
||||
return lldb.SBError()
|
||||
|
||||
@abstractmethod
|
||||
def is_alive(self):
|
||||
""" Check if the scripted process is alive.
|
||||
|
||||
Reference in New Issue
Block a user