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/Core/StructuredData.h" 18 #include "lldb/Target/OperatingSystem.h" 19 20 class DynamicRegisterInfo; 21 22 namespace lldb_private 23 { 24 class ScriptInterpreter; 25 } 26 27 class OperatingSystemPython : public lldb_private::OperatingSystem 28 { 29 public: 30 //------------------------------------------------------------------ 31 // Static Functions 32 //------------------------------------------------------------------ 33 static lldb_private::OperatingSystem * 34 CreateInstance (lldb_private::Process *process, bool force); 35 36 static void 37 Initialize(); 38 39 static void 40 Terminate(); 41 42 static lldb_private::ConstString 43 GetPluginNameStatic(); 44 45 static const char * 46 GetPluginDescriptionStatic(); 47 48 //------------------------------------------------------------------ 49 // Class Methods 50 //------------------------------------------------------------------ 51 OperatingSystemPython (lldb_private::Process *process, 52 const lldb_private::FileSpec &python_module_path); 53 54 virtual 55 ~OperatingSystemPython (); 56 57 //------------------------------------------------------------------ 58 // lldb_private::PluginInterface Methods 59 //------------------------------------------------------------------ 60 virtual lldb_private::ConstString 61 GetPluginName(); 62 63 virtual uint32_t 64 GetPluginVersion(); 65 66 //------------------------------------------------------------------ 67 // lldb_private::OperatingSystem Methods 68 //------------------------------------------------------------------ 69 virtual bool 70 UpdateThreadList (lldb_private::ThreadList &old_thread_list, 71 lldb_private::ThreadList &real_thread_list, 72 lldb_private::ThreadList &new_thread_list); 73 74 virtual void 75 ThreadWasSelected (lldb_private::Thread *thread); 76 77 virtual lldb::RegisterContextSP 78 CreateRegisterContextForThread (lldb_private::Thread *thread, 79 lldb::addr_t reg_data_addr); 80 81 virtual lldb::StopInfoSP 82 CreateThreadStopReason (lldb_private::Thread *thread); 83 84 //------------------------------------------------------------------ 85 // Method for lazy creation of threads on demand 86 //------------------------------------------------------------------ 87 virtual lldb::ThreadSP 88 CreateThread (lldb::tid_t tid, lldb::addr_t context); 89 90 protected: 91 92 bool IsValid() const 93 { 94 return m_python_object_sp && m_python_object_sp->IsValid(); 95 } 96 97 lldb::ThreadSP CreateThreadFromThreadInfo(lldb_private::StructuredData::Dictionary &thread_dict, 98 lldb_private::ThreadList &core_thread_list, lldb_private::ThreadList &old_thread_list, 99 std::vector<bool> &core_used_map, bool *did_create_ptr); 100 101 DynamicRegisterInfo * 102 GetDynamicRegisterInfo (); 103 104 lldb::ValueObjectSP m_thread_list_valobj_sp; 105 std::unique_ptr<DynamicRegisterInfo> m_register_info_ap; 106 lldb_private::ScriptInterpreter *m_interpreter; 107 lldb_private::StructuredData::ObjectSP m_python_object_sp; 108 }; 109 110 #endif // #ifndef liblldb_OperatingSystemPython_h_ 111 #endif // #ifndef LLDB_DISABLE_PYTHON 112