[lldb/Plugins] Introduce Scripted Interface Factory
This patch splits the previous `ScriptedProcessPythonInterface` into multiple specific classes: 1. The `ScriptedInterface` abstract class that carries the interface instance object and its virtual pure abstract creation method. 2. The `ScriptedPythonInterface` that holds a generic `Dispatch` method that can be used by various interfaces to call python methods and also keeps a reference to the Python Script Interpreter instance. 3. The `ScriptedProcessInterface` that describes the base Scripted Process model with all the methods used in the underlying script. All these components are used to refactor the `ScriptedProcessPythonInterface` class, making it more modular. This patch is also a requirement for the upcoming work on `ScriptedThread`. Differential Revision: https://reviews.llvm.org/D107521 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
1 parent
b9e57e0305
commit
3925204c1f
11 files changed
+331
-242
No files matched your search
@@ -13,17 +13,18 @@
|
||||
|
||||
#if LLDB_ENABLE_PYTHON
|
||||
|
||||
#include "ScriptedPythonInterface.h"
|
||||
#include "lldb/Interpreter/ScriptedProcessInterface.h"
|
||||
|
||||
namespace lldb_private {
|
||||
class ScriptInterpreterPythonImpl;
|
||||
class ScriptedProcessPythonInterface : public ScriptedProcessInterface {
|
||||
class ScriptedProcessPythonInterface : public ScriptedProcessInterface,
|
||||
public ScriptedPythonInterface {
|
||||
public:
|
||||
ScriptedProcessPythonInterface(ScriptInterpreterPythonImpl &interpreter)
|
||||
: ScriptedProcessInterface(), m_interpreter(interpreter) {}
|
||||
ScriptedProcessPythonInterface(ScriptInterpreterPythonImpl &interpreter);
|
||||
|
||||
StructuredData::GenericSP
|
||||
CreatePluginObject(const llvm::StringRef class_name, lldb::TargetSP target_sp,
|
||||
CreatePluginObject(const llvm::StringRef class_name,
|
||||
ExecutionContext &exe_ctx,
|
||||
StructuredData::DictionarySP args_sp) override;
|
||||
|
||||
Status Launch() override;
|
||||
@@ -49,16 +50,6 @@ public:
|
||||
lldb::pid_t GetProcessID() override;
|
||||
|
||||
bool IsAlive() override;
|
||||
|
||||
protected:
|
||||
llvm::Optional<unsigned long long>
|
||||
GetGenericInteger(llvm::StringRef method_name);
|
||||
Status GetStatusFromMethod(llvm::StringRef method_name);
|
||||
|
||||
private:
|
||||
// The lifetime is managed by the ScriptInterpreter
|
||||
ScriptInterpreterPythonImpl &m_interpreter;
|
||||
StructuredData::GenericSP m_object_instance_sp;
|
||||
};
|
||||
} // namespace lldb_private
|
||||
|
||||
|
||||
Reference in new issue
Block a user