1 //===-- OperatingSystem.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_OperatingSystem_h_ 11 #define liblldb_OperatingSystem_h_ 12 13 // C Includes 14 // C++ Includes 15 // Other libraries and framework includes 16 17 #include "lldb/lldb-private.h" 18 #include "lldb/Core/PluginInterface.h" 19 20 namespace lldb_private { 21 22 //---------------------------------------------------------------------- 23 /// @class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h" 24 /// @brief A plug-in interface definition class for halted OS helpers. 25 /// 26 /// Halted OS plug-ins can be used by any process to locate and create 27 /// OS objects, like threads, during the lifetime of a debug session. 28 /// This is commonly used when attaching to an operating system that is 29 /// halted, such as when debugging over JTAG or connecting to low level 30 /// kernel debug services. 31 //---------------------------------------------------------------------- 32 33 class OperatingSystem : 34 public PluginInterface 35 36 { 37 public: 38 //------------------------------------------------------------------ 39 /// Find a halted OS plugin for a given process. 40 /// 41 /// Scans the installed OperatingSystem plug-ins and tries to find 42 /// an instance that matches the current target triple and 43 /// executable. 44 /// 45 /// @param[in] process 46 /// The process for which to try and locate a halted OS 47 /// plug-in instance. 48 /// 49 /// @param[in] plugin_name 50 /// An optional name of a specific halted OS plug-in that 51 /// should be used. If NULL, pick the best plug-in. 52 //------------------------------------------------------------------ 53 static OperatingSystem* 54 FindPlugin (Process *process, const char *plugin_name); 55 56 //------------------------------------------------------------------ 57 // Class Methods 58 //------------------------------------------------------------------ 59 OperatingSystem (Process *process); 60 61 virtual 62 ~OperatingSystem(); 63 64 //------------------------------------------------------------------ 65 // Plug-in Methods 66 //------------------------------------------------------------------ 67 virtual bool 68 UpdateThreadList (ThreadList &old_thread_list, 69 ThreadList &real_thread_list, 70 ThreadList &new_thread_list) = 0; 71 72 virtual void 73 ThreadWasSelected (Thread *thread) = 0; 74 75 virtual lldb::RegisterContextSP 76 CreateRegisterContextForThread (Thread *thread, lldb::addr_t reg_data_addr) = 0; 77 78 virtual lldb::StopInfoSP 79 CreateThreadStopReason (Thread *thread) = 0; 80 81 virtual lldb::ThreadSP CreateThread(lldb::tid_t tid,lldb::addr_t context)82 CreateThread (lldb::tid_t tid, lldb::addr_t context) 83 { 84 return lldb::ThreadSP(); 85 } 86 87 virtual bool 88 IsOperatingSystemPluginThread (const lldb::ThreadSP &thread_sp); 89 90 protected: 91 //------------------------------------------------------------------ 92 // Member variables. 93 //------------------------------------------------------------------ 94 Process* m_process; ///< The process that this dynamic loader plug-in is tracking. 95 private: 96 DISALLOW_COPY_AND_ASSIGN (OperatingSystem); 97 }; 98 99 } // namespace lldb_private 100 101 #endif // #ifndef liblldb_OperatingSystem_h_ 102