diff options
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt | 4 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/CMakeLists.txt | 16 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.cpp (renamed from lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp) | 25 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.h (renamed from lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.h) | 18 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 3 |
5 files changed, 57 insertions, 9 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt index f4a8bce..8c7e92b 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt @@ -20,7 +20,6 @@ if (LLDB_ENABLE_LIBEDIT) endif() add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces - OperatingSystemPythonInterface.cpp ScriptedPythonInterface.cpp ScriptedProcessPythonInterface.cpp ScriptedThreadPythonInterface.cpp @@ -36,5 +35,8 @@ add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces LINK_COMPONENTS Support ) + +add_subdirectory(OperatingSystemPythonInterface) add_subdirectory(ScriptedPlatformPythonInterface) add_subdirectory(ScriptedThreadPlanPythonInterface) + diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/CMakeLists.txt new file mode 100644 index 0000000..b48f1e8 --- /dev/null +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/CMakeLists.txt @@ -0,0 +1,16 @@ +add_lldb_library(lldbPluginScriptInterpreterPythonOperatingSystemPythonInterface PLUGIN + + OperatingSystemPythonInterface.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/OperatingSystemPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.cpp index c162c73..019db26 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "lldb/Core/PluginManager.h" #include "lldb/Host/Config.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Utility/Log.h" @@ -13,11 +14,13 @@ #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 "OperatingSystemPythonInterface.h" using namespace lldb; @@ -25,6 +28,8 @@ using namespace lldb_private; using namespace lldb_private::python; using Locker = ScriptInterpreterPythonImpl::Locker; +LLDB_PLUGIN_DEFINE_ADV(OperatingSystemPythonInterface, ScriptInterpreterPythonOperatingSystemPythonInterface) + OperatingSystemPythonInterface::OperatingSystemPythonInterface( ScriptInterpreterPythonImpl &interpreter) : OperatingSystemInterface(), ScriptedThreadPythonInterface(interpreter) {} @@ -79,4 +84,18 @@ OperatingSystemPythonInterface::GetRegisterContextForTID(lldb::tid_t tid) { return obj->GetAsString()->GetValue().str(); } +void OperatingSystemPythonInterface::Initialize() { + const std::vector<llvm::StringRef> ci_usages = { + "settings set target.process.python-os-plugin-path <script-path>", + "settings set process.experimental.os-plugin-reports-all-threads [0/1]"}; + const std::vector<llvm::StringRef> api_usages = {}; + PluginManager::RegisterPlugin( + GetPluginNameStatic(), llvm::StringRef("Mock thread state"), + CreateInstance, eScriptLanguagePython, {ci_usages, api_usages}); +} + +void OperatingSystemPythonInterface::Terminate() { + PluginManager::UnregisterPlugin(CreateInstance); +} + #endif diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.h index da7bbf1..6d60f8b 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.h @@ -10,17 +10,19 @@ #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_OPERATINGSYSTEMPYTHONINTERFACE_H #include "lldb/Host/Config.h" +#include "lldb/Interpreter/Interfaces/OperatingSystemInterface.h" #if LLDB_ENABLE_PYTHON -#include "ScriptedThreadPythonInterface.h" -#include "lldb/Interpreter/Interfaces/OperatingSystemInterface.h" +#include "../ScriptedThreadPythonInterface.h" + #include <optional> namespace lldb_private { class OperatingSystemPythonInterface : virtual public OperatingSystemInterface, - virtual public ScriptedThreadPythonInterface { + virtual public ScriptedThreadPythonInterface, + public PluginInterface { public: OperatingSystemPythonInterface(ScriptInterpreterPythonImpl &interpreter); @@ -41,6 +43,16 @@ public: StructuredData::DictionarySP GetRegisterInfo() override; std::optional<std::string> GetRegisterContextForTID(lldb::tid_t tid) override; + + static void Initialize(); + + static void Terminate(); + + static llvm::StringRef GetPluginNameStatic() { + return "OperatingSystemPythonInterface"; + } + + 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 0b956ee2..d34fdf1 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -14,11 +14,10 @@ // LLDB Python header must be included first #include "lldb-python.h" -#include "Interfaces/OperatingSystemPythonInterface.h" +#include "Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.h" #include "Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.h" #include "Interfaces/ScriptedProcessPythonInterface.h" #include "Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h" -#include "Interfaces/ScriptedThreadPythonInterface.h" #include "PythonDataObjects.h" #include "PythonReadline.h" #include "SWIGPythonBridge.h" |