1 //===-- NativeThreadLinux.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_NativeThreadLinux_H_
11 #define liblldb_NativeThreadLinux_H_
12 
13 #include "lldb/lldb-private-forward.h"
14 #include "../../../Host/common/NativeThreadProtocol.h"
15 
16 namespace lldb_private
17 {
18     class NativeProcessLinux;
19 
20     class NativeThreadLinux : public NativeThreadProtocol
21     {
22         friend class NativeProcessLinux;
23 
24     public:
25         NativeThreadLinux (NativeProcessLinux *process, lldb::tid_t tid);
26 
27         // ---------------------------------------------------------------------
28         // NativeThreadProtocol Interface
29         // ---------------------------------------------------------------------
30         const char *
31         GetName() override;
32 
33         lldb::StateType
34         GetState () override;
35 
36         bool
37         GetStopReason (ThreadStopInfo &stop_info) override;
38 
39         NativeRegisterContextSP
40         GetRegisterContext () override;
41 
42         Error
43         SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override;
44 
45         Error
46         RemoveWatchpoint (lldb::addr_t addr) override;
47 
48         uint32_t
49         TranslateStopInfoToGdbSignal (const ThreadStopInfo &stop_info) const override;
50 
51     private:
52         // ---------------------------------------------------------------------
53         // Interface for friend classes
54         // ---------------------------------------------------------------------
55         void
56         SetLaunching ();
57 
58         void
59         SetRunning ();
60 
61         void
62         SetStepping ();
63 
64         void
65         SetStoppedBySignal (uint32_t signo);
66 
67         void
68         SetStoppedByExec ();
69 
70         void
71         SetStoppedByBreakpoint ();
72 
73         bool
74         IsStoppedAtBreakpoint ();
75 
76         void
77         SetCrashedWithException (uint64_t exception_type, lldb::addr_t exception_addr);
78 
79         void
80         SetSuspended ();
81 
82         void
83         SetExited ();
84 
85         // ---------------------------------------------------------------------
86         // Private interface
87         // ---------------------------------------------------------------------
88         void
89         MaybeLogStateChange (lldb::StateType new_state);
90 
91         // ---------------------------------------------------------------------
92         // Member Variables
93         // ---------------------------------------------------------------------
94         lldb::StateType m_state;
95         ThreadStopInfo m_stop_info;
96         NativeRegisterContextSP m_reg_context_sp;
97     };
98 }
99 
100 #endif // #ifndef liblldb_NativeThreadLinux_H_
101