blob: 7dc373f0355056ca7ef3a53a723f60320dc3b71a [file] [log] [blame]
Greg Claytona63d08c2011-07-19 03:57:15 +00001//===-- 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
18class ProcessKDP;
19
20class ThreadKDP : public lldb_private::Thread
21{
22public:
Jim Ingham4f465cf2012-10-10 18:32:14 +000023 ThreadKDP (lldb_private::Process &process,
Greg Claytona63d08c2011-07-19 03:57:15 +000024 lldb::tid_t tid);
25
26 virtual
27 ~ThreadKDP ();
28
Greg Claytona63d08c2011-07-19 03:57:15 +000029 virtual void
30 RefreshStateAfterStop();
31
32 virtual const char *
Greg Claytona63d08c2011-07-19 03:57:15 +000033 GetName ();
34
35 virtual const char *
36 GetQueueName ();
37
38 virtual lldb::RegisterContextSP
39 GetRegisterContext ();
40
41 virtual lldb::RegisterContextSP
Jason Molendab57e4a12013-11-04 09:33:30 +000042 CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
Greg Claytona63d08c2011-07-19 03:57:15 +000043
Greg Claytona63d08c2011-07-19 03:57:15 +000044 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
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
66 GetThreadDispatchQAddr ()
67 {
68 return m_thread_dispatch_qaddr;
69 }
70
71 void
72 SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
73 {
74 m_thread_dispatch_qaddr = thread_dispatch_qaddr;
75 }
Greg Clayton97d5cf02012-09-25 02:40:06 +000076
77 void
78 SetStopInfoFrom_KDP_EXCEPTION (const lldb_private::DataExtractor &exc_reply_packet);
Greg Claytona63d08c2011-07-19 03:57:15 +000079
80protected:
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;
Greg Clayton97d5cf02012-09-25 02:40:06 +000090 lldb::StopInfoSP m_cached_stop_info_sp;
Greg Claytona63d08c2011-07-19 03:57:15 +000091 //------------------------------------------------------------------
Greg Clayton6e0ff1a2013-05-09 01:55:29 +000092 // Protected member functions.
Greg Claytona63d08c2011-07-19 03:57:15 +000093 //------------------------------------------------------------------
Greg Clayton6e0ff1a2013-05-09 01:55:29 +000094 virtual bool
95 CalculateStopInfo ();
Greg Claytona63d08c2011-07-19 03:57:15 +000096};
97
98#endif // liblldb_ThreadKDP_h_