1 //===-- ThreadMachCore.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_ThreadMachCore_h_
11 #define liblldb_ThreadMachCore_h_
12 
13 #include <string>
14 
15 #include "lldb/Target/Thread.h"
16 
17 class ProcessMachCore;
18 
19 class ThreadMachCore : public lldb_private::Thread
20 {
21 public:
22     ThreadMachCore (const lldb::ProcessSP &process_sp,
23                     lldb::tid_t tid);
24 
25     virtual
26     ~ThreadMachCore ();
27 
28     virtual void
29     RefreshStateAfterStop();
30 
31     virtual const char *
32     GetName ();
33 
34     virtual lldb::RegisterContextSP
35     GetRegisterContext ();
36 
37     virtual lldb::RegisterContextSP
38     CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
39 
40     virtual void
41     ClearStackFrames ();
42 
43     static bool
44     ThreadIDIsValid (lldb::tid_t thread);
45 
46     bool
47     ShouldStop (bool &step_more);
48 
49     const char *
50     GetBasicInfoAsString ();
51 
52     void
53     SetName (const char *name)
54     {
55         if (name && name[0])
56             m_thread_name.assign (name);
57         else
58             m_thread_name.clear();
59     }
60 
61     lldb::addr_t
62     GetThreadDispatchQAddr ()
63     {
64         return m_thread_dispatch_qaddr;
65     }
66 
67     void
68     SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
69     {
70         m_thread_dispatch_qaddr = thread_dispatch_qaddr;
71     }
72 
73 protected:
74 
75     friend class ProcessMachCore;
76 
77     //------------------------------------------------------------------
78     // Member variables.
79     //------------------------------------------------------------------
80     std::string m_thread_name;
81     std::string m_dispatch_queue_name;
82     lldb::addr_t m_thread_dispatch_qaddr;
83     lldb::RegisterContextSP m_thread_reg_ctx_sp;
84     //------------------------------------------------------------------
85     // Member variables.
86     //------------------------------------------------------------------
87 
88     virtual lldb::StopInfoSP
89     GetPrivateStopReason ();
90 };
91 
92 #endif  // liblldb_ThreadMachCore_h_
93