blob: cafc83a7c8752e4213bbc37d587153f5c1c525dc [file] [log] [blame]
Stephen Wilsonf6f40332010-07-24 02:19:04 +00001//===-- 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 Wilsonf6f40332010-07-24 02:19:04 +000019
Stephen Wilson67d9f7e2011-03-30 15:55:52 +000020class ProcessMessage;
Stephen Wilsonf6f40332010-07-24 02:19:04 +000021class ProcessMonitor;
Greg Clayton90ccf882011-01-06 22:35:55 +000022class RegisterContextLinux;
Stephen Wilsonf6f40332010-07-24 02:19:04 +000023
24//------------------------------------------------------------------------------
25// @class LinuxThread
26// @brief Abstraction of a linux process (thread).
27class LinuxThread
28 : public lldb_private::Thread
29{
30public:
31 LinuxThread(lldb_private::Process &process, lldb::tid_t tid);
32
Stephen Wilsonb47794a2011-01-16 16:56:16 +000033 virtual ~LinuxThread();
34
Stephen Wilsonf6f40332010-07-24 02:19:04 +000035 void
36 RefreshStateAfterStop();
37
38 bool
39 WillResume(lldb::StateType resume_state);
40
41 const char *
42 GetInfo();
43
Greg Clayton90ccf882011-01-06 22:35:55 +000044 virtual lldb::RegisterContextSP
Stephen Wilsonf6f40332010-07-24 02:19:04 +000045 GetRegisterContext();
46
Greg Clayton90ccf882011-01-06 22:35:55 +000047 virtual lldb::RegisterContextSP
Stephen Wilsonbc1418b2011-01-07 00:10:43 +000048 CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
Stephen Wilsonf6f40332010-07-24 02:19:04 +000049
Stephen Wilsonf6f40332010-07-24 02:19:04 +000050 //--------------------------------------------------------------------------
51 // These methods form a specialized interface to linux threads.
52 //
53 bool Resume();
54
Stephen Wilson67d9f7e2011-03-30 15:55:52 +000055 void Notify(const ProcessMessage &message);
Stephen Wilsonf6f40332010-07-24 02:19:04 +000056
Jim Ingham15dcb7c2011-01-20 02:03:18 +000057protected:
58 virtual bool
59 SaveFrameZeroState(RegisterCheckpoint &checkpoint);
60
61 virtual bool
62 RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint);
63
Stephen Wilsonf6f40332010-07-24 02:19:04 +000064private:
Greg Clayton90ccf882011-01-06 22:35:55 +000065 RegisterContextLinux *
66 GetRegisterContextLinux ()
67 {
68 if (!m_reg_context_sp)
69 GetRegisterContext();
Stephen Wilsonbc1418b2011-01-07 00:10:43 +000070 return (RegisterContextLinux *)m_reg_context_sp.get();
Greg Clayton90ccf882011-01-06 22:35:55 +000071 }
72
Stephen Wilsonf6f40332010-07-24 02:19:04 +000073 std::auto_ptr<lldb_private::StackFrame> m_frame_ap;
Stephen Wilsonf6f40332010-07-24 02:19:04 +000074
75 lldb::BreakpointSiteSP m_breakpoint;
Stephen Wilson140f69a2011-01-15 00:07:36 +000076 lldb::StopInfoSP m_stop_info;
77
Stephen Wilson67d9f7e2011-03-30 15:55:52 +000078 ProcessMonitor &
79 GetMonitor();
Stephen Wilsoned560022011-01-04 21:45:02 +000080
81 lldb::StopInfoSP
82 GetPrivateStopReason();
Stephen Wilsond61182d2011-01-04 21:45:57 +000083
Stephen Wilson67d9f7e2011-03-30 15:55:52 +000084 void BreakNotify(const ProcessMessage &message);
85 void TraceNotify(const ProcessMessage &message);
86 void LimboNotify(const ProcessMessage &message);
87 void SignalNotify(const ProcessMessage &message);
88 void SignalDeliveredNotify(const ProcessMessage &message);
89 void CrashNotify(const ProcessMessage &message);
Stephen Wilson140f69a2011-01-15 00:07:36 +000090
Stephen Wilsond61182d2011-01-04 21:45:57 +000091 lldb_private::Unwind *
92 GetUnwinder();
Stephen Wilsonf6f40332010-07-24 02:19:04 +000093};
94
95#endif // #ifndef liblldb_LinuxThread_H_