1 //===-- POSIXThread.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_POSIXThread_H_
11 #define liblldb_POSIXThread_H_
18 // Other libraries and framework includes
19 #include "lldb/Target/Thread.h"
20 #include "RegisterContextPOSIX.h"
24 class RegisterContextPOSIX;
26 //------------------------------------------------------------------------------
28 // @brief Abstraction of a POSIX thread.
30 : public lldb_private::Thread
33 POSIXThread(lldb_private::Process &process, lldb::tid_t tid);
35 virtual ~POSIXThread();
38 RefreshStateAfterStop();
41 WillResume(lldb::StateType resume_state);
43 // This notifies the thread when a private stop occurs.
51 SetName (const char *name);
56 virtual lldb::RegisterContextSP
59 virtual lldb::RegisterContextSP
60 CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
62 //--------------------------------------------------------------------------
63 // These functions provide a mapping from the register offset
64 // back to the register index or name for use in debugging or log
68 GetRegisterIndexFromOffset(unsigned offset);
71 GetRegisterName(unsigned reg);
74 GetRegisterNameFromOffset(unsigned offset);
76 //--------------------------------------------------------------------------
77 // These methods form a specialized interface to POSIX threads.
81 void Notify(const ProcessMessage &message);
83 //--------------------------------------------------------------------------
84 // These methods provide an interface to watchpoints
86 bool EnableHardwareWatchpoint(lldb_private::Watchpoint *wp);
88 bool DisableHardwareWatchpoint(lldb_private::Watchpoint *wp);
90 uint32_t NumSupportedHardwareWatchpoints();
92 uint32_t FindVacantWatchpointIndex();
95 RegisterContextPOSIX *
96 GetRegisterContextPOSIX ()
98 if (!m_reg_context_sp)
99 m_reg_context_sp = GetRegisterContext();
101 return dynamic_cast<RegisterContextPOSIX*>(m_reg_context_sp.get());
103 return (RegisterContextPOSIX *)m_reg_context_sp.get();
106 std::unique_ptr<lldb_private::StackFrame> m_frame_ap;
108 lldb::BreakpointSiteSP m_breakpoint;
110 bool m_thread_name_valid;
111 std::string m_thread_name;
119 void BreakNotify(const ProcessMessage &message);
120 void WatchNotify(const ProcessMessage &message);
121 virtual void TraceNotify(const ProcessMessage &message);
122 void LimboNotify(const ProcessMessage &message);
123 void SignalNotify(const ProcessMessage &message);
124 void SignalDeliveredNotify(const ProcessMessage &message);
125 void CrashNotify(const ProcessMessage &message);
126 void ThreadNotify(const ProcessMessage &message);
127 void ExitNotify(const ProcessMessage &message);
129 lldb_private::Unwind *
133 #endif // #ifndef liblldb_POSIXThread_H_