|
LLDB mainline
|
Per-thread policy stack. More...
#include <Policy.h>
Classes | |
| class | Guard |
| RAII guard that pops a policy on destruction. More... | |
Public Member Functions | |
| Policy | Current () const |
| void | Dump (Stream &s) const |
| Guard | PushPrivateState (Policy::PrivateStatePurpose purpose=Policy::PrivateStatePurpose::Default) |
| All Push* methods delegate to the named static factories on Policy, which already inherit from Current(). | |
| Guard | PushPublicStateRunningExpression () |
Static Public Member Functions | |
| static PolicyStack & | Get () |
Private Member Functions | |
| void | Push (Policy policy) |
| void | Pop () |
Private Attributes | |
| llvm::SmallVector< Policy > | m_stack = {Policy{}} |
Per-thread policy stack.
The stack lives in thread_local storage. Each thread has its own stack, initialized with a default-constructed base entry that is never popped. RAII guards (Guard) push and pop policies.
Policies are pushed via named factory methods (PushPrivateState, etc.) that return an RAII Guard. Direct Push is private to prevent callers from assembling arbitrary capability combinations.
For thread pool workers that don't inherit thread_local storage, the policy must be passed into the lambda and pushed onto the worker thread's stack when the task starts.
| Policy PolicyStack::Current | ( | ) | const |
Definition at line 18 of file Policy.cpp.
References lldb_private::Policy::Dump(), lldb_private::StreamString::GetData(), lldb_private::GetLog(), LLDB_LOG, m_stack, and lldb_private::Process.
Referenced by lldb_private::Policy::CreatePrivateState(), lldb_private::Policy::CreatePublicStateRunningExpression(), lldb_private::Target::GetAPIMutex(), lldb_private::Process::PrivateStateThread::GetRunLock(), lldb_private::Thread::GetStackFrameList(), lldb_private::Process::GetState(), lldb_private::StopInfoBreakpoint::PerformAction(), lldb_private::StopInfoWatchpoint::PerformAction(), and lldb_private::StackFrameList::SelectMostRelevantFrame().
| void PolicyStack::Dump | ( | Stream & | s | ) | const |
Definition at line 101 of file Policy.cpp.
References m_stack, and lldb_private::Stream::Printf().
|
inlinestatic |
Definition at line 98 of file Policy.h.
Referenced by lldb_private::Policy::CreatePrivateState(), lldb_private::Policy::CreatePublicStateRunningExpression(), lldb_private::LLVMUserExpression::DoExecute(), lldb_private::FunctionCaller::ExecuteFunction(), lldb_private::Target::GetAPIMutex(), lldb_private::Process::PrivateStateThread::GetRunLock(), lldb_private::Thread::GetStackFrameList(), lldb_private::Process::GetState(), IRInterpreter::Interpret(), lldb_private::PolicyStack::Guard::operator=(), lldb_private::StopInfoBreakpoint::PerformAction(), lldb_private::StopInfoWatchpoint::PerformAction(), lldb_private::Process::RunPrivateStateThread(), lldb_private::Process::RunThreadPlan(), lldb_private::StackFrameList::SelectMostRelevantFrame(), lldb_private::StopInfoBreakpoint::ShouldStopSynchronous(), lldb_private::StopInfoWatchpoint::ShouldStopSynchronous(), and lldb_private::PolicyStack::Guard::~Guard().
|
inlineprivate |
Definition at line 149 of file Policy.h.
References m_stack.
Referenced by lldb_private::PolicyStack::Guard::operator=(), and lldb_private::PolicyStack::Guard::~Guard().
|
inlineprivate |
Definition at line 147 of file Policy.h.
References m_stack.
Referenced by PushPrivateState(), and PushPublicStateRunningExpression().
|
inlinenodiscard |
All Push* methods delegate to the named static factories on Policy, which already inherit from Current().
So the pushed policy preserves existing stack state instead of resetting unrelated fields.
Definition at line 135 of file Policy.h.
References lldb_private::Policy::CreatePrivateState(), lldb_private::Policy::Default, and Push().
Referenced by lldb_private::Process::RunPrivateStateThread(), lldb_private::Process::RunThreadPlan(), lldb_private::StopInfoBreakpoint::ShouldStopSynchronous(), and lldb_private::StopInfoWatchpoint::ShouldStopSynchronous().
|
inlinenodiscard |
Definition at line 141 of file Policy.h.
References lldb_private::Policy::CreatePublicStateRunningExpression(), and Push().
Referenced by lldb_private::LLVMUserExpression::DoExecute(), lldb_private::FunctionCaller::ExecuteFunction(), and IRInterpreter::Interpret().