Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 1 | //===-- LinuxThread.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_LinuxThread_H_ |
| 11 | #define liblldb_LinuxThread_H_ |
| 12 | |
| 13 | // C Includes |
| 14 | // C++ Includes |
| 15 | #include <memory> |
| 16 | |
| 17 | // Other libraries and framework includes |
| 18 | #include "lldb/Target/Thread.h" |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 19 | |
| 20 | class ProcessMonitor; |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 21 | class RegisterContextLinux; |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 22 | |
| 23 | //------------------------------------------------------------------------------ |
| 24 | // @class LinuxThread |
| 25 | // @brief Abstraction of a linux process (thread). |
| 26 | class LinuxThread |
| 27 | : public lldb_private::Thread |
| 28 | { |
| 29 | public: |
| 30 | LinuxThread(lldb_private::Process &process, lldb::tid_t tid); |
| 31 | |
Stephen Wilson | b47794a | 2011-01-16 16:56:16 +0000 | [diff] [blame] | 32 | virtual ~LinuxThread(); |
| 33 | |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 34 | void |
| 35 | RefreshStateAfterStop(); |
| 36 | |
| 37 | bool |
| 38 | WillResume(lldb::StateType resume_state); |
| 39 | |
| 40 | const char * |
| 41 | GetInfo(); |
| 42 | |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 43 | virtual lldb::RegisterContextSP |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 44 | GetRegisterContext(); |
| 45 | |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 46 | virtual bool |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 47 | SaveFrameZeroState(RegisterCheckpoint &checkpoint); |
| 48 | |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 49 | virtual bool |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 50 | RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint); |
| 51 | |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 52 | virtual lldb::RegisterContextSP |
Stephen Wilson | bc1418b | 2011-01-07 00:10:43 +0000 | [diff] [blame] | 53 | CreateRegisterContextForFrame (lldb_private::StackFrame *frame); |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 54 | |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 55 | //-------------------------------------------------------------------------- |
| 56 | // These methods form a specialized interface to linux threads. |
| 57 | // |
| 58 | bool Resume(); |
| 59 | |
| 60 | void BreakNotify(); |
| 61 | void TraceNotify(); |
| 62 | void ExitNotify(); |
| 63 | |
| 64 | private: |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 65 | |
| 66 | RegisterContextLinux * |
| 67 | GetRegisterContextLinux () |
| 68 | { |
| 69 | if (!m_reg_context_sp) |
| 70 | GetRegisterContext(); |
Stephen Wilson | bc1418b | 2011-01-07 00:10:43 +0000 | [diff] [blame] | 71 | return (RegisterContextLinux *)m_reg_context_sp.get(); |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 72 | } |
| 73 | |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 74 | std::auto_ptr<lldb_private::StackFrame> m_frame_ap; |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 75 | |
| 76 | lldb::BreakpointSiteSP m_breakpoint; |
Stephen Wilson | 140f69a | 2011-01-15 00:07:36 +0000 | [diff] [blame] | 77 | lldb::StopInfoSP m_stop_info; |
| 78 | |
| 79 | // Cached process stop id. Used to ensure we do not recalculate stop |
| 80 | // information/state needlessly. |
| 81 | uint32_t m_stop_info_id; |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 82 | |
| 83 | enum Notification { |
| 84 | eNone, |
| 85 | eBreak, |
| 86 | eTrace, |
| 87 | eExit |
| 88 | }; |
| 89 | |
| 90 | Notification m_note; |
| 91 | |
| 92 | ProcessMonitor &GetMonitor(); |
Stephen Wilson | ed56002 | 2011-01-04 21:45:02 +0000 | [diff] [blame] | 93 | |
| 94 | lldb::StopInfoSP |
| 95 | GetPrivateStopReason(); |
Stephen Wilson | d61182d | 2011-01-04 21:45:57 +0000 | [diff] [blame] | 96 | |
Stephen Wilson | 140f69a | 2011-01-15 00:07:36 +0000 | [diff] [blame] | 97 | void |
| 98 | RefreshPrivateStopReason(); |
| 99 | |
Stephen Wilson | d61182d | 2011-01-04 21:45:57 +0000 | [diff] [blame] | 100 | lldb_private::Unwind * |
| 101 | GetUnwinder(); |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 102 | }; |
| 103 | |
| 104 | #endif // #ifndef liblldb_LinuxThread_H_ |