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 //------------------------------------------------------------------ 82 // Method for lazy creation of threads on demand 83 //------------------------------------------------------------------ 84 virtual lldb::ThreadSP 85 CreateThread (lldb::tid_t tid, lldb::addr_t context); 86 87 protected: 88 89 bool IsValid() const 90 { 91 return m_python_object_sp && m_python_object_sp->GetObject() != NULL; 92 } 93 94 lldb::ThreadSP 95 CreateThreadFromThreadInfo (lldb_private::PythonDictionary &thread_dict, 96 lldb_private::ThreadList &core_thread_list, 97 lldb_private::ThreadList &old_thread_list, 98 bool *did_create_ptr); 99 100 DynamicRegisterInfo * 101 GetDynamicRegisterInfo (); 102 103 lldb::ValueObjectSP m_thread_list_valobj_sp; 104 std::auto_ptr<DynamicRegisterInfo> m_register_info_ap; 105 lldb_private::ScriptInterpreter *m_interpreter; 106 lldb::ScriptInterpreterObjectSP m_python_object_sp; 107 108 }; 109 110 #endif // #ifndef liblldb_OperatingSystemPython_h_ 111 #endif // #ifndef LLDB_DISABLE_PYTHON 112