blob: 3bf54afa9bef44a399c8df2c8c75fc4f67cabb5d [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 *
36 GetInfo ();
37
38 virtual const char *
39 GetName ();
40
41 virtual const char *
42 GetQueueName ();
43
Greg Clayton08d7d3a2011-01-06 22:15:06 +000044 virtual lldb::RegisterContextSP
Chris Lattner24943d22010-06-08 16:52:24 +000045 GetRegisterContext ();
46
Greg Clayton08d7d3a2011-01-06 22:15:06 +000047 virtual lldb::RegisterContextSP
Chris Lattner24943d22010-06-08 16:52:24 +000048 CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
49
50 virtual bool
51 SaveFrameZeroState (RegisterCheckpoint &checkpoint);
52
53 virtual bool
54 RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint);
55
Chris Lattner24943d22010-06-08 16:52:24 +000056 virtual void
57 ClearStackFrames ();
58
59 ProcessGDBRemote &
60 GetGDBProcess ()
61 {
62 return (ProcessGDBRemote &)m_process;
63 }
64
65 const ProcessGDBRemote &
66 GetGDBProcess () const
67 {
68 return (ProcessGDBRemote &)m_process;
69 }
70
71 void
72 Dump (lldb_private::Log *log, uint32_t index);
73
74 static bool
75 ThreadIDIsValid (lldb::tid_t thread);
76
77 bool
78 ShouldStop (bool &step_more);
79
80 const char *
81 GetBasicInfoAsString ();
82
Chris Lattner24943d22010-06-08 16:52:24 +000083 void
Greg Clayton643ee732010-08-04 01:40:35 +000084 SetStopInfo (const lldb::StopInfoSP &stop_info)
Chris Lattner24943d22010-06-08 16:52:24 +000085 {
Greg Clayton643ee732010-08-04 01:40:35 +000086 m_actual_stop_info_sp = stop_info;
Chris Lattner24943d22010-06-08 16:52:24 +000087 }
88
89 void
90 SetName (const char *name)
91 {
92 if (name && name[0])
93 m_thread_name.assign (name);
94 else
95 m_thread_name.clear();
96 }
97
98 lldb::addr_t
99 GetThreadDispatchQAddr ()
100 {
101 return m_thread_dispatch_qaddr;
102 }
103
104 void
105 SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
106 {
107 m_thread_dispatch_qaddr = thread_dispatch_qaddr;
108 }
109
110protected:
Greg Claytona875b642011-01-09 21:07:35 +0000111
112 friend class ProcessGDBRemote;
113
114 void
115 PrivateSetRegisterValue (uint32_t reg,
116 StringExtractor &response);
117
Chris Lattner24943d22010-06-08 16:52:24 +0000118 //------------------------------------------------------------------
119 // Member variables.
120 //------------------------------------------------------------------
Chris Lattner24943d22010-06-08 16:52:24 +0000121 std::string m_thread_name;
122 std::string m_dispatch_queue_name;
123 lldb::addr_t m_thread_dispatch_qaddr;
Greg Claytona875b642011-01-09 21:07:35 +0000124 uint32_t m_thread_stop_reason_stop_id;
Chris Lattner24943d22010-06-08 16:52:24 +0000125 //------------------------------------------------------------------
126 // Member variables.
127 //------------------------------------------------------------------
128
Jim Ingham71219082010-08-12 02:14:28 +0000129 virtual lldb_private::Unwind *
Chris Lattner24943d22010-06-08 16:52:24 +0000130 GetUnwinder ();
131
132 void
133 SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id);
134
Greg Clayton643ee732010-08-04 01:40:35 +0000135 virtual lldb::StopInfoSP
136 GetPrivateStopReason ();
Chris Lattner24943d22010-06-08 16:52:24 +0000137
138
139};
140
141#endif // liblldb_ThreadGDBRemote_h_