| 1 | //===-- OperatingSystemPythonInterface.h ------------------------*- C++ -*-===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_OPERATINGSYSTEMPYTHONINTERFACE_H |
| 10 | #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_OPERATINGSYSTEMPYTHONINTERFACE_H |
| 11 | |
| 12 | #include "lldb/Host/Config.h" |
| 13 | #include "lldb/Interpreter/Interfaces/OperatingSystemInterface.h" |
| 14 | |
| 15 | #if LLDB_ENABLE_PYTHON |
| 16 | |
| 17 | #include "ScriptedThreadPythonInterface.h" |
| 18 | |
| 19 | #include <optional> |
| 20 | |
| 21 | namespace lldb_private { |
| 22 | class OperatingSystemPythonInterface |
| 23 | : virtual public OperatingSystemInterface, |
| 24 | virtual public ScriptedThreadPythonInterface, |
| 25 | public PluginInterface { |
| 26 | public: |
| 27 | OperatingSystemPythonInterface(ScriptInterpreterPythonImpl &interpreter); |
| 28 | |
| 29 | llvm::Expected<StructuredData::GenericSP> |
| 30 | CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, |
| 31 | StructuredData::DictionarySP args_sp, |
| 32 | StructuredData::Generic *script_obj = nullptr) override; |
| 33 | |
| 34 | llvm::SmallVector<AbstractMethodRequirement> |
| 35 | GetAbstractMethodRequirements() const override { |
| 36 | return llvm::SmallVector<AbstractMethodRequirement>({{.name: "get_thread_info"}}); |
| 37 | } |
| 38 | |
| 39 | StructuredData::DictionarySP CreateThread(lldb::tid_t tid, |
| 40 | lldb::addr_t context) override; |
| 41 | |
| 42 | StructuredData::ArraySP GetThreadInfo() override; |
| 43 | |
| 44 | StructuredData::DictionarySP GetRegisterInfo() override; |
| 45 | |
| 46 | std::optional<std::string> GetRegisterContextForTID(lldb::tid_t tid) override; |
| 47 | |
| 48 | std::optional<bool> DoesPluginReportAllThreads() override; |
| 49 | |
| 50 | static void Initialize(); |
| 51 | |
| 52 | static void Terminate(); |
| 53 | |
| 54 | static llvm::StringRef GetPluginNameStatic() { |
| 55 | return "OperatingSystemPythonInterface"; |
| 56 | } |
| 57 | |
| 58 | llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } |
| 59 | }; |
| 60 | } // namespace lldb_private |
| 61 | |
| 62 | #endif // LLDB_ENABLE_PYTHON |
| 63 | #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_OPERATINGSYSTEMPYTHONINTERFACE_H |
| 64 |
