blob: a6deead8f15779d963e39017be73a815c6106281 [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"
Greg Clayton54e7afa2010-07-09 20:39:50 +000017#include "libunwind/include/libunwind.h"
Chris Lattner24943d22010-06-08 16:52:24 +000018
19class StringExtractor;
20class ProcessGDBRemote;
21
22class ThreadGDBRemote : public lldb_private::Thread
23{
24public:
25 ThreadGDBRemote (ProcessGDBRemote &process, lldb::tid_t tid);
26
27 virtual
28 ~ThreadGDBRemote ();
29
30 virtual bool
31 WillResume (lldb::StateType resume_state);
32
33 virtual void
34 RefreshStateAfterStop();
35
36 virtual const char *
37 GetInfo ();
38
39 virtual const char *
40 GetName ();
41
42 virtual const char *
43 GetQueueName ();
44
45 virtual lldb_private::RegisterContext *
46 GetRegisterContext ();
47
48 virtual lldb_private::RegisterContext *
49 CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
50
51 virtual bool
52 SaveFrameZeroState (RegisterCheckpoint &checkpoint);
53
54 virtual bool
55 RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint);
56
Chris Lattner24943d22010-06-08 16:52:24 +000057 virtual void
58 ClearStackFrames ();
59
60 ProcessGDBRemote &
61 GetGDBProcess ()
62 {
63 return (ProcessGDBRemote &)m_process;
64 }
65
66 const ProcessGDBRemote &
67 GetGDBProcess () const
68 {
69 return (ProcessGDBRemote &)m_process;
70 }
71
72 void
73 Dump (lldb_private::Log *log, uint32_t index);
74
75 static bool
76 ThreadIDIsValid (lldb::tid_t thread);
77
78 bool
79 ShouldStop (bool &step_more);
80
81 const char *
82 GetBasicInfoAsString ();
83
Chris Lattner24943d22010-06-08 16:52:24 +000084 void
Greg Clayton643ee732010-08-04 01:40:35 +000085 SetStopInfo (const lldb::StopInfoSP &stop_info)
Chris Lattner24943d22010-06-08 16:52:24 +000086 {
Greg Clayton643ee732010-08-04 01:40:35 +000087 m_actual_stop_info_sp = stop_info;
Chris Lattner24943d22010-06-08 16:52:24 +000088 }
89
90 void
91 SetName (const char *name)
92 {
93 if (name && name[0])
94 m_thread_name.assign (name);
95 else
96 m_thread_name.clear();
97 }
98
99 lldb::addr_t
100 GetThreadDispatchQAddr ()
101 {
102 return m_thread_dispatch_qaddr;
103 }
104
105 void
106 SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
107 {
108 m_thread_dispatch_qaddr = thread_dispatch_qaddr;
109 }
110
111protected:
112 //------------------------------------------------------------------
113 // Member variables.
114 //------------------------------------------------------------------
Chris Lattner24943d22010-06-08 16:52:24 +0000115 std::string m_thread_name;
116 std::string m_dispatch_queue_name;
117 lldb::addr_t m_thread_dispatch_qaddr;
Chris Lattner24943d22010-06-08 16:52:24 +0000118 //------------------------------------------------------------------
119 // Member variables.
120 //------------------------------------------------------------------
121
Jim Ingham71219082010-08-12 02:14:28 +0000122 virtual lldb_private::Unwind *
Chris Lattner24943d22010-06-08 16:52:24 +0000123 GetUnwinder ();
124
125 void
126 SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id);
127
Greg Clayton643ee732010-08-04 01:40:35 +0000128 virtual lldb::StopInfoSP
129 GetPrivateStopReason ();
Chris Lattner24943d22010-06-08 16:52:24 +0000130
131
132};
133
134#endif // liblldb_ThreadGDBRemote_h_