blob: e7d23b840f96615e096cc28404e5a0181fddc8ff [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
57private:
Greg Clayton90ccf882011-01-06 22:35:55 +000058 RegisterContextLinux *
59 GetRegisterContextLinux ()
60 {
61 if (!m_reg_context_sp)
62 GetRegisterContext();
Stephen Wilsonbc1418b2011-01-07 00:10:43 +000063 return (RegisterContextLinux *)m_reg_context_sp.get();
Greg Clayton90ccf882011-01-06 22:35:55 +000064 }
65
Stephen Wilsonf6f40332010-07-24 02:19:04 +000066 std::auto_ptr<lldb_private::StackFrame> m_frame_ap;
Stephen Wilsonf6f40332010-07-24 02:19:04 +000067
68 lldb::BreakpointSiteSP m_breakpoint;
Stephen Wilson140f69a2011-01-15 00:07:36 +000069 lldb::StopInfoSP m_stop_info;
70
Stephen Wilson67d9f7e2011-03-30 15:55:52 +000071 ProcessMonitor &
72 GetMonitor();
Stephen Wilsoned560022011-01-04 21:45:02 +000073
74 lldb::StopInfoSP
75 GetPrivateStopReason();
Stephen Wilsond61182d2011-01-04 21:45:57 +000076
Stephen Wilson67d9f7e2011-03-30 15:55:52 +000077 void BreakNotify(const ProcessMessage &message);
78 void TraceNotify(const ProcessMessage &message);
79 void LimboNotify(const ProcessMessage &message);
80 void SignalNotify(const ProcessMessage &message);
81 void SignalDeliveredNotify(const ProcessMessage &message);
82 void CrashNotify(const ProcessMessage &message);
Stephen Wilson140f69a2011-01-15 00:07:36 +000083
Stephen Wilsond61182d2011-01-04 21:45:57 +000084 lldb_private::Unwind *
85 GetUnwinder();
Stephen Wilsonf6f40332010-07-24 02:19:04 +000086};
87
88#endif // #ifndef liblldb_LinuxThread_H_