1 //===-- ThreadGDBRemote.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_ThreadGDBRemote_h_ 11 #define liblldb_ThreadGDBRemote_h_ 12 13 #include <string> 14 15 #include "lldb/Target/Process.h" 16 #include "lldb/Target/Thread.h" 17 18 class StringExtractor; 19 class ProcessGDBRemote; 20 21 class ThreadGDBRemote : public lldb_private::Thread 22 { 23 public: 24 ThreadGDBRemote (lldb_private::Process &process, lldb::tid_t tid); 25 26 virtual 27 ~ThreadGDBRemote (); 28 29 virtual void 30 WillResume (lldb::StateType resume_state); 31 32 virtual void 33 RefreshStateAfterStop(); 34 35 virtual const char * 36 GetName (); 37 38 virtual const char * 39 GetQueueName (); 40 41 virtual lldb::RegisterContextSP 42 GetRegisterContext (); 43 44 virtual lldb::RegisterContextSP 45 CreateRegisterContextForFrame (lldb_private::StackFrame *frame); 46 47 void 48 Dump (lldb_private::Log *log, uint32_t index); 49 50 static bool 51 ThreadIDIsValid (lldb::tid_t thread); 52 53 bool 54 ShouldStop (bool &step_more); 55 56 const char * 57 GetBasicInfoAsString (); 58 59 void 60 SetName (const char *name) 61 { 62 if (name && name[0]) 63 m_thread_name.assign (name); 64 else 65 m_thread_name.clear(); 66 } 67 68 lldb::addr_t 69 GetThreadDispatchQAddr () 70 { 71 return m_thread_dispatch_qaddr; 72 } 73 74 void 75 SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr) 76 { 77 m_thread_dispatch_qaddr = thread_dispatch_qaddr; 78 } 79 80 protected: 81 82 friend class ProcessGDBRemote; 83 84 bool 85 PrivateSetRegisterValue (uint32_t reg, 86 StringExtractor &response); 87 88 //------------------------------------------------------------------ 89 // Member variables. 90 //------------------------------------------------------------------ 91 std::string m_thread_name; 92 std::string m_dispatch_queue_name; 93 lldb::addr_t m_thread_dispatch_qaddr; 94 //------------------------------------------------------------------ 95 // Member variables. 96 //------------------------------------------------------------------ 97 98 void 99 SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id); 100 101 virtual bool 102 CalculateStopInfo (); 103 104 105 }; 106 107 #endif // liblldb_ThreadGDBRemote_h_ 108