Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- ThreadGDBRemote.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_ThreadGDBRemote_h_ |
| 11 | #define liblldb_ThreadGDBRemote_h_ |
| 12 | |
| 13 | #include <string> |
| 14 | |
| 15 | #include "lldb/Target/Process.h" |
| 16 | #include "lldb/Target/Thread.h" |
Greg Clayton | 54e7afa | 2010-07-09 20:39:50 +0000 | [diff] [blame^] | 17 | #include "libunwind/include/libunwind.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 18 | |
| 19 | class StringExtractor; |
| 20 | class ProcessGDBRemote; |
| 21 | |
| 22 | class ThreadGDBRemote : public lldb_private::Thread |
| 23 | { |
| 24 | public: |
| 25 | ThreadGDBRemote (ProcessGDBRemote &process, lldb::tid_t tid); |
| 26 | |
| 27 | virtual |
| 28 | ~ThreadGDBRemote (); |
| 29 | |
| 30 | virtual bool |
| 31 | WillResume (lldb::StateType resume_state); |
| 32 | |
| 33 | virtual void |
| 34 | RefreshStateAfterStop(); |
| 35 | |
| 36 | virtual const char * |
| 37 | GetInfo (); |
| 38 | |
| 39 | virtual const char * |
| 40 | GetName (); |
| 41 | |
| 42 | virtual const char * |
| 43 | GetQueueName (); |
| 44 | |
| 45 | virtual lldb_private::RegisterContext * |
| 46 | GetRegisterContext (); |
| 47 | |
| 48 | virtual lldb_private::RegisterContext * |
| 49 | CreateRegisterContextForFrame (lldb_private::StackFrame *frame); |
| 50 | |
| 51 | virtual bool |
| 52 | SaveFrameZeroState (RegisterCheckpoint &checkpoint); |
| 53 | |
| 54 | virtual bool |
| 55 | RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint); |
| 56 | |
| 57 | virtual uint32_t |
| 58 | GetStackFrameCount(); |
| 59 | |
| 60 | virtual lldb::StackFrameSP |
| 61 | GetStackFrameAtIndex (uint32_t idx); |
| 62 | |
| 63 | virtual void |
| 64 | ClearStackFrames (); |
| 65 | |
| 66 | ProcessGDBRemote & |
| 67 | GetGDBProcess () |
| 68 | { |
| 69 | return (ProcessGDBRemote &)m_process; |
| 70 | } |
| 71 | |
| 72 | const ProcessGDBRemote & |
| 73 | GetGDBProcess () const |
| 74 | { |
| 75 | return (ProcessGDBRemote &)m_process; |
| 76 | } |
| 77 | |
| 78 | void |
| 79 | Dump (lldb_private::Log *log, uint32_t index); |
| 80 | |
| 81 | static bool |
| 82 | ThreadIDIsValid (lldb::tid_t thread); |
| 83 | |
| 84 | bool |
| 85 | ShouldStop (bool &step_more); |
| 86 | |
| 87 | const char * |
| 88 | GetBasicInfoAsString (); |
| 89 | |
| 90 | lldb_private::Thread::StopInfo & |
| 91 | GetStopInfoRef () |
| 92 | { |
| 93 | return m_stop_info; |
| 94 | } |
| 95 | |
| 96 | uint32_t |
| 97 | GetStopInfoStopID() |
| 98 | { |
| 99 | return m_stop_info_stop_id; |
| 100 | } |
| 101 | |
| 102 | void |
| 103 | SetStopInfoStopID (uint32_t stop_id) |
| 104 | { |
| 105 | m_stop_info_stop_id = stop_id; |
| 106 | } |
| 107 | |
| 108 | void |
| 109 | SetName (const char *name) |
| 110 | { |
| 111 | if (name && name[0]) |
| 112 | m_thread_name.assign (name); |
| 113 | else |
| 114 | m_thread_name.clear(); |
| 115 | } |
| 116 | |
| 117 | lldb::addr_t |
| 118 | GetThreadDispatchQAddr () |
| 119 | { |
| 120 | return m_thread_dispatch_qaddr; |
| 121 | } |
| 122 | |
| 123 | void |
| 124 | SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr) |
| 125 | { |
| 126 | m_thread_dispatch_qaddr = thread_dispatch_qaddr; |
| 127 | } |
| 128 | |
| 129 | protected: |
| 130 | //------------------------------------------------------------------ |
| 131 | // Member variables. |
| 132 | //------------------------------------------------------------------ |
| 133 | uint32_t m_stop_info_stop_id; |
| 134 | lldb_private::Thread::StopInfo m_stop_info; |
| 135 | std::string m_thread_name; |
| 136 | std::string m_dispatch_queue_name; |
| 137 | lldb::addr_t m_thread_dispatch_qaddr; |
| 138 | std::auto_ptr<lldb_private::Unwind> m_unwinder_ap; |
| 139 | //------------------------------------------------------------------ |
| 140 | // Member variables. |
| 141 | //------------------------------------------------------------------ |
| 142 | |
| 143 | lldb_private::Unwind * |
| 144 | GetUnwinder (); |
| 145 | |
| 146 | void |
| 147 | SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id); |
| 148 | |
| 149 | virtual bool |
| 150 | GetRawStopReason (StopInfo *stop_info); |
| 151 | |
| 152 | |
| 153 | }; |
| 154 | |
| 155 | #endif // liblldb_ThreadGDBRemote_h_ |