1 //===-- ThreadKDP.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_ThreadKDP_h_
11 #define liblldb_ThreadKDP_h_
12 
13 #include <string>
14 
15 #include "lldb/Target/Process.h"
16 #include "lldb/Target/Thread.h"
17 
18 class ProcessKDP;
19 
20 class ThreadKDP : public lldb_private::Thread
21 {
22 public:
23     ThreadKDP (ProcessKDP &process,
24                lldb::tid_t tid);
25 
26     virtual
27     ~ThreadKDP ();
28 
29     virtual bool
30     WillResume (lldb::StateType resume_state);
31 
32     virtual void
33     RefreshStateAfterStop();
34 
35     virtual const char *
36     GetName ();
37 
38     virtual const char *
39     GetQueueName ();
40 
41     virtual lldb::RegisterContextSP
42     GetRegisterContext ();
43 
44     virtual lldb::RegisterContextSP
45     CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
46 
47     virtual void
48     ClearStackFrames ();
49 
50     ProcessKDP &
51     GetKDPProcess ()
52     {
53         return (ProcessKDP &)m_process;
54     }
55 
56     void
57     Dump (lldb_private::Log *log, uint32_t index);
58 
59     static bool
60     ThreadIDIsValid (lldb::tid_t thread);
61 
62     bool
63     ShouldStop (bool &step_more);
64 
65     const char *
66     GetBasicInfoAsString ();
67 
68     void
69     SetName (const char *name)
70     {
71         if (name && name[0])
72             m_thread_name.assign (name);
73         else
74             m_thread_name.clear();
75     }
76 
77     lldb::addr_t
78     GetThreadDispatchQAddr ()
79     {
80         return m_thread_dispatch_qaddr;
81     }
82 
83     void
84     SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
85     {
86         m_thread_dispatch_qaddr = thread_dispatch_qaddr;
87     }
88 
89 protected:
90 
91     friend class ProcessKDP;
92 
93     //------------------------------------------------------------------
94     // Member variables.
95     //------------------------------------------------------------------
96     std::string m_thread_name;
97     std::string m_dispatch_queue_name;
98     lldb::addr_t m_thread_dispatch_qaddr;
99     //------------------------------------------------------------------
100     // Member variables.
101     //------------------------------------------------------------------
102 
103     virtual lldb::StopInfoSP
104     GetPrivateStopReason ();
105 
106 
107 };
108 
109 #endif  // liblldb_ThreadKDP_h_
110