1af245d11STodd Fiala //===-- NativeThreadLinux.h ----------------------------------- -*- C++ -*-===//
2af245d11STodd Fiala //
3af245d11STodd Fiala //                     The LLVM Compiler Infrastructure
4af245d11STodd Fiala //
5af245d11STodd Fiala // This file is distributed under the University of Illinois Open Source
6af245d11STodd Fiala // License. See LICENSE.TXT for details.
7af245d11STodd Fiala //
8af245d11STodd Fiala //===----------------------------------------------------------------------===//
9af245d11STodd Fiala 
10af245d11STodd Fiala #ifndef liblldb_NativeThreadLinux_H_
11af245d11STodd Fiala #define liblldb_NativeThreadLinux_H_
12af245d11STodd Fiala 
13af245d11STodd Fiala #include "lldb/lldb-private-forward.h"
14af245d11STodd Fiala #include "../../../Host/common/NativeThreadProtocol.h"
15af245d11STodd Fiala 
16af245d11STodd Fiala namespace lldb_private
17af245d11STodd Fiala {
18af245d11STodd Fiala     class NativeProcessLinux;
19af245d11STodd Fiala 
20af245d11STodd Fiala     class NativeThreadLinux : public NativeThreadProtocol
21af245d11STodd Fiala     {
22af245d11STodd Fiala         friend class NativeProcessLinux;
23af245d11STodd Fiala 
24af245d11STodd Fiala     public:
25af245d11STodd Fiala         NativeThreadLinux (NativeProcessLinux *process, lldb::tid_t tid);
26af245d11STodd Fiala 
27af245d11STodd Fiala         // ---------------------------------------------------------------------
28af245d11STodd Fiala         // NativeThreadProtocol Interface
29af245d11STodd Fiala         // ---------------------------------------------------------------------
30af245d11STodd Fiala         const char *
31af245d11STodd Fiala         GetName() override;
32af245d11STodd Fiala 
33af245d11STodd Fiala         lldb::StateType
34af245d11STodd Fiala         GetState () override;
35af245d11STodd Fiala 
36af245d11STodd Fiala         bool
37af245d11STodd Fiala         GetStopReason (ThreadStopInfo &stop_info) override;
38af245d11STodd Fiala 
39af245d11STodd Fiala         NativeRegisterContextSP
40af245d11STodd Fiala         GetRegisterContext () override;
41af245d11STodd Fiala 
42af245d11STodd Fiala         Error
43af245d11STodd Fiala         SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override;
44af245d11STodd Fiala 
45af245d11STodd Fiala         Error
46af245d11STodd Fiala         RemoveWatchpoint (lldb::addr_t addr) override;
47af245d11STodd Fiala 
48af245d11STodd Fiala         uint32_t
49af245d11STodd Fiala         TranslateStopInfoToGdbSignal (const ThreadStopInfo &stop_info) const override;
50af245d11STodd Fiala 
51af245d11STodd Fiala     private:
52af245d11STodd Fiala         // ---------------------------------------------------------------------
53af245d11STodd Fiala         // Interface for friend classes
54af245d11STodd Fiala         // ---------------------------------------------------------------------
55af245d11STodd Fiala         void
56af245d11STodd Fiala         SetLaunching ();
57af245d11STodd Fiala 
58af245d11STodd Fiala         void
59af245d11STodd Fiala         SetRunning ();
60af245d11STodd Fiala 
61af245d11STodd Fiala         void
62af245d11STodd Fiala         SetStepping ();
63af245d11STodd Fiala 
64af245d11STodd Fiala         void
65af245d11STodd Fiala         SetStoppedBySignal (uint32_t signo);
66af245d11STodd Fiala 
67*511e5cdcSTodd Fiala         /// Return true if the thread is stopped.
68*511e5cdcSTodd Fiala         /// If stopped by a signal, indicate the signo in the signo argument.
69*511e5cdcSTodd Fiala         /// Otherwise, return LLDB_INVALID_SIGNAL_NUMBER.
70*511e5cdcSTodd Fiala         bool
71*511e5cdcSTodd Fiala         IsStopped (int *signo);
72*511e5cdcSTodd Fiala 
73af245d11STodd Fiala         void
74a9882ceeSTodd Fiala         SetStoppedByExec ();
75a9882ceeSTodd Fiala 
76a9882ceeSTodd Fiala         void
77af245d11STodd Fiala         SetStoppedByBreakpoint ();
78af245d11STodd Fiala 
79af245d11STodd Fiala         bool
80af245d11STodd Fiala         IsStoppedAtBreakpoint ();
81af245d11STodd Fiala 
82af245d11STodd Fiala         void
83af245d11STodd Fiala         SetCrashedWithException (uint64_t exception_type, lldb::addr_t exception_addr);
84af245d11STodd Fiala 
85af245d11STodd Fiala         void
86af245d11STodd Fiala         SetSuspended ();
87af245d11STodd Fiala 
88af245d11STodd Fiala         void
89af245d11STodd Fiala         SetExited ();
90af245d11STodd Fiala 
91af245d11STodd Fiala         // ---------------------------------------------------------------------
92af245d11STodd Fiala         // Private interface
93af245d11STodd Fiala         // ---------------------------------------------------------------------
94af245d11STodd Fiala         void
95af245d11STodd Fiala         MaybeLogStateChange (lldb::StateType new_state);
96af245d11STodd Fiala 
97af245d11STodd Fiala         // ---------------------------------------------------------------------
98af245d11STodd Fiala         // Member Variables
99af245d11STodd Fiala         // ---------------------------------------------------------------------
100af245d11STodd Fiala         lldb::StateType m_state;
101af245d11STodd Fiala         ThreadStopInfo m_stop_info;
102af245d11STodd Fiala         NativeRegisterContextSP m_reg_context_sp;
103af245d11STodd Fiala     };
104af245d11STodd Fiala }
105af245d11STodd Fiala 
106af245d11STodd Fiala #endif // #ifndef liblldb_NativeThreadLinux_H_
107