blob: 47dd32affcc65ce876f4f43766b3369b6ef41c5b [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- 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"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000017
18class StringExtractor;
19class ProcessGDBRemote;
20
21class ThreadGDBRemote : public lldb_private::Thread
22{
23public:
Jim Ingham4f465cf2012-10-10 18:32:14 +000024 ThreadGDBRemote (lldb_private::Process &process, lldb::tid_t tid);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000025
26 virtual
27 ~ThreadGDBRemote ();
28
Greg Clayton160c9d82013-05-01 21:54:04 +000029 virtual void
Chris Lattner30fdc8d2010-06-08 16:52:24 +000030 WillResume (lldb::StateType resume_state);
31
32 virtual void
33 RefreshStateAfterStop();
34
35 virtual const char *
Chris Lattner30fdc8d2010-06-08 16:52:24 +000036 GetName ();
37
38 virtual const char *
39 GetQueueName ();
40
Jason Molenda3dc4f442013-10-18 05:55:24 +000041 virtual lldb::queue_id_t
42 GetQueueID ();
43
Jason Molendaaac16e02014-03-13 02:54:54 +000044 lldb::addr_t
45 GetQueueLibdispatchQueueAddress ();
46
Greg Clayton5ccbd292011-01-06 22:15:06 +000047 virtual lldb::RegisterContextSP
Chris Lattner30fdc8d2010-06-08 16:52:24 +000048 GetRegisterContext ();
49
Greg Clayton5ccbd292011-01-06 22:15:06 +000050 virtual lldb::RegisterContextSP
Jason Molendab57e4a12013-11-04 09:33:30 +000051 CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000052
Chris Lattner30fdc8d2010-06-08 16:52:24 +000053 void
54 Dump (lldb_private::Log *log, uint32_t index);
55
56 static bool
57 ThreadIDIsValid (lldb::tid_t thread);
58
59 bool
60 ShouldStop (bool &step_more);
61
62 const char *
63 GetBasicInfoAsString ();
64
Chris Lattner30fdc8d2010-06-08 16:52:24 +000065 void
Chris Lattner30fdc8d2010-06-08 16:52:24 +000066 SetName (const char *name)
67 {
68 if (name && name[0])
69 m_thread_name.assign (name);
70 else
71 m_thread_name.clear();
72 }
73
74 lldb::addr_t
75 GetThreadDispatchQAddr ()
76 {
77 return m_thread_dispatch_qaddr;
78 }
79
80 void
81 SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
82 {
83 m_thread_dispatch_qaddr = thread_dispatch_qaddr;
84 }
85
86protected:
Greg Clayton3e06bd92011-01-09 21:07:35 +000087
88 friend class ProcessGDBRemote;
89
Greg Claytone576ab22011-02-15 00:19:15 +000090 bool
Greg Clayton3e06bd92011-01-09 21:07:35 +000091 PrivateSetRegisterValue (uint32_t reg,
92 StringExtractor &response);
93
Chris Lattner30fdc8d2010-06-08 16:52:24 +000094 //------------------------------------------------------------------
95 // Member variables.
96 //------------------------------------------------------------------
Chris Lattner30fdc8d2010-06-08 16:52:24 +000097 std::string m_thread_name;
98 std::string m_dispatch_queue_name;
99 lldb::addr_t m_thread_dispatch_qaddr;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000100 //------------------------------------------------------------------
101 // Member variables.
102 //------------------------------------------------------------------
103
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000104 void
105 SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id);
106
Greg Clayton6e0ff1a2013-05-09 01:55:29 +0000107 virtual bool
108 CalculateStopInfo ();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000109
110
111};
112
113#endif // liblldb_ThreadGDBRemote_h_