Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 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 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 20 | class ThreadKDP : public lldb_private::Thread { |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 21 | public: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 22 | ThreadKDP(lldb_private::Process &process, lldb::tid_t tid); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 23 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 24 | virtual ~ThreadKDP(); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 25 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 26 | virtual void RefreshStateAfterStop(); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 27 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 28 | virtual const char *GetName(); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 29 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 30 | virtual const char *GetQueueName(); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 31 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 32 | virtual lldb::RegisterContextSP GetRegisterContext(); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 33 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 34 | virtual lldb::RegisterContextSP |
| 35 | CreateRegisterContextForFrame(lldb_private::StackFrame *frame); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 36 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 37 | void Dump(lldb_private::Log *log, uint32_t index); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 38 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 39 | static bool ThreadIDIsValid(lldb::tid_t thread); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 40 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 41 | bool ShouldStop(bool &step_more); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 42 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 43 | const char *GetBasicInfoAsString(); |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 44 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 45 | 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 Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 51 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 52 | lldb::addr_t GetThreadDispatchQAddr() { return m_thread_dispatch_qaddr; } |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 53 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 54 | 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 Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 60 | |
| 61 | protected: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 62 | friend class ProcessKDP; |
Greg Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 63 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 64 | //------------------------------------------------------------------ |
| 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 Clayton | a63d08c | 2011-07-19 03:57:15 +0000 | [diff] [blame] | 75 | }; |
| 76 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 77 | #endif // liblldb_ThreadKDP_h_ |