19f2f44ceSEd Maste //===-- OperatingSystemPython.h ---------------------------------*- C++ -*-===//
2ac7ddfbfSEd Maste //
3ac7ddfbfSEd Maste //                     The LLVM Compiler Infrastructure
4ac7ddfbfSEd Maste //
5ac7ddfbfSEd Maste // This file is distributed under the University of Illinois Open Source
6ac7ddfbfSEd Maste // License. See LICENSE.TXT for details.
7ac7ddfbfSEd Maste //
8ac7ddfbfSEd Maste //===----------------------------------------------------------------------===//
9ac7ddfbfSEd Maste 
10ac7ddfbfSEd Maste #ifndef liblldb_OperatingSystemPython_h_
11ac7ddfbfSEd Maste #define liblldb_OperatingSystemPython_h_
12ac7ddfbfSEd Maste 
139f2f44ceSEd Maste #ifndef LLDB_DISABLE_PYTHON
149f2f44ceSEd Maste 
15ac7ddfbfSEd Maste #include "lldb/Target/OperatingSystem.h"
16a580b014SDimitry Andric #include "lldb/Utility/StructuredData.h"
17ac7ddfbfSEd Maste 
18ac7ddfbfSEd Maste class DynamicRegisterInfo;
19ac7ddfbfSEd Maste 
20435933ddSDimitry Andric namespace lldb_private {
211c3bbb01SEd Maste class ScriptInterpreter;
221c3bbb01SEd Maste }
231c3bbb01SEd Maste 
24435933ddSDimitry Andric class OperatingSystemPython : public lldb_private::OperatingSystem {
25ac7ddfbfSEd Maste public:
269f2f44ceSEd Maste   OperatingSystemPython(lldb_private::Process *process,
279f2f44ceSEd Maste                         const lldb_private::FileSpec &python_module_path);
289f2f44ceSEd Maste 
299f2f44ceSEd Maste   ~OperatingSystemPython() override;
309f2f44ceSEd Maste 
31ac7ddfbfSEd Maste   //------------------------------------------------------------------
32ac7ddfbfSEd Maste   // Static Functions
33ac7ddfbfSEd Maste   //------------------------------------------------------------------
34ac7ddfbfSEd Maste   static lldb_private::OperatingSystem *
35ac7ddfbfSEd Maste   CreateInstance(lldb_private::Process *process, bool force);
36ac7ddfbfSEd Maste 
37435933ddSDimitry Andric   static void Initialize();
38ac7ddfbfSEd Maste 
39435933ddSDimitry Andric   static void Terminate();
40ac7ddfbfSEd Maste 
41435933ddSDimitry Andric   static lldb_private::ConstString GetPluginNameStatic();
42ac7ddfbfSEd Maste 
43435933ddSDimitry Andric   static const char *GetPluginDescriptionStatic();
44ac7ddfbfSEd Maste 
45ac7ddfbfSEd Maste   //------------------------------------------------------------------
46ac7ddfbfSEd Maste   // lldb_private::PluginInterface Methods
47ac7ddfbfSEd Maste   //------------------------------------------------------------------
48435933ddSDimitry Andric   lldb_private::ConstString GetPluginName() override;
49ac7ddfbfSEd Maste 
50435933ddSDimitry Andric   uint32_t GetPluginVersion() override;
51ac7ddfbfSEd Maste 
52ac7ddfbfSEd Maste   //------------------------------------------------------------------
53ac7ddfbfSEd Maste   // lldb_private::OperatingSystem Methods
54ac7ddfbfSEd Maste   //------------------------------------------------------------------
55435933ddSDimitry Andric   bool UpdateThreadList(lldb_private::ThreadList &old_thread_list,
56ac7ddfbfSEd Maste                         lldb_private::ThreadList &real_thread_list,
579f2f44ceSEd Maste                         lldb_private::ThreadList &new_thread_list) override;
58ac7ddfbfSEd Maste 
59435933ddSDimitry Andric   void ThreadWasSelected(lldb_private::Thread *thread) override;
60ac7ddfbfSEd Maste 
619f2f44ceSEd Maste   lldb::RegisterContextSP
62ac7ddfbfSEd Maste   CreateRegisterContextForThread(lldb_private::Thread *thread,
639f2f44ceSEd Maste                                  lldb::addr_t reg_data_addr) override;
64ac7ddfbfSEd Maste 
659f2f44ceSEd Maste   lldb::StopInfoSP
669f2f44ceSEd Maste   CreateThreadStopReason(lldb_private::Thread *thread) override;
67ac7ddfbfSEd Maste 
68ac7ddfbfSEd Maste   //------------------------------------------------------------------
69ac7ddfbfSEd Maste   // Method for lazy creation of threads on demand
70ac7ddfbfSEd Maste   //------------------------------------------------------------------
71435933ddSDimitry Andric   lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) override;
72ac7ddfbfSEd Maste 
73ac7ddfbfSEd Maste protected:
IsValid()74435933ddSDimitry Andric   bool IsValid() const {
751c3bbb01SEd Maste     return m_python_object_sp && m_python_object_sp->IsValid();
76ac7ddfbfSEd Maste   }
77ac7ddfbfSEd Maste 
78435933ddSDimitry Andric   lldb::ThreadSP CreateThreadFromThreadInfo(
79435933ddSDimitry Andric       lldb_private::StructuredData::Dictionary &thread_dict,
80435933ddSDimitry Andric       lldb_private::ThreadList &core_thread_list,
81435933ddSDimitry Andric       lldb_private::ThreadList &old_thread_list,
821c3bbb01SEd Maste       std::vector<bool> &core_used_map, bool *did_create_ptr);
83ac7ddfbfSEd Maste 
84435933ddSDimitry Andric   DynamicRegisterInfo *GetDynamicRegisterInfo();
85ac7ddfbfSEd Maste 
86ac7ddfbfSEd Maste   lldb::ValueObjectSP m_thread_list_valobj_sp;
87ac7ddfbfSEd Maste   std::unique_ptr<DynamicRegisterInfo> m_register_info_ap;
88ac7ddfbfSEd Maste   lldb_private::ScriptInterpreter *m_interpreter;
891c3bbb01SEd Maste   lldb_private::StructuredData::ObjectSP m_python_object_sp;
90ac7ddfbfSEd Maste };
91ac7ddfbfSEd Maste 
929f2f44ceSEd Maste #endif // LLDB_DISABLE_PYTHON
939f2f44ceSEd Maste 
949f2f44ceSEd Maste #endif // liblldb_OperatingSystemPython_h_
95