]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / OperatingSystem / Python / OperatingSystemPython.h
1 //===-- OperatingSystemPython.h ---------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_OperatingSystemPython_h_
11 #define liblldb_OperatingSystemPython_h_
12
13 #ifndef LLDB_DISABLE_PYTHON
14
15 #include "lldb/Target/OperatingSystem.h"
16 #include "lldb/Utility/StructuredData.h"
17
18 class DynamicRegisterInfo;
19
20 namespace lldb_private {
21 class ScriptInterpreter;
22 }
23
24 class OperatingSystemPython : public lldb_private::OperatingSystem {
25 public:
26   OperatingSystemPython(lldb_private::Process *process,
27                         const lldb_private::FileSpec &python_module_path);
28
29   ~OperatingSystemPython() override;
30
31   //------------------------------------------------------------------
32   // Static Functions
33   //------------------------------------------------------------------
34   static lldb_private::OperatingSystem *
35   CreateInstance(lldb_private::Process *process, bool force);
36
37   static void Initialize();
38
39   static void Terminate();
40
41   static lldb_private::ConstString GetPluginNameStatic();
42
43   static const char *GetPluginDescriptionStatic();
44
45   //------------------------------------------------------------------
46   // lldb_private::PluginInterface Methods
47   //------------------------------------------------------------------
48   lldb_private::ConstString GetPluginName() override;
49
50   uint32_t GetPluginVersion() override;
51
52   //------------------------------------------------------------------
53   // lldb_private::OperatingSystem Methods
54   //------------------------------------------------------------------
55   bool UpdateThreadList(lldb_private::ThreadList &old_thread_list,
56                         lldb_private::ThreadList &real_thread_list,
57                         lldb_private::ThreadList &new_thread_list) override;
58
59   void ThreadWasSelected(lldb_private::Thread *thread) override;
60
61   lldb::RegisterContextSP
62   CreateRegisterContextForThread(lldb_private::Thread *thread,
63                                  lldb::addr_t reg_data_addr) override;
64
65   lldb::StopInfoSP
66   CreateThreadStopReason(lldb_private::Thread *thread) override;
67
68   //------------------------------------------------------------------
69   // Method for lazy creation of threads on demand
70   //------------------------------------------------------------------
71   lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) override;
72
73 protected:
74   bool IsValid() const {
75     return m_python_object_sp && m_python_object_sp->IsValid();
76   }
77
78   lldb::ThreadSP CreateThreadFromThreadInfo(
79       lldb_private::StructuredData::Dictionary &thread_dict,
80       lldb_private::ThreadList &core_thread_list,
81       lldb_private::ThreadList &old_thread_list,
82       std::vector<bool> &core_used_map, bool *did_create_ptr);
83
84   DynamicRegisterInfo *GetDynamicRegisterInfo();
85
86   lldb::ValueObjectSP m_thread_list_valobj_sp;
87   std::unique_ptr<DynamicRegisterInfo> m_register_info_ap;
88   lldb_private::ScriptInterpreter *m_interpreter;
89   lldb_private::StructuredData::ObjectSP m_python_object_sp;
90 };
91
92 #endif // LLDB_DISABLE_PYTHON
93
94 #endif // liblldb_OperatingSystemPython_h_