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. | |
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 |
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 26 of file ThreadList.h.
ThreadList::ThreadList | ( | Process & | process | ) |
Definition at line 26 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 30 of file ThreadList.cpp.
References m_process, m_selected_tid, m_stop_id, lldb_private::ThreadCollection::ThreadCollection(), and ThreadList().
|
override |
Definition at line 53 of file ThreadList.cpp.
References Clear().
|
privatedelete |
void ThreadList::Clear | ( | ) |
Definition at line 456 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 463 of file ThreadList.cpp.
References GetMutex(), and lldb_private::ThreadCollection::m_threads.
void ThreadList::DidResume | ( | ) |
Definition at line 658 of file ThreadList.cpp.
References lldb::eStateSuspended, GetMutex(), and lldb_private::ThreadCollection::m_threads.
void ThreadList::DidStop | ( | ) |
Definition at line 670 of file ThreadList.cpp.
References GetMutex(), lldb_private::ThreadCollection::m_threads, and lldb_private::StateIsRunningState().
void ThreadList::DiscardThreadPlans | ( | ) |
Definition at line 487 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 102 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 194 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 120 of file ThreadList.cpp.
References GetMutex(), m_process, and lldb_private::ThreadCollection::m_threads.
Referenced by ProcessKDP::DoUpdateThreadList().
void ThreadList::Flush | ( | ) |
Definition at line 784 of file ThreadList.cpp.
References GetMutex(), and lldb_private::ThreadCollection::m_threads.
lldb::ThreadSP ThreadList::GetExpressionExecutionThread | ( | ) |
Definition at line 59 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 791 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(), RemoveThreadByID(), RemoveThreadByProtocolID(), SetSelectedThreadByID(), SetSelectedThreadByIndexID(), SetShouldReportStop(), ShouldReportRun(), ShouldReportStop(), ShouldStop(), Update(), and WillResume().
ThreadSP ThreadList::GetSelectedThread | ( | ) |
Definition at line 687 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 82 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(), ProcessFreeBSDKernel::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 78 of file ThreadList.cpp.
References m_stop_id.
Definition at line 90 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(), ProcessFreeBSDKernel::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 177 of file ThreadList.cpp.
References GetMutex(), and lldb_private::ThreadCollection::m_threads.
|
protected |
Definition at line 729 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 37 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 73 of file ThreadList.cpp.
References m_expression_tid_stack.
|
protected |
Definition at line 69 of file ThreadList.cpp.
References m_expression_tid_stack.
void ThreadList::RefreshStateAfterStop | ( | ) |
Definition at line 471 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.
ThreadSP ThreadList::RemoveThreadByID | ( | lldb::tid_t | tid, |
bool | can_update = true ) |
Definition at line 138 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 157 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 699 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 714 of file ThreadList.cpp.
References FindThreadByIndexID(), GetMutex(), LLDB_INVALID_THREAD_ID, m_selected_tid, and NotifySelectedThreadChanged().
|
protected |
Definition at line 410 of file ThreadList.cpp.
References GetMutex(), m_process, and lldb_private::ThreadCollection::m_threads.
void ThreadList::SetStopID | ( | uint32_t | stop_id | ) |
Definition at line 421 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 361 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 211 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::Update | ( | ThreadList & | rhs | ) |
Precondition: both thread lists must be belong to the same process.
Definition at line 740 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 497 of file ThreadList.cpp.
References lldb_private::ThreadCollection::AddThread(), lldb::eStateSuspended, lldb_private::GetLog(), GetMutex(), GetSelectedThread(), GetSize(), GetThreadAtIndex(), lldb_private::Log::GetVerbose(), LLDB_LOGF, m_process, lldb_private::ThreadCollection::m_threads, SetStopID(), lldb_private::Step, and ThreadList().
|
friend |
Definition at line 27 of file ThreadList.h.
References Process, and ThreadList().
Referenced by Process, and ThreadList().
|
protected |
Definition at line 155 of file ThreadList.h.
Referenced by GetExpressionExecutionThread(), PopExpressionExecutionThread(), and PushExpressionExecutionThread().
|
protected |
The process that manages this thread list.
Definition at line 150 of file ThreadList.h.
Referenced by FindThreadByID(), FindThreadByIndexID(), FindThreadByProtocolID(), GetMutex(), GetSize(), GetThreadAtIndex(), operator=(), RefreshStateAfterStop(), RemoveThreadByID(), RemoveThreadByProtocolID(), SetShouldReportStop(), ShouldReportRun(), ShouldReportStop(), ShouldStop(), ThreadList(), ThreadList(), Update(), and WillResume().
|
protected |
For targets that need the notion of a current thread.
Definition at line 154 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 152 of file ThreadList.h.
Referenced by Clear(), GetStopID(), operator=(), SetStopID(), ThreadList(), ThreadList(), and Update().