xref: /llvm-project/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h (revision ead45e0174579d47baba4e5a8ab0549ffc448f34)
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 #ifndef LLDB_DISABLE_PYTHON
10 
11 #ifndef liblldb_OperatingSystemPython_h_
12 #define liblldb_OperatingSystemPython_h_
13 
14 // C Includes
15 // C++ Includes
16 // Other libraries and framework includes
17 #include "lldb/Interpreter/ScriptInterpreter.h"
18 #include "lldb/Target/OperatingSystem.h"
19 
20 class DynamicRegisterInfo;
21 
22 class OperatingSystemPython : public lldb_private::OperatingSystem
23 {
24 public:
25     //------------------------------------------------------------------
26     // Static Functions
27     //------------------------------------------------------------------
28     static lldb_private::OperatingSystem *
29     CreateInstance (lldb_private::Process *process, bool force);
30 
31     static void
32     Initialize();
33 
34     static void
35     Terminate();
36 
37     static const char *
38     GetPluginNameStatic();
39 
40     static const char *
41     GetPluginDescriptionStatic();
42 
43     //------------------------------------------------------------------
44     // Class Methods
45     //------------------------------------------------------------------
46     OperatingSystemPython (lldb_private::Process *process,
47                            const lldb_private::FileSpec &python_module_path);
48 
49     virtual
50     ~OperatingSystemPython ();
51 
52     //------------------------------------------------------------------
53     // lldb_private::PluginInterface Methods
54     //------------------------------------------------------------------
55     virtual const char *
56     GetPluginName();
57 
58     virtual const char *
59     GetShortPluginName();
60 
61     virtual uint32_t
62     GetPluginVersion();
63 
64     //------------------------------------------------------------------
65     // lldb_private::OperatingSystem Methods
66     //------------------------------------------------------------------
67     virtual bool
68     UpdateThreadList (lldb_private::ThreadList &old_thread_list,
69                       lldb_private::ThreadList &new_thread_list);
70 
71     virtual void
72     ThreadWasSelected (lldb_private::Thread *thread);
73 
74     virtual lldb::RegisterContextSP
75     CreateRegisterContextForThread (lldb_private::Thread *thread,
76                                     lldb::addr_t reg_data_addr);
77 
78     virtual lldb::StopInfoSP
79     CreateThreadStopReason (lldb_private::Thread *thread);
80 
81 protected:
82 
83     bool IsValid() const
84     {
85         return m_python_object != NULL;
86     }
87     DynamicRegisterInfo *
88     GetDynamicRegisterInfo ();
89 
90     lldb::ValueObjectSP m_thread_list_valobj_sp;
91     std::auto_ptr<DynamicRegisterInfo> m_register_info_ap;
92     lldb_private::ScriptInterpreter *m_interpreter;
93     void* m_python_object;
94 
95 };
96 
97 #endif // #ifndef liblldb_OperatingSystemPython_h_
98 #endif // #ifndef LLDB_DISABLE_PYTHON
99