|
LLDB mainline
|
#include <ThreadList.h>
Classes | |
| class | ExpressionExecutionThreadPusher |
Public Member Functions | |
| ThreadList (Process &process) | |
| ThreadList (const ThreadList &rhs) | |
| ~ThreadList () override | |
| const ThreadList & | operator= (const ThreadList &rhs) |
| Precondition: both thread lists must be belong to the same process. | |
| uint32_t | GetSize (bool can_update=true) |
| lldb::ThreadSP | GetSelectedThread () |
| lldb::ThreadSP | GetExpressionExecutionThread () |
| bool | SetSelectedThreadByID (lldb::tid_t tid, bool notify=false) |
| bool | SetSelectedThreadByIndexID (uint32_t index_id, bool notify=false) |
| void | Clear () |
| void | Flush () |
| void | Destroy () |
| lldb::ThreadSP | GetThreadAtIndex (uint32_t idx, bool can_update=true) |
| lldb::ThreadSP | FindThreadByID (lldb::tid_t tid, bool can_update=true) |
| lldb::ThreadSP | FindThreadByProtocolID (lldb::tid_t tid, bool can_update=true) |
| lldb::ThreadSP | RemoveThreadByID (lldb::tid_t tid, bool can_update=true) |
| lldb::ThreadSP | RemoveThreadByProtocolID (lldb::tid_t tid, bool can_update=true) |
| lldb::ThreadSP | FindThreadByIndexID (uint32_t index_id, bool can_update=true) |
| lldb::ThreadSP | GetThreadSPForThreadPtr (Thread *thread_ptr) |
| bool | ShouldStop (Event *event_ptr) |
| Vote | ShouldReportStop (Event *event_ptr) |
| Vote | ShouldReportRun (Event *event_ptr) |
| void | RefreshStateAfterStop () |
| bool | WillResume (lldb::RunDirection &direction) |
| The thread list asks tells all the threads it is about to resume. | |
| void | DidResume () |
| void | DidStop () |
| void | DiscardThreadPlans () |
| uint32_t | GetStopID () const |
| void | SetStopID (uint32_t stop_id) |
| std::recursive_mutex & | GetMutex () const override |
| void | Update (ThreadList &rhs) |
| Precondition: both thread lists must be belong to the same process. | |
| void | ThreadFinishedSteppingOverBreakpoint (lldb::addr_t breakpoint_addr, lldb::tid_t tid) |
| Called by ThreadPlanStepOverBreakpoint when a thread finishes stepping over a breakpoint. | |
| void | RegisterThreadSteppingOverBreakpoint (lldb::addr_t breakpoint_addr, lldb::tid_t tid) |
| Register a thread that is about to step over a breakpoint. | |
| Public Member Functions inherited from lldb_private::ThreadCollection | |
| ThreadCollection () | |
| ThreadCollection (collection threads) | |
| virtual | ~ThreadCollection ()=default |
| uint32_t | GetSize () |
| void | AddThread (const lldb::ThreadSP &thread_sp) |
| void | AddThreadSortedByIndexID (const lldb::ThreadSP &thread_sp) |
| void | InsertThread (const lldb::ThreadSP &thread_sp, uint32_t idx) |
| lldb::ThreadSP | GetThreadAtIndex (uint32_t idx) |
| virtual ThreadIterable | Threads () |
Protected Member Functions | |
| void | PushExpressionExecutionThread (lldb::tid_t tid) |
| void | PopExpressionExecutionThread (lldb::tid_t tid) |
| void | SetShouldReportStop (Vote vote) |
| void | NotifySelectedThreadChanged (lldb::tid_t tid) |
Protected Attributes | |
| Process & | m_process |
| The process that manages this thread list. | |
| uint32_t | m_stop_id |
| The process stop ID that this thread list is valid for. | |
| lldb::tid_t | m_selected_tid |
| For targets that need the notion of a current thread. | |
| std::vector< lldb::tid_t > | m_expression_tid_stack |
| llvm::DenseMap< lldb::addr_t, llvm::DenseSet< lldb::tid_t > > | m_threads_stepping_over_bp |
| Tracks which threads are currently stepping over each breakpoint address. | |
| Protected Attributes inherited from lldb_private::ThreadCollection | |
| collection | m_threads |
| std::recursive_mutex | m_mutex |
Private Member Functions | |
| ThreadList ()=delete | |
Friends | |
| class | Process |
Additional Inherited Members | |
| Public Types inherited from lldb_private::ThreadCollection | |
| typedef std::vector< lldb::ThreadSP > | collection |
| typedef LockingAdaptedIterable< std::recursive_mutex, collection > | ThreadIterable |
Definition at line 29 of file ThreadList.h.
| ThreadList::ThreadList | ( | Process & | process | ) |
Definition at line 29 of file ThreadList.cpp.
References LLDB_INVALID_THREAD_ID, m_process, m_selected_tid, m_stop_id, Process, and lldb_private::ThreadCollection::ThreadCollection().
Referenced by lldb_private::ThreadList::ExpressionExecutionThreadPusher::ExpressionExecutionThreadPusher(), operator=(), Process, ThreadList(), Update(), and WillResume().
| ThreadList::ThreadList | ( | const ThreadList & | rhs | ) |
Definition at line 33 of file ThreadList.cpp.
References m_process, m_selected_tid, m_stop_id, lldb_private::ThreadCollection::ThreadCollection(), and ThreadList().
|
override |
Definition at line 56 of file ThreadList.cpp.
References Clear().
|
privatedelete |
| void ThreadList::Clear | ( | ) |
Definition at line 459 of file ThreadList.cpp.
References GetMutex(), LLDB_INVALID_THREAD_ID, m_selected_tid, m_stop_id, and lldb_private::ThreadCollection::m_threads.
Referenced by ~ThreadList().
| void ThreadList::Destroy | ( | ) |
Definition at line 466 of file ThreadList.cpp.
References GetMutex(), and lldb_private::ThreadCollection::m_threads.
| void ThreadList::DidResume | ( | ) |
Definition at line 767 of file ThreadList.cpp.
References lldb::eStateSuspended, GetMutex(), and lldb_private::ThreadCollection::m_threads.
| void ThreadList::DidStop | ( | ) |
Definition at line 779 of file ThreadList.cpp.
References GetMutex(), lldb_private::ThreadCollection::m_threads, and lldb_private::StateIsRunningState().
| void ThreadList::DiscardThreadPlans | ( | ) |
Definition at line 490 of file ThreadList.cpp.
References GetMutex(), and lldb_private::ThreadCollection::m_threads.
| ThreadSP ThreadList::FindThreadByID | ( | lldb::tid_t | tid, |
| bool | can_update = true ) |
Definition at line 105 of file ThreadList.cpp.
References GetMutex(), m_process, and lldb_private::ThreadCollection::m_threads.
Referenced by lldb_private::CommandObjectIterateOverThreads::BucketThread(), CommandObjectThreadSelect::DoExecute(), lldb_private::trace_intel_pt::TraceIntelPT::DoRefreshLiveProcessState(), GetExpressionExecutionThread(), GetSelectedThread(), lldb_private::SaveCoreOptions::GetThreadsToSave(), NotifySelectedThreadChanged(), SetSelectedThreadByID(), and lldb_private::ThreadPlanStackMap::Update().
Definition at line 197 of file ThreadList.cpp.
References GetMutex(), m_process, and lldb_private::ThreadCollection::m_threads.
Referenced by CommandObjectThreadContinue::DoExecute(), CommandObjectThreadSelect::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectThreadUntil::DoExecute(), lldb_private::CommandObjectIterateOverThreads::DoExecute(), lldb_private::CommandObjectMultipleThreads::DoExecute(), lldb_private::ctf::CommandObjectThreadTraceExportCTF::DoExecute(), GetSingleThreadFromArgs(), lldb_private::Process::RunThreadPlan(), and SetSelectedThreadByIndexID().
| ThreadSP ThreadList::FindThreadByProtocolID | ( | lldb::tid_t | tid, |
| bool | can_update = true ) |
Definition at line 123 of file ThreadList.cpp.
References GetMutex(), m_process, and lldb_private::ThreadCollection::m_threads.
Referenced by ProcessKDP::DoUpdateThreadList().
| void ThreadList::Flush | ( | ) |
Definition at line 893 of file ThreadList.cpp.
References GetMutex(), and lldb_private::ThreadCollection::m_threads.
| lldb::ThreadSP ThreadList::GetExpressionExecutionThread | ( | ) |
Definition at line 62 of file ThreadList.cpp.
References FindThreadByID(), GetSelectedThread(), and m_expression_tid_stack.
Referenced by lldb_private::Process::CallVoidArgVoidPtrReturn(), lldb_private::PlatformWindows::DoLoadImage(), PlatformPOSIX::EvaluateLibdlExpression(), lldb_private::InferiorCallMmap(), and lldb_private::InferiorCallMunmap().
|
overridevirtual |
Reimplemented from lldb_private::ThreadCollection.
Definition at line 900 of file ThreadList.cpp.
References m_process.
Referenced by Clear(), Destroy(), DidResume(), DidStop(), DiscardThreadPlans(), CommandObjectProcessContinue::DoExecute(), CommandObjectThreadContinue::DoExecute(), CommandObjectThreadPlanPrune::DoExecute(), lldb_private::CommandObjectIterateOverThreads::DoExecute(), lldb_private::CommandObjectMultipleThreads::DoExecute(), FindThreadByID(), FindThreadByIndexID(), FindThreadByProtocolID(), Flush(), GetSelectedThread(), GetSize(), GetThreadAtIndex(), GetThreadSPForThreadPtr(), lldb_private::Process::HandleProcessStateChangedEvent(), operator=(), RefreshStateAfterStop(), RegisterThreadSteppingOverBreakpoint(), RemoveThreadByID(), RemoveThreadByProtocolID(), SetSelectedThreadByID(), SetSelectedThreadByIndexID(), SetShouldReportStop(), ShouldReportRun(), ShouldReportStop(), ShouldStop(), ThreadFinishedSteppingOverBreakpoint(), Update(), and WillResume().
| ThreadSP ThreadList::GetSelectedThread | ( | ) |
Definition at line 796 of file ThreadList.cpp.
References FindThreadByID(), GetMutex(), m_selected_tid, and lldb_private::ThreadCollection::m_threads.
Referenced by CommandObjectTargetModulesLoad::DoExecute(), lldb_private::CommandObject::GetDefaultThread(), GetExpressionExecutionThread(), lldb_private::AppleObjCRuntime::GetObjectDescription(), lldb_private::Thread::GetStatus(), lldb_private::Process::HandleProcessStateChangedEvent(), lldb_private::Process::RunThreadPlan(), DynamicLoaderDarwinKernel::SearchForKernelNearPC(), and WillResume().
| uint32_t ThreadList::GetSize | ( | bool | can_update = true | ) |
Definition at line 85 of file ThreadList.cpp.
References GetMutex(), m_process, and lldb_private::ThreadCollection::m_threads.
Referenced by DynamicLoaderPOSIXDYLD::CalculateDynamicSaveCoreRanges(), CommandObjectProcessContinue::DoExecute(), CommandObjectTargetModulesShowUnwind::DoExecute(), CommandObjectThreadContinue::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectThreadUntil::DoExecute(), lldb_private::ctf::CommandObjectThreadTraceExportCTF::DoExecute(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoResume(), lldb_private::minidump::ProcessMinidump::DoUpdateThreadList(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoUpdateThreadList(), lldb_private::ScriptedProcess::DoUpdateThreadList(), ProcessElfCore::DoUpdateThreadList(), ProcessFreeBSDKernelCore::DoUpdateThreadList(), ProcessKDP::DoUpdateThreadList(), ProcessMachCore::DoUpdateThreadList(), lldb_private::Process::GetThreadStatus(), lldb_private::Target::RunStopHooks(), lldb_private::Process::RunThreadPlan(), ObjectFileMachO::SaveCore(), lldb_private::Process::ProcessEventData::ShouldStop(), lldb_private::Process::UpdateThreadListIfNeeded(), and WillResume().
| uint32_t ThreadList::GetStopID | ( | ) | const |
Definition at line 81 of file ThreadList.cpp.
References m_stop_id.
Definition at line 93 of file ThreadList.cpp.
References GetMutex(), m_process, and lldb_private::ThreadCollection::m_threads.
Referenced by DynamicLoaderPOSIXDYLD::CalculateDynamicSaveCoreRanges(), CommandObjectProcessContinue::DoExecute(), CommandObjectTargetModulesShowUnwind::DoExecute(), CommandObjectThreadContinue::DoExecute(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoUpdateThreadList(), ProcessFreeBSDKernelCore::DoUpdateThreadList(), ProcessMachCore::DoUpdateThreadList(), lldb_private::Process::GetThreadStatus(), lldb_private::Process::HandleProcessStateChangedEvent(), lldb_private::Target::RunStopHooks(), lldb_private::Process::RunThreadPlan(), ObjectFileMachO::SaveCore(), lldb_private::Process::ProcessEventData::ShouldStop(), lldb_private::CommandCompletions::ThreadIDs(), lldb_private::CommandCompletions::ThreadIndexes(), lldb_private::Process::UpdateThreadListIfNeeded(), and WillResume().
Definition at line 180 of file ThreadList.cpp.
References GetMutex(), and lldb_private::ThreadCollection::m_threads.
|
protected |
Definition at line 838 of file ThreadList.cpp.
References lldb_private::Thread::eBroadcastBitThreadSelected, and FindThreadByID().
Referenced by SetSelectedThreadByID(), and SetSelectedThreadByIndexID().
| const ThreadList & ThreadList::operator= | ( | const ThreadList & | rhs | ) |
Precondition: both thread lists must be belong to the same process.
Definition at line 40 of file ThreadList.cpp.
References GetMutex(), m_process, m_selected_tid, m_stop_id, lldb_private::ThreadCollection::m_threads, and ThreadList().
|
protected |
Definition at line 76 of file ThreadList.cpp.
References m_expression_tid_stack.
|
protected |
Definition at line 72 of file ThreadList.cpp.
References m_expression_tid_stack.
| void ThreadList::RefreshStateAfterStop | ( | ) |
Definition at line 474 of file ThreadList.cpp.
References lldb_private::GetLog(), GetMutex(), lldb_private::Log::GetVerbose(), LLDB_LOGF, m_process, lldb_private::ThreadCollection::m_threads, and lldb_private::Step.
| void ThreadList::RegisterThreadSteppingOverBreakpoint | ( | lldb::addr_t | breakpoint_addr, |
| lldb::tid_t | tid ) |
Register a thread that is about to step over a breakpoint.
The breakpoint will be re-enabled only after all registered threads have called ThreadFinishedSteppingOverBreakpoint.
Definition at line 914 of file ThreadList.cpp.
References lldb_private::GetLog(), GetMutex(), LLDB_LOGF, m_threads_stepping_over_bp, and lldb_private::Step.
Referenced by WillResume().
| ThreadSP ThreadList::RemoveThreadByID | ( | lldb::tid_t | tid, |
| bool | can_update = true ) |
Definition at line 141 of file ThreadList.cpp.
References GetMutex(), m_process, and lldb_private::ThreadCollection::m_threads.
| ThreadSP ThreadList::RemoveThreadByProtocolID | ( | lldb::tid_t | tid, |
| bool | can_update = true ) |
Definition at line 160 of file ThreadList.cpp.
References GetMutex(), m_process, and lldb_private::ThreadCollection::m_threads.
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::DoUpdateThreadList().
| bool ThreadList::SetSelectedThreadByID | ( | lldb::tid_t | tid, |
| bool | notify = false ) |
Definition at line 808 of file ThreadList.cpp.
References FindThreadByID(), GetMutex(), LLDB_INVALID_THREAD_ID, m_selected_tid, and NotifySelectedThreadChanged().
Referenced by CommandObjectThreadSelect::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectThreadUntil::DoExecute(), lldb_private::Process::HandleProcessStateChangedEvent(), ResumeNewPlan(), lldb_private::Thread::StepIn(), lldb_private::Thread::StepOut(), and lldb_private::Thread::StepOver().
Definition at line 823 of file ThreadList.cpp.
References FindThreadByIndexID(), GetMutex(), LLDB_INVALID_THREAD_ID, m_selected_tid, and NotifySelectedThreadChanged().
|
protected |
Definition at line 413 of file ThreadList.cpp.
References GetMutex(), m_process, and lldb_private::ThreadCollection::m_threads.
| void ThreadList::SetStopID | ( | uint32_t | stop_id | ) |
Definition at line 424 of file ThreadList.cpp.
References lldb::eStateSuspended, lldb_private::eVoteNo, lldb_private::eVoteNoOpinion, lldb_private::eVoteYes, lldb_private::GetLog(), GetMutex(), LLDB_LOGF, m_process, lldb_private::ThreadCollection::m_threads, and lldb_private::Step.
Definition at line 364 of file ThreadList.cpp.
References lldb_private::eVoteNo, lldb_private::eVoteNoOpinion, lldb_private::eVoteYes, lldb_private::GetLog(), GetMutex(), LLDB_LOG, LLDB_LOGF, m_process, lldb_private::ThreadCollection::m_threads, and lldb_private::Step.
Definition at line 214 of file ThreadList.cpp.
References lldb::eStateSuspended, lldb_private::Process::ProcessEventData::GetInterruptedFromEvent(), lldb_private::GetLog(), GetMutex(), LLDB_LOG, LLDB_LOGF, m_process, lldb_private::ThreadCollection::m_threads, lldb_private::Log::PutCString(), and lldb_private::Step.
| void ThreadList::ThreadFinishedSteppingOverBreakpoint | ( | lldb::addr_t | breakpoint_addr, |
| lldb::tid_t | tid ) |
Called by ThreadPlanStepOverBreakpoint when a thread finishes stepping over a breakpoint.
This tracks which threads are still stepping over each breakpoint address, and only re-enables the breakpoint when ALL threads have finished stepping over it.
Definition at line 928 of file ThreadList.cpp.
References lldb_private::GetLog(), GetMutex(), LLDB_LOGF, m_process, m_threads_stepping_over_bp, and lldb_private::Step.
| void ThreadList::Update | ( | ThreadList & | rhs | ) |
Precondition: both thread lists must be belong to the same process.
Definition at line 849 of file ThreadList.cpp.
References GetMutex(), m_process, m_selected_tid, m_stop_id, lldb_private::ThreadCollection::m_threads, and ThreadList().
| bool ThreadList::WillResume | ( | lldb::RunDirection & | direction | ) |
The thread list asks tells all the threads it is about to resume.
If a thread can "resume" without having to resume the target, it will return false for WillResume, and then the process will not be restarted. Sets *direction to the run direction of the thread(s) that will be resumed. If threads that we want to run disagree about the direction, we execute forwards and pop any of the thread plans that requested reverse execution.
Definition at line 500 of file ThreadList.cpp.
References lldb_private::ThreadCollection::AddThread(), lldb_private::ThreadPlan::eKindStepOverBreakpoint, lldb::eStateSuspended, lldb_private::ThreadPlanStepOverBreakpoint::GetBreakpointLoadAddress(), lldb_private::ThreadPlan::GetKind(), lldb_private::GetLog(), GetMutex(), GetSelectedThread(), GetSize(), GetThreadAtIndex(), lldb_private::Log::GetVerbose(), LLDB_LOGF, m_process, lldb_private::ThreadCollection::m_threads, m_threads_stepping_over_bp, RegisterThreadSteppingOverBreakpoint(), lldb_private::ThreadPlanStepOverBreakpoint::SetDeferReenableBreakpointSite(), SetStopID(), lldb_private::Step, and ThreadList().
|
friend |
Definition at line 30 of file ThreadList.h.
References Process, and ThreadList().
Referenced by Process, and ThreadList().
|
protected |
Definition at line 171 of file ThreadList.h.
Referenced by GetExpressionExecutionThread(), PopExpressionExecutionThread(), and PushExpressionExecutionThread().
|
protected |
The process that manages this thread list.
Definition at line 166 of file ThreadList.h.
Referenced by FindThreadByID(), FindThreadByIndexID(), FindThreadByProtocolID(), GetMutex(), GetSize(), GetThreadAtIndex(), operator=(), RefreshStateAfterStop(), RemoveThreadByID(), RemoveThreadByProtocolID(), SetShouldReportStop(), ShouldReportRun(), ShouldReportStop(), ShouldStop(), ThreadFinishedSteppingOverBreakpoint(), ThreadList(), ThreadList(), Update(), and WillResume().
|
protected |
For targets that need the notion of a current thread.
Definition at line 170 of file ThreadList.h.
Referenced by Clear(), GetSelectedThread(), operator=(), SetSelectedThreadByID(), SetSelectedThreadByIndexID(), ThreadList(), ThreadList(), and Update().
|
protected |
The process stop ID that this thread list is valid for.
Definition at line 168 of file ThreadList.h.
Referenced by Clear(), GetStopID(), operator=(), SetStopID(), ThreadList(), ThreadList(), and Update().
|
protected |
Tracks which threads are currently stepping over each breakpoint address.
Key: breakpoint address, Value: set of thread IDs stepping over it. When a thread finishes stepping, it's removed from the set. When the set becomes empty, the breakpoint is re-enabled.
Definition at line 178 of file ThreadList.h.
Referenced by RegisterThreadSteppingOverBreakpoint(), ThreadFinishedSteppingOverBreakpoint(), and WillResume().