LLDB mainline
lldb_private::Process::PrivateStateThread Struct Reference

The PrivateStateThread struct gathers all the bits of state needed to manage handling Process events, from receiving them on the Private State to signaling when process events are broadcase publicly, to determining when various actors can act on the process. More...

#include <Process.h>

Public Types

using Purpose = Policy::PrivateStatePurpose
 Why this PST exists.

Public Member Functions

 PrivateStateThread (Process &process, lldb::StateType public_state, lldb::StateType private_state, llvm::StringRef thread_name, Purpose purpose=Purpose::Default)
bool StartupThread ()
bool IsOnThread (const HostThread &thread) const
bool IsJoinable ()
void JoinAndReset ()
bool IsRunning ()
bool IsOverride () const
void SetThreadName (llvm::StringRef new_name)
lldb::StateType GetPrivateState () const
lldb::StateType GetPublicState () const
void SetPublicState (lldb::StateType new_value)
void SetPrivateState (lldb::StateType new_value)
std::recursive_mutex & GetPrivateStateMutex ()
lldb::StateType GetPrivateStateNoLock () const
void SetPrivateStateNoLock (lldb::StateType new_state)
void SetPublicStateNoLock (lldb::StateType new_state)
bool SetPublicRunLockToRunning ()
bool SetPrivateRunLockToRunning ()
bool SetPublicRunLockToStopped ()
bool SetPrivateRunLockToStopped ()
ProcessRunLockGetRunLock ()

Public Attributes

Processm_process
 The process state that we show to client code.
ThreadSafeValue< lldb::StateTypem_public_state
 The actual state of our process.
ThreadSafeValue< lldb::StateTypem_private_state
 HostThread for the thread that watches for internal state events.
HostThread m_private_state_thread
ProcessRunLock m_public_run_lock
ProcessRunLock m_private_run_lock
bool m_is_running = false
Purpose m_purpose
 This will be the thread name given to the Private State HostThread when it gets spun up.
std::string m_thread_name

Detailed Description

The PrivateStateThread struct gathers all the bits of state needed to manage handling Process events, from receiving them on the Private State to signaling when process events are broadcase publicly, to determining when various actors can act on the process.

It also holds the current private state thread. These need to be swappable as a group to manage the temporary modal private state thread that we spin up when we need to run an expression on the private state thread.

Definition at line 3316 of file Process.h.

Member Typedef Documentation

◆ Purpose

Why this PST exists.

RunPrivateStateThread reads this directly to decide which Policy to push, rather than re-deriving it from a generic "is this an override PST" flag. This is the same enum Policy::CreatePrivateState()/PolicyStack::PushPrivateState() take, so there's a single purpose value flowing from PST creation through to the policy it pushes.

Definition at line 3323 of file Process.h.

Constructor & Destructor Documentation

◆ PrivateStateThread()

lldb_private::Process::PrivateStateThread::PrivateStateThread ( Process & process,
lldb::StateType public_state,
lldb::StateType private_state,
llvm::StringRef thread_name,
Purpose purpose = Purpose::Default )
inline

Member Function Documentation

◆ GetPrivateState()

lldb::StateType lldb_private::Process::PrivateStateThread::GetPrivateState ( ) const
inline

Definition at line 3353 of file Process.h.

References m_private_state.

◆ GetPrivateStateMutex()

std::recursive_mutex & lldb_private::Process::PrivateStateThread::GetPrivateStateMutex ( )
inline

Definition at line 3367 of file Process.h.

References m_private_state.

◆ GetPrivateStateNoLock()

lldb::StateType lldb_private::Process::PrivateStateThread::GetPrivateStateNoLock ( ) const
inline

Definition at line 3371 of file Process.h.

References m_private_state.

◆ GetPublicState()

lldb::StateType lldb_private::Process::PrivateStateThread::GetPublicState ( ) const
inline

Definition at line 3357 of file Process.h.

References m_public_state.

◆ GetRunLock()

◆ IsJoinable()

bool lldb_private::Process::PrivateStateThread::IsJoinable ( )
inline

Definition at line 3338 of file Process.h.

References m_private_state_thread.

◆ IsOnThread()

bool Process::PrivateStateThread::IsOnThread ( const HostThread & thread) const

Definition at line 4107 of file Process.cpp.

References m_private_state_thread.

◆ IsOverride()

bool lldb_private::Process::PrivateStateThread::IsOverride ( ) const
inline

Definition at line 3349 of file Process.h.

References m_purpose.

◆ IsRunning()

bool lldb_private::Process::PrivateStateThread::IsRunning ( )
inline

Definition at line 3347 of file Process.h.

References m_is_running.

◆ JoinAndReset()

