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 lldb_private::ConstString 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 lldb_private::ConstString 56 GetPluginName(); 57 58 virtual uint32_t 59 GetPluginVersion(); 60 61 //------------------------------------------------------------------ 62 // lldb_private::OperatingSystem Methods 63 //------------------------------------------------------------------ 64 virtual bool 65 UpdateThreadList (lldb_private::ThreadList &old_thread_list, 66 lldb_private::ThreadList &real_thread_list, 67 lldb_private::ThreadList &new_thread_list); 68 69 virtual void 70 ThreadWasSelected (lldb_private::Thread *thread); 71 72 virtual lldb::RegisterContextSP 73 CreateRegisterContextForThread (lldb_private::Thread *thread, 74 lldb::addr_t reg_data_addr); 75 76 virtual lldb::StopInfoSP 77 CreateThreadStopReason (lldb_private::Thread *thread); 78 79 //------------------------------------------------------------------ 80 // Method for lazy creation of threads on demand 81 //------------------------------------------------------------------ 82 virtual lldb::ThreadSP 83 CreateThread (lldb::tid_t tid, lldb::addr_t context); 84 85 protected: 86 87 bool IsValid() const 88 { 89 return m_python_object_sp && m_python_object_sp->GetObject() != NULL; 90 } 91 92 lldb::ThreadSP 93 CreateThreadFromThreadInfo (lldb_private::PythonDictionary &thread_dict, 94 lldb_private::ThreadList &core_thread_list, 95 lldb_private::ThreadList &old_thread_list, 96 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::ScriptInterpreterObjectSP m_python_object_sp; 105 106 }; 107 108 #endif // #ifndef liblldb_OperatingSystemPython_h_ 109 #endif // #ifndef LLDB_DISABLE_PYTHON 110