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         SetStoppedByBreakpoint ();
69 
70         bool
71         IsStoppedAtBreakpoint ();
72 
73         void
74         SetCrashedWithException (uint64_t exception_type, lldb::addr_t exception_addr);
75 
76         void
77         SetSuspended ();
78 
79         void
80         SetExited ();
81 
82         // ---------------------------------------------------------------------
83         // Private interface
84         // ---------------------------------------------------------------------
85         void
86         MaybeLogStateChange (lldb::StateType new_state);
87 
88         // ---------------------------------------------------------------------
89         // Member Variables
90         // ---------------------------------------------------------------------
91         lldb::StateType m_state;
92         ThreadStopInfo m_stop_info;
93         NativeRegisterContextSP m_reg_context_sp;
94     };
95 }
96 
97 #endif // #ifndef liblldb_NativeThreadLinux_H_
98