1 //===-- ThreadMachCore.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_ThreadMachCore_h_ 11 #define liblldb_ThreadMachCore_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <string> 16 17 // Other libraries and framework includes 18 // Project includes 19 #include "lldb/Target/Thread.h" 20 21 class ProcessMachCore; 22 23 class ThreadMachCore : public lldb_private::Thread 24 { 25 public: 26 ThreadMachCore (lldb_private::Process &process, 27 lldb::tid_t tid); 28 29 ~ThreadMachCore() override; 30 31 void 32 RefreshStateAfterStop() override; 33 34 const char * 35 GetName() override; 36 37 lldb::RegisterContextSP 38 GetRegisterContext() override; 39 40 lldb::RegisterContextSP 41 CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override; 42 43 static bool 44 ThreadIDIsValid (lldb::tid_t thread); 45 46 bool 47 ShouldStop (bool &step_more); 48 49 const char * 50 GetBasicInfoAsString (); 51 52 void 53 SetName(const char *name) override 54 { 55 if (name && name[0]) 56 m_thread_name.assign (name); 57 else 58 m_thread_name.clear(); 59 } 60 61 lldb::addr_t 62 GetThreadDispatchQAddr () 63 { 64 return m_thread_dispatch_qaddr; 65 } 66 67 void 68 SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr) 69 { 70 m_thread_dispatch_qaddr = thread_dispatch_qaddr; 71 } 72 73 protected: 74 friend class ProcessMachCore; 75 76 //------------------------------------------------------------------ 77 // Member variables. 78 //------------------------------------------------------------------ 79 std::string m_thread_name; 80 std::string m_dispatch_queue_name; 81 lldb::addr_t m_thread_dispatch_qaddr; 82 lldb::RegisterContextSP m_thread_reg_ctx_sp; 83 84 //------------------------------------------------------------------ 85 // Protected member functions. 86 //------------------------------------------------------------------ 87 bool 88 CalculateStopInfo() override; 89 }; 90 91 #endif // liblldb_ThreadMachCore_h_ 92