• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 (lldb_private::Process &process,
24                lldb::tid_t tid);
25 
26     virtual
27     ~ThreadKDP ();
28 
29     virtual void
30     RefreshStateAfterStop();
31 
32     virtual const char *
33     GetName ();
34 
35     virtual const char *
36     GetQueueName ();
37 
38     virtual lldb::RegisterContextSP
39     GetRegisterContext ();
40 
41     virtual lldb::RegisterContextSP
42     CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
43 
44     void
45     Dump (lldb_private::Log *log, uint32_t index);
46 
47     static bool
48     ThreadIDIsValid (lldb::tid_t thread);
49 
50     bool
51     ShouldStop (bool &step_more);
52 
53     const char *
54     GetBasicInfoAsString ();
55 
56     void
SetName(const char * name)57     SetName (const char *name)
58     {
59         if (name && name[0])
60             m_thread_name.assign (name);
61         else
62             m_thread_name.clear();
63     }
64 
65     lldb::addr_t
GetThreadDispatchQAddr()66     GetThreadDispatchQAddr ()
67     {
68         return m_thread_dispatch_qaddr;
69     }
70 
71     void
SetThreadDispatchQAddr(lldb::addr_t thread_dispatch_qaddr)72     SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
73     {
74         m_thread_dispatch_qaddr = thread_dispatch_qaddr;
75     }
76 
77     void
78     SetStopInfoFrom_KDP_EXCEPTION (const lldb_private::DataExtractor &exc_reply_packet);
79 
80 protected:
81 
82     friend class ProcessKDP;
83 
84     //------------------------------------------------------------------
85     // Member variables.
86     //------------------------------------------------------------------
87     std::string m_thread_name;
88     std::string m_dispatch_queue_name;
89     lldb::addr_t m_thread_dispatch_qaddr;
90     lldb::StopInfoSP m_cached_stop_info_sp;
91     //------------------------------------------------------------------
92     // Protected member functions.
93     //------------------------------------------------------------------
94     virtual bool
95     CalculateStopInfo ();
96 };
97 
98 #endif  // liblldb_ThreadKDP_h_
99