1 //===-- FreeBSDThread.h -----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_FreeBSDThread_H_
11 #define liblldb_FreeBSDThread_H_
17 // Other libraries and framework includes
18 #include "lldb/Target/Thread.h"
19 #include "RegisterContextPOSIX.h"
23 class POSIXBreakpointProtocol;
25 //------------------------------------------------------------------------------
26 // @class FreeBSDThread
27 // @brief Abstraction of a FreeBSD thread.
29 : public lldb_private::Thread
33 //------------------------------------------------------------------
34 // Constructors and destructors
35 //------------------------------------------------------------------
36 FreeBSDThread(lldb_private::Process &process, lldb::tid_t tid);
38 virtual ~FreeBSDThread();
42 RefreshStateAfterStop() override;
44 // This notifies the thread when a private stop occurs.
52 SetName (const char *name) override;
57 lldb::RegisterContextSP
58 GetRegisterContext() override;
60 lldb::RegisterContextSP
61 CreateRegisterContextForFrame (lldb_private::StackFrame *frame) override;
64 GetThreadPointer () override;
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
72 GetRegisterIndexFromOffset(unsigned offset);
75 GetRegisterName(unsigned reg);
78 GetRegisterNameFromOffset(unsigned offset);
80 //--------------------------------------------------------------------------
81 // These methods form a specialized interface to POSIX threads.
85 void Notify(const ProcessMessage &message);
87 //--------------------------------------------------------------------------
88 // These methods provide an interface to watchpoints
90 bool EnableHardwareWatchpoint(lldb_private::Watchpoint *wp);
92 bool DisableHardwareWatchpoint(lldb_private::Watchpoint *wp);
94 uint32_t NumSupportedHardwareWatchpoints();
96 uint32_t FindVacantWatchpointIndex();
99 POSIXBreakpointProtocol *
100 GetPOSIXBreakpointProtocol ()
102 if (!m_reg_context_sp)
103 m_reg_context_sp = GetRegisterContext();
104 return m_posix_thread;
107 std::unique_ptr<lldb_private::StackFrame> m_frame_ap;
109 lldb::BreakpointSiteSP m_breakpoint;
111 bool m_thread_name_valid;
112 std::string m_thread_name;
113 POSIXBreakpointProtocol *m_posix_thread;
119 CalculateStopInfo() override;
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);
131 lldb_private::Unwind *
132 GetUnwinder() override;
134 //--------------------------------------------------------------------------
135 // FreeBSDThread internal API.
137 // POSIXThread override
139 WillResume(lldb::StateType resume_state) override;
142 #endif // #ifndef liblldb_FreeBSDThread_H_