diff options
author | Med Ismail Bennani <medismail.bennani@gmail.com> | 2023-03-03 21:39:36 -0800 |
---|---|---|
committer | Med Ismail Bennani <medismail.bennani@gmail.com> | 2023-03-06 13:14:15 -0800 |
commit | 3c33d72e7fa83beb8a9b39fb3b8ecf4ee00c697d (patch) | |
tree | 0ce14b34cbc86306b6a8ec444d1e9ed0b789d17c /lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp | |
parent | 3675e0bb67fa86b8476a67bb1a7623a6b1a373b3 (diff) | |
download | llvm-3c33d72e7fa83beb8a9b39fb3b8ecf4ee00c697d.zip llvm-3c33d72e7fa83beb8a9b39fb3b8ecf4ee00c697d.tar.gz llvm-3c33d72e7fa83beb8a9b39fb3b8ecf4ee00c697d.tar.bz2 |
[lldb] Move ScriptedProcess private state update to implementation
While debugging a Scripted Process, in order to update its state and
work nicely with lldb's execution model, it needs to toggle its private
state from running to stopped, which will result in broadcasting a
process state changed event to the debugger listener.
Originally, this state update was done systematically in the Scripted
Process C++ plugin, however in order to make scripted process
interactive, we need to be able to update their state dynamically.
This patch makes use of the recent addition of the
`SBProcess::ForceScriptedState` to programatically, and moves the
process private state update to the python implementation of the `resume`
method instead of doing it in `ScriptedProcess::DoResume`.
This patch also removes the unused `ShouldStop` & `Stop` scripted
process APIs, and adds new ScriptedInterface transform methods for
boolean arguments. This allow the user to programmatically decide if
after running the process, we should stop it (which is the default setting).
Differential Revision: https://reviews.llvm.org/D145295
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp index cffa3bd..0c6f308 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp @@ -80,21 +80,8 @@ Status ScriptedProcessPythonInterface::Launch() { } Status ScriptedProcessPythonInterface::Resume() { - return GetStatusFromMethod("resume"); -} - -bool ScriptedProcessPythonInterface::ShouldStop() { - Status error; - StructuredData::ObjectSP obj = Dispatch("is_alive", error); - - if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj, error)) - return {}; - - return obj->GetBooleanValue(); -} - -Status ScriptedProcessPythonInterface::Stop() { - return GetStatusFromMethod("stop"); + // When calling ScriptedProcess.Resume from lldb we should always stop. + return GetStatusFromMethod("resume", /*should_stop=*/true); } std::optional<MemoryRegionInfo> |