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