1 //===-- ScriptedThreadPythonInterface.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_SCRIPTEDTHREADPYTHONINTERFACE_H
10 #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDTHREADPYTHONINTERFACE_H
11 
12 #if LLDB_ENABLE_PYTHON
13 // clang-format off
14 // LLDB Python header must be included first
15 #include "../lldb-python.h"
16 //clang-format on
17 #endif
18 
19 #include "lldb/Host/Config.h"
20 
21 #if LLDB_ENABLE_PYTHON
22 
23 #include "ScriptedPythonInterface.h"
24 #include "lldb/Interpreter/Interfaces/ScriptedThreadInterface.h"
25 #include <optional>
26 
27 namespace lldb_private {
28 class ScriptedThreadPythonInterface : public ScriptedThreadInterface,
29                                       public ScriptedPythonInterface {
30 public:
31   ScriptedThreadPythonInterface(ScriptInterpreterPythonImpl &interpreter);
32 
33   llvm::Expected<StructuredData::GenericSP>
34   CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
35                      StructuredData::DictionarySP args_sp,
36                      StructuredData::Generic *script_obj = nullptr) override;
37 
38   llvm::SmallVector<llvm::StringLiteral> GetAbstractMethods() const override {
39     return llvm::SmallVector<llvm::StringLiteral>(
40         {"get_stop_reason", "get_register_context"});
41   }
42 
43   lldb::tid_t GetThreadID() override;
44 
45   std::optional<std::string> GetName() override;
46 
47   lldb::StateType GetState() override;
48 
49   std::optional<std::string> GetQueue() override;
50 
51   StructuredData::DictionarySP GetStopReason() override;
52 
53   StructuredData::ArraySP GetStackFrames() override;
54 
55   StructuredData::DictionarySP GetRegisterInfo() override;
56 
57   std::optional<std::string> GetRegisterContext() override;
58 
59   StructuredData::ArraySP GetExtendedInfo() override;
60 };
61 } // namespace lldb_private
62 
63 #endif // LLDB_ENABLE_PYTHON
64 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDTHREADPYTHONINTERFACE_H
65