diff options
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/ScriptedThreadPlanPythonInterface/CMakeLists.txt | 16 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.cpp (renamed from lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.cpp) | 26 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h (renamed from lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.h) | 18 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 2 |
5 files changed, 56 insertions, 8 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt index c60e4bb..c4265eb7 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 - ScriptedThreadPlanPythonInterface.cpp ScriptedPlatformPythonInterface.cpp LINK_LIBS @@ -38,3 +37,4 @@ add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces LINK_COMPONENTS Support ) +add_subdirectory(ScriptedThreadPlanPythonInterface) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/CMakeLists.txt new file mode 100644 index 0000000..db41da1 --- /dev/null +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/CMakeLists.txt @@ -0,0 +1,16 @@ +add_lldb_library(lldbPluginScriptInterpreterPythonScriptedThreadPlanPythonInterface PLUGIN + + ScriptedThreadPlanPythonInterface.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/ScriptedThreadPlanPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.cpp index f23858c..5f1c7da 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.cpp @@ -6,23 +6,28 @@ // //===----------------------------------------------------------------------===// +#include "lldb/Core/PluginManager.h" #include "lldb/Host/Config.h" #include "lldb/Utility/Log.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 "ScriptedThreadPlanPythonInterface.h" using namespace lldb; using namespace lldb_private; using namespace lldb_private::python; +LLDB_PLUGIN_DEFINE_ADV(ScriptedThreadPlanPythonInterface, ScriptInterpreterPythonScriptedThreadPlanPythonInterface) + ScriptedThreadPlanPythonInterface::ScriptedThreadPlanPythonInterface( ScriptInterpreterPythonImpl &interpreter) : ScriptedThreadPlanInterface(), ScriptedPythonInterface(interpreter) {} @@ -102,4 +107,19 @@ ScriptedThreadPlanPythonInterface::GetStopDescription(lldb::StreamSP &stream) { return llvm::Error::success(); } +void ScriptedThreadPlanPythonInterface::Initialize() { + const std::vector<llvm::StringRef> ci_usages = { + "thread step-scripted -C <script-name> [-k key -v value ...]"}; + const std::vector<llvm::StringRef> api_usages = { + "SBThread.StepUsingScriptedThreadPlan"}; + PluginManager::RegisterPlugin( + GetPluginNameStatic(), + llvm::StringRef("Alter thread stepping logic and stop reason"), + CreateInstance, eScriptLanguagePython, {ci_usages, api_usages}); +} + +void ScriptedThreadPlanPythonInterface::Terminate() { + PluginManager::UnregisterPlugin(CreateInstance); +} + #endif diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h index 6ec89b9..c0a82f4 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h @@ -10,16 +10,18 @@ #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDTHREADPLANPYTHONINTERFACE_H #include "lldb/Host/Config.h" +#include "lldb/Interpreter/Interfaces/ScriptedThreadPlanInterface.h" #if LLDB_ENABLE_PYTHON -#include "ScriptedPythonInterface.h" -#include "lldb/Interpreter/Interfaces/ScriptedThreadPlanInterface.h" +#include "../ScriptedPythonInterface.h" + #include <optional> namespace lldb_private { class ScriptedThreadPlanPythonInterface : public ScriptedThreadPlanInterface, - public ScriptedPythonInterface { + public ScriptedPythonInterface, + public PluginInterface { public: ScriptedThreadPlanPythonInterface(ScriptInterpreterPythonImpl &interpreter); @@ -41,6 +43,16 @@ public: lldb::StateType GetRunState() override; llvm::Error GetStopDescription(lldb::StreamSP &stream) override; + + static void Initialize(); + + static void Terminate(); + + static llvm::StringRef GetPluginNameStatic() { + return "ScriptedThreadPlanPythonInterface"; + } + + 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 70fa6d8..9241465 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -17,7 +17,7 @@ #include "Interfaces/OperatingSystemPythonInterface.h" #include "Interfaces/ScriptedPlatformPythonInterface.h" #include "Interfaces/ScriptedProcessPythonInterface.h" -#include "Interfaces/ScriptedThreadPlanPythonInterface.h" +#include "Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h" #include "Interfaces/ScriptedThreadPythonInterface.h" #include "PythonDataObjects.h" #include "PythonReadline.h" |