void lldb_private::Process::PrivateStateThread::JoinAndReset ( )
inline

Definition at line 3340 of file Process.h.

References m_is_running, and m_private_state_thread.

◆ SetPrivateRunLockToRunning()

bool lldb_private::Process::PrivateStateThread::SetPrivateRunLockToRunning ( )
inline

Definition at line 3385 of file Process.h.

References m_private_run_lock.

◆ SetPrivateRunLockToStopped()

bool lldb_private::Process::PrivateStateThread::SetPrivateRunLockToStopped ( )
inline

Definition at line 3391 of file Process.h.

References m_private_run_lock.

◆ SetPrivateState()

void lldb_private::Process::PrivateStateThread::SetPrivateState ( lldb::StateType new_value)
inline

Definition at line 3363 of file Process.h.

References m_private_state.

◆ SetPrivateStateNoLock()

void lldb_private::Process::PrivateStateThread::SetPrivateStateNoLock ( lldb::StateType new_state)
inline

Definition at line 3375 of file Process.h.

References m_private_state.

◆ SetPublicRunLockToRunning()

bool lldb_private::Process::PrivateStateThread::SetPublicRunLockToRunning ( )
inline

Definition at line 3383 of file Process.h.

References m_public_run_lock.

◆ SetPublicRunLockToStopped()

bool lldb_private::Process::PrivateStateThread::SetPublicRunLockToStopped ( )
inline

Definition at line 3389 of file Process.h.

References m_public_run_lock.

◆ SetPublicState()

void lldb_private::Process::PrivateStateThread::SetPublicState ( lldb::StateType new_value)
inline

Definition at line 3359 of file Process.h.

References m_public_state.

◆ SetPublicStateNoLock()

void lldb_private::Process::PrivateStateThread::SetPublicStateNoLock ( lldb::StateType new_state)
inline

Definition at line 3379 of file Process.h.

References m_public_state.

◆ SetThreadName()

void lldb_private::Process::PrivateStateThread::SetThreadName ( llvm::StringRef new_name)
inline

Definition at line 3351 of file Process.h.

References m_thread_name.

◆ StartupThread()

Member Data Documentation

◆ m_is_running

bool lldb_private::Process::PrivateStateThread::m_is_running = false

Definition at line 3414 of file Process.h.

Referenced by IsRunning(), JoinAndReset(), and StartupThread().

◆ m_private_run_lock

ProcessRunLock lldb_private::Process::PrivateStateThread::m_private_run_lock

Definition at line 3413 of file Process.h.

Referenced by GetRunLock(), SetPrivateRunLockToRunning(), and SetPrivateRunLockToStopped().

◆ m_private_state

ThreadSafeValue<lldb::StateType> lldb_private::Process::PrivateStateThread::m_private_state

HostThread for the thread that watches for internal state events.

Definition at line 3404 of file Process.h.

Referenced by GetPrivateState(), GetPrivateStateMutex(), GetPrivateStateNoLock(), PrivateStateThread(), SetPrivateState(), and SetPrivateStateNoLock().

◆ m_private_state_thread

HostThread lldb_private::Process::PrivateStateThread::m_private_state_thread

Definition at line 3406 of file Process.h.

Referenced by IsJoinable(), IsOnThread(), JoinAndReset(), and StartupThread().

◆ m_process

Process& lldb_private::Process::PrivateStateThread::m_process

The process state that we show to client code.

This will often differ from the actual process state, for instance when we've stopped in the middle of a ThreadPlan's operations, before we've decided to stop or continue.

Definition at line 3397 of file Process.h.

Referenced by PrivateStateThread(), and StartupThread().

◆ m_public_run_lock

ProcessRunLock lldb_private::Process::PrivateStateThread::m_public_run_lock

Definition at line 3412 of file Process.h.

Referenced by GetRunLock(), SetPublicRunLockToRunning(), and SetPublicRunLockToStopped().

◆ m_public_state

ThreadSafeValue<lldb::StateType> lldb_private::Process::PrivateStateThread::m_public_state

The actual state of our process.

Definition at line 3402 of file Process.h.

Referenced by GetPublicState(), PrivateStateThread(), SetPublicState(), and SetPublicStateNoLock().

◆ m_purpose

Purpose lldb_private::Process::PrivateStateThread::m_purpose

This will be the thread name given to the Private State HostThread when it gets spun up.

Definition at line 3415 of file Process.h.

Referenced by IsOverride(), PrivateStateThread(), and StartupThread().

◆ m_thread_name

std::string lldb_private::Process::PrivateStateThread::m_thread_name

Definition at line 3418 of file Process.h.

Referenced by PrivateStateThread(), SetThreadName(), and StartupThread().


The documentation for this struct was generated from the following files: