]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.h
Merge ^/head r295601 through r295844.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Process / FreeBSD / FreeBSDThread.h
1 //===-- FreeBSDThread.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_FreeBSDThread_H_
11 #define liblldb_FreeBSDThread_H_
12
13 // C++ Includes
14 #include <memory>
15 #include <string>
16
17 // Other libraries and framework includes
18 #include "lldb/Target/Thread.h"
19 #include "RegisterContextPOSIX.h"
20
21 class ProcessMessage;
22 class ProcessMonitor;
23 class POSIXBreakpointProtocol;
24
25 //------------------------------------------------------------------------------
26 // @class FreeBSDThread
27 // @brief Abstraction of a FreeBSD thread.
28 class FreeBSDThread
29     : public lldb_private::Thread
30 {
31 public:
32
33     //------------------------------------------------------------------
34     // Constructors and destructors
35     //------------------------------------------------------------------
36     FreeBSDThread(lldb_private::Process &process, lldb::tid_t tid);
37
38     virtual ~FreeBSDThread();
39
40     // POSIXThread
41     void
42     RefreshStateAfterStop() override;
43
44     // This notifies the thread when a private stop occurs.
45     void
46     DidStop () override;
47
48     const char *
49     GetInfo() override;
50
51     void
52     SetName (const char *name) override;
53
54     const char *
55     GetName () override;
56
57     lldb::RegisterContextSP
58     GetRegisterContext() override;
59
60     lldb::RegisterContextSP
61     CreateRegisterContextForFrame (lldb_private::StackFrame *frame) override;
62
63     lldb::addr_t
64     GetThreadPointer () override;
65
66     //--------------------------------------------------------------------------
67     // These functions provide a mapping from the register offset
68     // back to the register index or name for use in debugging or log
69     // output.
70
71     unsigned
72     GetRegisterIndexFromOffset(unsigned offset);
73
74     const char *
75     GetRegisterName(unsigned reg);
76
77     const char *
78     GetRegisterNameFromOffset(unsigned offset);
79
80     //--------------------------------------------------------------------------
81     // These methods form a specialized interface to POSIX threads.
82     //
83     bool Resume();
84
85     void Notify(const ProcessMessage &message);
86
87     //--------------------------------------------------------------------------
88     // These methods provide an interface to watchpoints
89     //
90     bool EnableHardwareWatchpoint(lldb_private::Watchpoint *wp);
91
92     bool DisableHardwareWatchpoint(lldb_private::Watchpoint *wp);
93
94     uint32_t NumSupportedHardwareWatchpoints();
95
96     uint32_t FindVacantWatchpointIndex();
97
98 protected:
99     POSIXBreakpointProtocol *
100     GetPOSIXBreakpointProtocol ()
101     {
102         if (!m_reg_context_sp)
103             m_reg_context_sp = GetRegisterContext();
104         return m_posix_thread;
105     }
106     
107     std::unique_ptr<lldb_private::StackFrame> m_frame_ap;
108
109     lldb::BreakpointSiteSP m_breakpoint;
110
111     bool m_thread_name_valid;
112     std::string m_thread_name;
113     POSIXBreakpointProtocol *m_posix_thread;
114
115     ProcessMonitor &
116     GetMonitor();
117
118     bool
119     CalculateStopInfo() override;
120
121     void BreakNotify(const ProcessMessage &message);
122     void WatchNotify(const ProcessMessage &message);
123     virtual void TraceNotify(const ProcessMessage &message);
124     void LimboNotify(const ProcessMessage &message);
125     void SignalNotify(const ProcessMessage &message);
126     void SignalDeliveredNotify(const ProcessMessage &message);
127     void CrashNotify(const ProcessMessage &message);
128     void ExitNotify(const ProcessMessage &message);
129     void ExecNotify(const ProcessMessage &message);
130
131     lldb_private::Unwind *
132     GetUnwinder() override;
133
134     //--------------------------------------------------------------------------
135     // FreeBSDThread internal API.
136
137     // POSIXThread override
138     virtual void
139     WillResume(lldb::StateType resume_state) override;
140 };
141
142 #endif // #ifndef liblldb_FreeBSDThread_H_