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 #include <string> 14 15 #include "lldb/Target/Thread.h" 16 17 class ProcessMachCore; 18 19 class ThreadMachCore : public lldb_private::Thread { 20 public: 21 ThreadMachCore(lldb_private::Process &process, lldb::tid_t tid); 22 23 ~ThreadMachCore() override; 24 25 void RefreshStateAfterStop() override; 26 27 const char *GetName() override; 28 29 lldb::RegisterContextSP GetRegisterContext() override; 30 31 lldb::RegisterContextSP 32 CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override; 33 34 static bool ThreadIDIsValid(lldb::tid_t thread); 35 36 bool ShouldStop(bool &step_more); 37 38 const char *GetBasicInfoAsString(); 39 40 void SetName(const char *name) override { 41 if (name && name[0]) 42 m_thread_name.assign(name); 43 else 44 m_thread_name.clear(); 45 } 46 47 lldb::addr_t GetThreadDispatchQAddr() { return m_thread_dispatch_qaddr; } 48 49 void SetThreadDispatchQAddr(lldb::addr_t thread_dispatch_qaddr) { 50 m_thread_dispatch_qaddr = thread_dispatch_qaddr; 51 } 52 53 protected: 54 friend class ProcessMachCore; 55 56 //------------------------------------------------------------------ 57 // Member variables. 58 //------------------------------------------------------------------ 59 std::string m_thread_name; 60 std::string m_dispatch_queue_name; 61 lldb::addr_t m_thread_dispatch_qaddr; 62 lldb::RegisterContextSP m_thread_reg_ctx_sp; 63 64 //------------------------------------------------------------------ 65 // Protected member functions. 66 //------------------------------------------------------------------ 67 bool CalculateStopInfo() override; 68 }; 69 70 #endif // liblldb_ThreadMachCore_h_ 71