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 
14 #if LLDB_ENABLE_PYTHON
15 
16 #include "ScriptedThreadPythonInterface.h"
17 #include "lldb/Interpreter/Interfaces/OperatingSystemInterface.h"
18 #include <optional>
19 
20 namespace lldb_private {
21 class OperatingSystemPythonInterface
22     : virtual public OperatingSystemInterface,
23       virtual public ScriptedThreadPythonInterface {
24 public:
25   OperatingSystemPythonInterface(ScriptInterpreterPythonImpl &interpreter);
26 
27   llvm::Expected<StructuredData::GenericSP>
28   CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
29                      StructuredData::DictionarySP args_sp,
30                      StructuredData::Generic *script_obj = nullptr) override;
31 
32   llvm::SmallVector<llvm::StringLiteral> GetAbstractMethods() const override {
33     return llvm::SmallVector<llvm::StringLiteral>({"get_thread_info"
34                                                    "get_register_data",
35                                                    "get_stop_reason",
36                                                    "get_register_context"});
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 } // namespace lldb_private
49 
50 #endif // LLDB_ENABLE_PYTHON
51 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_OPERATINGSYSTEMPYTHONINTERFACE_H
52