diff options
author | Med Ismail Bennani <ismail@bennani.ma> | 2024-07-27 14:19:48 -0700 |
---|---|---|
committer | Med Ismail Bennani <ismail@bennani.ma> | 2024-07-27 14:21:18 -0700 |
commit | ecf125eaf0b10f18f4ef27f0ebc20f6ab8108247 (patch) | |
tree | 2cc8d0f0cfc5dae21328507de41449c032736322 /lldb/source/Plugins/ScriptInterpreter/Python | |
parent | f1a7d146e002e109ac8776c9ed7ddd078b6d4247 (diff) | |
download | llvm-ecf125eaf0b10f18f4ef27f0ebc20f6ab8108247.zip llvm-ecf125eaf0b10f18f4ef27f0ebc20f6ab8108247.tar.gz llvm-ecf125eaf0b10f18f4ef27f0ebc20f6ab8108247.tar.bz2 |
[lldb] Add ScriptedPlatform to `scripting template list`
This patch is a follow-up to bccff3baeff8 which adds the
`ScriptedPlatform` extension to the `scripting template list` command as
well as its description.
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt | 2 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/CMakeLists.txt | 16 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.cpp (renamed from lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp) | 24 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.h (renamed from lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.h) | 17 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 2 |
5 files changed, 51 insertions, 10 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt index c4265eb7..f4a8bce 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt @@ -24,7 +24,6 @@ add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces ScriptedPythonInterface.cpp ScriptedProcessPythonInterface.cpp ScriptedThreadPythonInterface.cpp - ScriptedPlatformPythonInterface.cpp LINK_LIBS lldbCore @@ -37,4 +36,5 @@ add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces LINK_COMPONENTS Support ) +add_subdirectory(ScriptedPlatformPythonInterface) add_subdirectory(ScriptedThreadPlanPythonInterface) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/CMakeLists.txt new file mode 100644 index 0000000..ae5e525 --- /dev/null +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/CMakeLists.txt @@ -0,0 +1,16 @@ +add_lldb_library(lldbPluginScriptInterpreterPythonScriptedPlatformPythonInterface PLUGIN + + ScriptedPlatformPythonInterface.cpp + + LINK_LIBS + lldbCore + lldbHost + lldbInterpreter + lldbTarget + lldbPluginScriptInterpreterPython + ${Python3_LIBRARIES} + ${LLDB_LIBEDIT_LIBS} + + LINK_COMPONENTS + Support + ) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.cpp index 6e93bec..3586251 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.cpp @@ -6,27 +6,31 @@ // //===----------------------------------------------------------------------===// +#include "lldb/Core/PluginManager.h" #include "lldb/Host/Config.h" +#include "lldb/Target/ExecutionContext.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Status.h" #include "lldb/lldb-enumerations.h" #if LLDB_ENABLE_PYTHON +// clang-format off // LLDB Python header must be included first -#include "../lldb-python.h" +#include "../../lldb-python.h" +//clang-format on -#include "../SWIGPythonBridge.h" -#include "../ScriptInterpreterPythonImpl.h" +#include "../../SWIGPythonBridge.h" +#include "../../ScriptInterpreterPythonImpl.h" #include "ScriptedPlatformPythonInterface.h" -#include "lldb/Target/ExecutionContext.h" - using namespace lldb; using namespace lldb_private; using namespace lldb_private::python; using Locker = ScriptInterpreterPythonImpl::Locker; +LLDB_PLUGIN_DEFINE_ADV(ScriptedPlatformPythonInterface, ScriptInterpreterPythonScriptedPlatformPythonInterface) + ScriptedPlatformPythonInterface::ScriptedPlatformPythonInterface( ScriptInterpreterPythonImpl &interpreter) : ScriptedPlatformInterface(), ScriptedPythonInterface(interpreter) {} @@ -93,4 +97,14 @@ Status ScriptedPlatformPythonInterface::KillProcess(lldb::pid_t pid) { return GetStatusFromMethod("kill_process", pid); } +void ScriptedPlatformPythonInterface::Initialize() { + PluginManager::RegisterPlugin( + GetPluginNameStatic(), "Mock platform and interact with its processes.", + CreateInstance, eScriptLanguagePython, {}); +} + +void ScriptedPlatformPythonInterface::Terminate() { + PluginManager::UnregisterPlugin(CreateInstance); +} + #endif // LLDB_ENABLE_PYTHON diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.h index 0842d3a..01ee40a 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.h @@ -10,15 +10,16 @@ #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDPLATFORMPYTHONINTERFACE_H #include "lldb/Host/Config.h" +#include "lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h" #if LLDB_ENABLE_PYTHON -#include "ScriptedPythonInterface.h" -#include "lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h" +#include "../ScriptedPythonInterface.h" namespace lldb_private { class ScriptedPlatformPythonInterface : public ScriptedPlatformInterface, - public ScriptedPythonInterface { + public ScriptedPythonInterface, + public PluginInterface { public: ScriptedPlatformPythonInterface(ScriptInterpreterPythonImpl &interpreter); @@ -43,6 +44,16 @@ public: Status LaunchProcess(lldb::ProcessLaunchInfoSP launch_info) override; Status KillProcess(lldb::pid_t pid) override; + + static void Initialize(); + + static void Terminate(); + + static llvm::StringRef GetPluginNameStatic() { + return "ScriptedPlatformPythonInterface"; + } + + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } }; } // namespace lldb_private diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 9241465..0b956ee2 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -15,7 +15,7 @@ #include "lldb-python.h" #include "Interfaces/OperatingSystemPythonInterface.h" -#include "Interfaces/ScriptedPlatformPythonInterface.h" +#include "Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.h" #include "Interfaces/ScriptedProcessPythonInterface.h" #include "Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h" #include "Interfaces/ScriptedThreadPythonInterface.h" |