blob: 2b7344d128a3de91f58b7b7f40af5ca05087314b [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
44 virtual lldb_private::RegisterContext *
45 GetRegisterContext ();
46
47 virtual lldb_private::RegisterContext *
48 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:
111 //------------------------------------------------------------------
112 // Member variables.
113 //------------------------------------------------------------------
Chris Lattner24943d22010-06-08 16:52:24 +0000114 std::string m_thread_name;
115 std::string m_dispatch_queue_name;
116 lldb::addr_t m_thread_dispatch_qaddr;
Chris Lattner24943d22010-06-08 16:52:24 +0000117 //------------------------------------------------------------------
118 // Member variables.
119 //------------------------------------------------------------------
120
Jim Ingham71219082010-08-12 02:14:28 +0000121 virtual lldb_private::Unwind *
Chris Lattner24943d22010-06-08 16:52:24 +0000122 GetUnwinder ();
123
124 void
125 SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id);
126
Greg Clayton643ee732010-08-04 01:40:35 +0000127 virtual lldb::StopInfoSP
128 GetPrivateStopReason ();
Chris Lattner24943d22010-06-08 16:52:24 +0000129
130
131};
132
133#endif // liblldb_ThreadGDBRemote_h_