blob: ea517b4254fc99f845eb21862be3ea8364bd17a9 [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
Kate Stoneb9c1b512016-09-06 20:57:50 +000020class ThreadKDP : public lldb_private::Thread {
Greg Claytona63d08c2011-07-19 03:57:15 +000021public:
Kate Stoneb9c1b512016-09-06 20:57:50 +000022 ThreadKDP(lldb_private::Process &process, lldb::tid_t tid);
Greg Claytona63d08c2011-07-19 03:57:15 +000023
Kate Stoneb9c1b512016-09-06 20:57:50 +000024 virtual ~ThreadKDP();
Greg Claytona63d08c2011-07-19 03:57:15 +000025
Kate Stoneb9c1b512016-09-06 20:57:50 +000026 virtual void RefreshStateAfterStop();
Greg Claytona63d08c2011-07-19 03:57:15 +000027
Kate Stoneb9c1b512016-09-06 20:57:50 +000028 virtual const char *GetName();
Greg Claytona63d08c2011-07-19 03:57:15 +000029
Kate Stoneb9c1b512016-09-06 20:57:50 +000030 virtual const char *GetQueueName();
Greg Claytona63d08c2011-07-19 03:57:15 +000031
Kate Stoneb9c1b512016-09-06 20:57:50 +000032 virtual lldb::RegisterContextSP GetRegisterContext();
Greg Claytona63d08c2011-07-19 03:57:15 +000033
Kate Stoneb9c1b512016-09-06 20:57:50 +000034 virtual lldb::RegisterContextSP
35 CreateRegisterContextForFrame(lldb_private::StackFrame *frame);
Greg Claytona63d08c2011-07-19 03:57:15 +000036
Kate Stoneb9c1b512016-09-06 20:57:50 +000037 void Dump(lldb_private::Log *log, uint32_t index);
Greg Claytona63d08c2011-07-19 03:57:15 +000038
Kate Stoneb9c1b512016-09-06 20:57:50 +000039 static bool ThreadIDIsValid(lldb::tid_t thread);
Greg Claytona63d08c2011-07-19 03:57:15 +000040
Kate Stoneb9c1b512016-09-06 20:57:50 +000041 bool ShouldStop(bool &step_more);
Greg Claytona63d08c2011-07-19 03:57:15 +000042
Kate Stoneb9c1b512016-09-06 20:57:50 +000043 const char *GetBasicInfoAsString();
Greg Claytona63d08c2011-07-19 03:57:15 +000044
Kate Stoneb9c1b512016-09-06 20:57:50 +000045 void SetName(const char *name) {
46 if (name && name[0])
47 m_thread_name.assign(name);
48 else
49 m_thread_name.clear();
50 }
Greg Claytona63d08c2011-07-19 03:57:15 +000051
Kate Stoneb9c1b512016-09-06 20:57:50 +000052 lldb::addr_t GetThreadDispatchQAddr() { return m_thread_dispatch_qaddr; }
Greg Claytona63d08c2011-07-19 03:57:15 +000053
Kate Stoneb9c1b512016-09-06 20:57:50 +000054 void SetThreadDispatchQAddr(lldb::addr_t thread_dispatch_qaddr) {
55 m_thread_dispatch_qaddr = thread_dispatch_qaddr;
56 }
57
58 void SetStopInfoFrom_KDP_EXCEPTION(
59 const lldb_private::DataExtractor &exc_reply_packet);
Greg Claytona63d08c2011-07-19 03:57:15 +000060
61protected:
Kate Stoneb9c1b512016-09-06 20:57:50 +000062 friend class ProcessKDP;
Greg Claytona63d08c2011-07-19 03:57:15 +000063
Kate Stoneb9c1b512016-09-06 20:57:50 +000064 //------------------------------------------------------------------
65 // Member variables.
66 //------------------------------------------------------------------
67 std::string m_thread_name;
68 std::string m_dispatch_queue_name;
69 lldb::addr_t m_thread_dispatch_qaddr;
70 lldb::StopInfoSP m_cached_stop_info_sp;
71 //------------------------------------------------------------------
72 // Protected member functions.
73 //------------------------------------------------------------------
74 virtual bool CalculateStopInfo();
Greg Claytona63d08c2011-07-19 03:57:15 +000075};
76
Kate Stoneb9c1b512016-09-06 20:57:50 +000077#endif // liblldb_ThreadKDP_h_