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 | |
| 32 | void |
| 33 | RefreshStateAfterStop(); |
| 34 | |
| 35 | bool |
| 36 | WillResume(lldb::StateType resume_state); |
| 37 | |
| 38 | const char * |
| 39 | GetInfo(); |
| 40 | |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 41 | virtual lldb::RegisterContextSP |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 42 | GetRegisterContext(); |
| 43 | |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 44 | virtual bool |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 45 | SaveFrameZeroState(RegisterCheckpoint &checkpoint); |
| 46 | |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 47 | virtual bool |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 48 | RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint); |
| 49 | |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 50 | virtual lldb::RegisterContextSP |
Stephen Wilson | bc1418b | 2011-01-07 00:10:43 +0000 | [diff] [blame^] | 51 | CreateRegisterContextForFrame (lldb_private::StackFrame *frame); |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 52 | |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 53 | //-------------------------------------------------------------------------- |
| 54 | // These methods form a specialized interface to linux threads. |
| 55 | // |
| 56 | bool Resume(); |
| 57 | |
| 58 | void BreakNotify(); |
| 59 | void TraceNotify(); |
| 60 | void ExitNotify(); |
| 61 | |
| 62 | private: |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 63 | |
| 64 | RegisterContextLinux * |
| 65 | GetRegisterContextLinux () |
| 66 | { |
| 67 | if (!m_reg_context_sp) |
| 68 | GetRegisterContext(); |
Stephen Wilson | bc1418b | 2011-01-07 00:10:43 +0000 | [diff] [blame^] | 69 | return (RegisterContextLinux *)m_reg_context_sp.get(); |
Greg Clayton | 90ccf88 | 2011-01-06 22:35:55 +0000 | [diff] [blame] | 70 | } |
| 71 | |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 72 | std::auto_ptr<lldb_private::StackFrame> m_frame_ap; |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 73 | |
| 74 | lldb::BreakpointSiteSP m_breakpoint; |
| 75 | |
| 76 | enum Notification { |
| 77 | eNone, |
| 78 | eBreak, |
| 79 | eTrace, |
| 80 | eExit |
| 81 | }; |
| 82 | |
| 83 | Notification m_note; |
| 84 | |
| 85 | ProcessMonitor &GetMonitor(); |
Stephen Wilson | ed56002 | 2011-01-04 21:45:02 +0000 | [diff] [blame] | 86 | |
| 87 | lldb::StopInfoSP |
| 88 | GetPrivateStopReason(); |
Stephen Wilson | d61182d | 2011-01-04 21:45:57 +0000 | [diff] [blame] | 89 | |
| 90 | lldb_private::Unwind * |
| 91 | GetUnwinder(); |
Stephen Wilson | f6f4033 | 2010-07-24 02:19:04 +0000 | [diff] [blame] | 92 | }; |
| 93 | |
| 94 | #endif // #ifndef liblldb_LinuxThread_H_ |