blob: 09f868452637847c1f31f8de5cf425846eb0f963 [file] [log] [blame]
Chris Lattner24943d22010-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 Lattner24943d22010-06-08 16:52:24 +000017
18class StringExtractor;
19class ProcessGDBRemote;
20
21class ThreadGDBRemote : public lldb_private::Thread
22{
23public:
24 ThreadGDBRemote (ProcessGDBRemote &process, lldb::tid_t tid);
25
26 virtual
27 ~ThreadGDBRemote ();
28
29 virtual bool
30 WillResume (lldb::StateType resume_state);
31
32 virtual void
33 RefreshStateAfterStop();
34
35 virtual const char *
Chris Lattner24943d22010-06-08 16:52:24 +000036 GetName ();
37
38 virtual const char *
39 GetQueueName ();
40
Greg Clayton08d7d3a2011-01-06 22:15:06 +000041 virtual lldb::RegisterContextSP
Chris Lattner24943d22010-06-08 16:52:24 +000042 GetRegisterContext ();
43
Greg Clayton08d7d3a2011-01-06 22:15:06 +000044 virtual lldb::RegisterContextSP
Chris Lattner24943d22010-06-08 16:52:24 +000045 CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
46
Chris Lattner24943d22010-06-08 16:52:24 +000047 virtual void
48 ClearStackFrames ();
49
50 ProcessGDBRemote &
51 GetGDBProcess ()
52 {
53 return (ProcessGDBRemote &)m_process;
54 }
55
56 const ProcessGDBRemote &
57 GetGDBProcess () const
58 {
59 return (ProcessGDBRemote &)m_process;
60 }
61
62 void
63 Dump (lldb_private::Log *log, uint32_t index);
64
65 static bool
66 ThreadIDIsValid (lldb::tid_t thread);
67
68 bool
69 ShouldStop (bool &step_more);
70
71 const char *
72 GetBasicInfoAsString ();
73
Chris Lattner24943d22010-06-08 16:52:24 +000074 void
Chris Lattner24943d22010-06-08 16:52:24 +000075 SetName (const char *name)
76 {
77 if (name && name[0])
78 m_thread_name.assign (name);
79 else
80 m_thread_name.clear();
81 }
82
83 lldb::addr_t
84 GetThreadDispatchQAddr ()
85 {
86 return m_thread_dispatch_qaddr;
87 }
88
89 void
90 SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
91 {
92 m_thread_dispatch_qaddr = thread_dispatch_qaddr;
93 }
94
95protected:
Greg Claytona875b642011-01-09 21:07:35 +000096
97 friend class ProcessGDBRemote;
98
Greg Claytonc3c46612011-02-15 00:19:15 +000099 bool
Greg Claytona875b642011-01-09 21:07:35 +0000100 PrivateSetRegisterValue (uint32_t reg,
101 StringExtractor &response);
102
Chris Lattner24943d22010-06-08 16:52:24 +0000103 //------------------------------------------------------------------
104 // Member variables.
105 //------------------------------------------------------------------
Chris Lattner24943d22010-06-08 16:52:24 +0000106 std::string m_thread_name;
107 std::string m_dispatch_queue_name;
108 lldb::addr_t m_thread_dispatch_qaddr;
Chris Lattner24943d22010-06-08 16:52:24 +0000109 //------------------------------------------------------------------
110 // Member variables.
111 //------------------------------------------------------------------
112
Chris Lattner24943d22010-06-08 16:52:24 +0000113 void
114 SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id);
115
Greg Clayton643ee732010-08-04 01:40:35 +0000116 virtual lldb::StopInfoSP
117 GetPrivateStopReason ();
Chris Lattner24943d22010-06-08 16:52:24 +0000118
119
120};
121
122#endif // liblldb_ThreadGDBRemote_h_