LLDB mainline
|
#include <NativeThreadLinux.h>
Public Member Functions | |
NativeThreadLinux (NativeProcessLinux &process, lldb::tid_t tid) | |
std::string | GetName () override |
lldb::StateType | GetState () override |
bool | GetStopReason (ThreadStopInfo &stop_info, std::string &description) override |
NativeRegisterContextLinux & | GetRegisterContext () override |
Status | SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override |
Status | RemoveWatchpoint (lldb::addr_t addr) override |
Status | SetHardwareBreakpoint (lldb::addr_t addr, size_t size) override |
Status | RemoveHardwareBreakpoint (lldb::addr_t addr) override |
NativeProcessLinux & | GetProcess () |
const NativeProcessLinux & | GetProcess () const |
llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > | GetSiginfo () const override |
Public Member Functions inherited from lldb_private::NativeThreadProtocol | |
NativeThreadProtocol (NativeProcessProtocol &process, lldb::tid_t tid) | |
virtual | ~NativeThreadProtocol ()=default |
virtual std::string | GetName ()=0 |
virtual lldb::StateType | GetState ()=0 |
virtual NativeRegisterContext & | GetRegisterContext ()=0 |
virtual bool | GetStopReason (ThreadStopInfo &stop_info, std::string &description)=0 |
lldb::tid_t | GetID () const |
NativeProcessProtocol & | GetProcess () |
virtual Status | SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware)=0 |
virtual Status | RemoveWatchpoint (lldb::addr_t addr)=0 |
virtual Status | SetHardwareBreakpoint (lldb::addr_t addr, size_t size)=0 |
virtual Status | RemoveHardwareBreakpoint (lldb::addr_t addr)=0 |
virtual llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > | GetSiginfo () const |
Private Types | |
using | WatchpointIndexMap = std::map< lldb::addr_t, uint32_t > |
Private Member Functions | |
Status | Resume (uint32_t signo) |
Resumes the thread. | |
Status | SingleStep (uint32_t signo) |
Single steps the thread. | |
void | SetStoppedBySignal (uint32_t signo, const siginfo_t *info=nullptr) |
bool | IsStopped (int *signo) |
Return true if the thread is stopped. | |
void | SetStoppedByExec () |
void | SetStoppedByBreakpoint () |
void | SetStoppedByWatchpoint (uint32_t wp_index) |
bool | IsStoppedAtBreakpoint () |
bool | IsStoppedAtWatchpoint () |
void | SetStoppedByTrace () |
void | SetStoppedByFork (bool is_vfork, lldb::pid_t child_pid) |
void | SetStoppedByVForkDone () |
void | SetStoppedWithNoReason () |
void | SetStoppedByProcessorTrace (llvm::StringRef description) |
void | SetExited () |
Status | RequestStop () |
void | MaybeLogStateChange (lldb::StateType new_state) |
void | SetStopped () |
void | AnnotateSyncTagCheckFault (lldb::addr_t fault_addr) |
Extend m_stop_description with logical and allocation tag values. | |
Private Attributes | |
lldb::StateType | m_state |
ThreadStopInfo | m_stop_info |
std::unique_ptr< NativeRegisterContextLinux > | m_reg_context_up |
std::string | m_stop_description |
WatchpointIndexMap | m_watchpoint_index_map |
WatchpointIndexMap | m_hw_break_index_map |
std::unique_ptr< SingleStepWorkaround > | m_step_workaround |
Friends | |
class | NativeProcessLinux |
Additional Inherited Members | |
Protected Attributes inherited from lldb_private::NativeThreadProtocol | |
NativeProcessProtocol & | m_process |
lldb::tid_t | m_tid |
Definition at line 29 of file NativeThreadLinux.h.
|
private |
Definition at line 120 of file NativeThreadLinux.h.
NativeThreadLinux::NativeThreadLinux | ( | NativeProcessLinux & | process, |
lldb::tid_t | tid | ||
) |
Definition at line 92 of file NativeThreadLinux.cpp.
|
private |
Extend m_stop_description with logical and allocation tag values.
If there is an error along the way just add the information we were able to get.
Definition at line 309 of file NativeThreadLinux.cpp.
References lldb_private::MemoryTagManagerAArch64MTE::eMTE_allocation, lldb_private::process_linux::NativeRegisterContextLinux::GetMemoryTaggingDetails(), GetProcess(), GetRegisterContext(), m_stop_description, lldb_private::process_linux::NativeProcessLinux::ReadMemoryTags(), and lldb_private::Status::Success().
Referenced by SetStoppedBySignal().
|
overridevirtual |
Implements lldb_private::NativeThreadProtocol.
Definition at line 101 of file NativeThreadLinux.cpp.
References lldb_private::NativeProcessProtocol::GetID(), lldb_private::NativeThreadProtocol::GetID(), GetProcess(), and lldb_private::getProcFile().
NativeProcessLinux & NativeThreadLinux::GetProcess | ( | ) |
Definition at line 536 of file NativeThreadLinux.cpp.
References lldb_private::NativeThreadProtocol::m_process.
Referenced by AnnotateSyncTagCheckFault(), GetName(), GetSiginfo(), RequestStop(), Resume(), and SingleStep().
const NativeProcessLinux & NativeThreadLinux::GetProcess | ( | ) | const |
Definition at line 540 of file NativeThreadLinux.cpp.
References lldb_private::NativeThreadProtocol::m_process.
|
inlineoverridevirtual |
Implements lldb_private::NativeThreadProtocol.
Definition at line 43 of file NativeThreadLinux.h.
References m_reg_context_up.
Referenced by lldb_private::process_linux::NativeProcessLinux::AllocateMemory(), AnnotateSyncTagCheckFault(), lldb_private::process_linux::NativeProcessLinux::DeallocateMemory(), lldb_private::process_linux::NativeProcessLinux::MonitorSIGTRAP(), lldb_private::process_linux::NativeProcessLinux::ReadMemoryTags(), SetStopped(), lldb_private::process_linux::NativeProcessLinux::Syscall(), and lldb_private::process_linux::NativeProcessLinux::WriteMemoryTags().
|
overridevirtual |
Reimplemented from lldb_private::NativeThreadProtocol.
Definition at line 545 of file NativeThreadLinux.cpp.
References error(), lldb_private::NativeThreadProtocol::GetID(), GetProcess(), and lldb_private::process_linux::NativeProcessLinux::GetSignalInfo().
|
overridevirtual |
Implements lldb_private::NativeThreadProtocol.
Definition at line 110 of file NativeThreadLinux.cpp.
References m_state.
Referenced by IsStoppedAtBreakpoint(), IsStoppedAtWatchpoint(), lldb_private::process_linux::NativeProcessLinux::MonitorCallback(), lldb_private::process_linux::NativeProcessLinux::MonitorClone(), lldb_private::process_linux::NativeProcessLinux::MonitorSignal(), lldb_private::process_linux::NativeProcessLinux::MonitorSIGTRAP(), lldb_private::process_linux::NativeProcessLinux::Syscall(), and lldb_private::process_linux::NativeProcessLinux::ThreadWasCreated().
|
overridevirtual |
Implements lldb_private::NativeThreadProtocol.
Definition at line 112 of file NativeThreadLinux.cpp.
References lldb::eStateAttaching, lldb::eStateConnected, lldb::eStateCrashed, lldb::eStateDetached, lldb::eStateExited, lldb::eStateInvalid, lldb::eStateLaunching, lldb::eStateRunning, lldb::eStateStepping, lldb::eStateStopped, lldb::eStateSuspended, lldb::eStateUnloaded, lldb_private::NativeThreadProtocol::GetID(), lldb_private::GetLog(), LLDB_LOGF, m_state, m_stop_description, m_stop_info, lldb_private::StateAsCString(), and lldb_private::Thread.
|
private |
Return true if the thread is stopped.
If stopped by a signal, indicate the signo in the signo argument. Otherwise, return LLDB_INVALID_SIGNAL_NUMBER.
Definition at line 361 of file NativeThreadLinux.cpp.
References m_state, m_stop_info, lldb_private::ThreadStopInfo::reason, lldb_private::ThreadStopInfo::signo, and lldb_private::StateIsStoppedState().
|
private |
Definition at line 434 of file NativeThreadLinux.cpp.
References GetState(), m_stop_info, and lldb_private::ThreadStopInfo::reason.
|
private |
Definition at line 439 of file NativeThreadLinux.cpp.
References GetState(), m_stop_info, and lldb_private::ThreadStopInfo::reason.
|
private |
Definition at line 521 of file NativeThreadLinux.cpp.
References lldb_private::NativeProcessProtocol::GetID(), lldb_private::NativeThreadProtocol::GetID(), lldb_private::GetLog(), LLDB_LOG, lldb_private::NativeThreadProtocol::m_process, m_state, and lldb_private::Thread.
Referenced by Resume(), SetExited(), SetStopped(), and SingleStep().
|
overridevirtual |
Implements lldb_private::NativeThreadProtocol.
Definition at line 197 of file NativeThreadLinux.cpp.
References m_hw_break_index_map, and m_reg_context_up.
Referenced by SetHardwareBreakpoint().
|
overridevirtual |
Implements lldb_private::NativeThreadProtocol.
Definition at line 168 of file NativeThreadLinux.cpp.
References m_reg_context_up, and m_watchpoint_index_map.
Referenced by SetWatchpoint().
|
private |
Definition at line 495 of file NativeThreadLinux.cpp.
References lldb_private::Status::AsCString(), lldb_private::NativeProcessProtocol::GetID(), lldb_private::NativeThreadProtocol::GetID(), lldb_private::GetLog(), GetProcess(), LLDB_LOGF, lldb_private::Status::SetErrorToErrno(), SIGSTOP, tgkill, and lldb_private::Thread.
Referenced by lldb_private::process_linux::NativeProcessLinux::ThreadWasCreated().
|
private |
Resumes the thread.
If signo
is anything but LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread.
Definition at line 211 of file NativeThreadLinux.cpp.
References lldb_private::NativeProcessProtocol::GetHardwareBreakpointMap(), lldb_private::NativeThreadProtocol::GetID(), GetProcess(), lldb_private::NativeProcessProtocol::GetWatchpointMap(), LLDB_INVALID_SIGNAL_NUMBER, m_hw_break_index_map, m_reg_context_up, m_state, m_stop_description, m_stop_info, m_watchpoint_index_map, MaybeLogStateChange(), lldb_private::process_linux::NativeProcessLinux::PtraceWrapper(), lldb_private::ThreadStopInfo::reason, SetHardwareBreakpoint(), and SetWatchpoint().
Referenced by lldb_private::process_linux::NativeProcessLinux::ResumeThread().
|
private |
Definition at line 487 of file NativeThreadLinux.cpp.
References m_state, m_stop_info, MaybeLogStateChange(), and lldb_private::ThreadStopInfo::reason.
|
overridevirtual |
Implements lldb_private::NativeThreadProtocol.
Definition at line 179 of file NativeThreadLinux.cpp.
References error(), lldb::eStateLaunching, LLDB_INVALID_INDEX32, m_hw_break_index_map, m_reg_context_up, m_state, and RemoveHardwareBreakpoint().
Referenced by Resume().
|
private |
Definition at line 375 of file NativeThreadLinux.cpp.
References GetRegisterContext(), lldb_private::process_linux::NativeRegisterContextLinux::InvalidateAllRegisters(), m_state, m_step_workaround, m_stop_description, and MaybeLogStateChange().
Referenced by SetStoppedByBreakpoint(), SetStoppedByExec(), SetStoppedByFork(), SetStoppedByProcessorTrace(), SetStoppedBySignal(), SetStoppedByTrace(), SetStoppedByVForkDone(), SetStoppedByWatchpoint(), and SetStoppedWithNoReason().
|
private |
Definition at line 398 of file NativeThreadLinux.cpp.
References m_stop_description, m_stop_info, lldb_private::ThreadStopInfo::reason, SetStopped(), lldb_private::ThreadStopInfo::signo, and SIGTRAP.
Referenced by lldb_private::process_linux::NativeProcessLinux::MonitorBreakpoint().
|
private |
Definition at line 388 of file NativeThreadLinux.cpp.
References lldb_private::GetLog(), LLDB_LOGF, m_stop_info, lldb_private::ThreadStopInfo::reason, SetStopped(), lldb_private::ThreadStopInfo::signo, SIGSTOP, and lldb_private::Thread.
|
private |
Definition at line 451 of file NativeThreadLinux.cpp.
References lldb_private::ThreadStopInfo::child_pid, lldb_private::ThreadStopInfo::child_tid, lldb_private::ThreadStopInfo::details, lldb_private::ThreadStopInfo::fork, m_stop_description, m_stop_info, lldb_private::ThreadStopInfo::reason, SetStopped(), lldb_private::ThreadStopInfo::signo, and SIGTRAP.
Referenced by lldb_private::process_linux::NativeProcessLinux::MonitorClone().
|
private |
Definition at line 478 of file NativeThreadLinux.cpp.
References m_stop_description, m_stop_info, lldb_private::ThreadStopInfo::reason, SetStopped(), and lldb_private::ThreadStopInfo::signo.
Referenced by lldb_private::process_linux::NativeProcessLinux::AddThread().
|
private |
Definition at line 279 of file NativeThreadLinux.cpp.
References AnnotateSyncTagCheckFault(), GetCrashReasonString(), lldb_private::GetLog(), LLDB_LOGF, m_stop_description, m_stop_info, lldb_private::ThreadStopInfo::reason, SEGV_MTESERR, SetStopped(), lldb_private::ThreadStopInfo::signo, and lldb_private::Thread.
Referenced by lldb_private::process_linux::NativeProcessLinux::AddThread(), and lldb_private::process_linux::NativeProcessLinux::MonitorSignal().
|
private |
Definition at line 444 of file NativeThreadLinux.cpp.
References m_stop_info, lldb_private::ThreadStopInfo::reason, SetStopped(), lldb_private::ThreadStopInfo::signo, and SIGTRAP.
Referenced by lldb_private::process_linux::NativeProcessLinux::MonitorBreakpoint(), and lldb_private::process_linux::NativeProcessLinux::MonitorTrace().
|
private |
Definition at line 464 of file NativeThreadLinux.cpp.
References m_stop_info, lldb_private::ThreadStopInfo::reason, SetStopped(), lldb_private::ThreadStopInfo::signo, and SIGTRAP.
Referenced by lldb_private::process_linux::NativeProcessLinux::MonitorSIGTRAP().
|
private |
Definition at line 406 of file NativeThreadLinux.cpp.
References LLDB_INVALID_INDEX32, lldbassert, m_reg_context_up, m_stop_description, m_stop_info, lldb_private::ThreadStopInfo::reason, SetStopped(), lldb_private::ThreadStopInfo::signo, and SIGTRAP.
Referenced by lldb_private::process_linux::NativeProcessLinux::MonitorWatchpoint().
|
private |
Definition at line 471 of file NativeThreadLinux.cpp.
References m_stop_info, lldb_private::ThreadStopInfo::reason, SetStopped(), and lldb_private::ThreadStopInfo::signo.
Referenced by lldb_private::process_linux::NativeProcessLinux::MonitorSignal().
|
overridevirtual |
Implements lldb_private::NativeThreadProtocol.
Definition at line 151 of file NativeThreadLinux.cpp.
References error(), lldb::eStateLaunching, LLDB_INVALID_INDEX32, m_reg_context_up, m_state, m_watchpoint_index_map, and RemoveWatchpoint().
Referenced by Resume().
|
private |
Single steps the thread.
If signo
is anything but LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread.
Definition at line 253 of file NativeThreadLinux.cpp.
References lldb_private::process_linux::SingleStepWorkaround::Get(), GetProcess(), LLDB_INVALID_SIGNAL_NUMBER, m_state, m_step_workaround, m_stop_info, lldb_private::NativeThreadProtocol::m_tid, MaybeLogStateChange(), lldb_private::process_linux::NativeProcessLinux::PtraceWrapper(), and lldb_private::ThreadStopInfo::reason.
Referenced by lldb_private::process_linux::NativeProcessLinux::ResumeThread().
|
friend |
Definition at line 30 of file NativeThreadLinux.h.
|
private |
Definition at line 122 of file NativeThreadLinux.h.
Referenced by RemoveHardwareBreakpoint(), Resume(), and SetHardwareBreakpoint().
|
private |
Definition at line 118 of file NativeThreadLinux.h.
Referenced by GetRegisterContext(), RemoveHardwareBreakpoint(), RemoveWatchpoint(), Resume(), SetHardwareBreakpoint(), SetStoppedByWatchpoint(), and SetWatchpoint().
|
private |
Definition at line 116 of file NativeThreadLinux.h.
Referenced by GetState(), GetStopReason(), IsStopped(), MaybeLogStateChange(), Resume(), SetExited(), SetHardwareBreakpoint(), SetStopped(), SetWatchpoint(), and SingleStep().
|
private |
Definition at line 123 of file NativeThreadLinux.h.
Referenced by SetStopped(), and SingleStep().
|
private |
Definition at line 119 of file NativeThreadLinux.h.
Referenced by AnnotateSyncTagCheckFault(), GetStopReason(), Resume(), SetStopped(), SetStoppedByBreakpoint(), SetStoppedByFork(), SetStoppedByProcessorTrace(), SetStoppedBySignal(), and SetStoppedByWatchpoint().
|
private |
Definition at line 117 of file NativeThreadLinux.h.
Referenced by GetStopReason(), IsStopped(), IsStoppedAtBreakpoint(), IsStoppedAtWatchpoint(), Resume(), SetExited(), SetStoppedByBreakpoint(), SetStoppedByExec(), SetStoppedByFork(), SetStoppedByProcessorTrace(), SetStoppedBySignal(), SetStoppedByTrace(), SetStoppedByVForkDone(), SetStoppedByWatchpoint(), SetStoppedWithNoReason(), and SingleStep().
|
private |
Definition at line 121 of file NativeThreadLinux.h.
Referenced by RemoveWatchpoint(), Resume(), and SetWatchpoint().