[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:
Med Ismail Bennani
2021-09-03 17:35:02 +00:00
parent b9e57e0305
commit 3925204c1f
11 changed files with 331 additions and 242 deletions

View File

@@ -109,8 +109,10 @@ ScriptedProcess::ScriptedProcess(
return;
}
StructuredData::ObjectSP object_sp = GetInterface().CreatePluginObject(
m_scripted_process_info.GetClassName().c_str(), target_sp,
ExecutionContext exe_ctx(target_sp, /*get_process=*/false);
StructuredData::GenericSP object_sp = GetInterface().CreatePluginObject(
m_scripted_process_info.GetClassName().c_str(), exe_ctx,
m_scripted_process_info.GetDictionarySP());
if (!object_sp || !object_sp->IsValid()) {