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