LLDB mainline
lldb_private::PolicyStack Class Reference

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 PolicyStackGet ()

Private Member Functions

void Push (Policy policy)
void Pop ()

Private Attributes

llvm::SmallVector< Policym_stack = {Policy{}}

Detailed Description

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.

Definition at line 96 of file Policy.h.

Member Function Documentation

◆ Current()

◆ Dump()

void PolicyStack::Dump ( Stream & s) const

Definition at line 101 of file Policy.cpp.

References m_stack, and lldb_private::Stream::Printf().

◆ Get()

◆ Pop()

void lldb_private::PolicyStack::Pop ( )
inlineprivate

◆ Push()

void lldb_private::PolicyStack::Push ( Policy policy)
inlineprivate

Definition at line 147 of file Policy.h.

References m_stack.

Referenced by PushPrivateState(), and PushPublicStateRunningExpression().

◆ PushPrivateState()

Guard lldb_private::PolicyStack::PushPrivateState ( Policy::PrivateStatePurpose purpose = Policy::PrivateStatePurpose::Default)
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().

◆ PushPublicStateRunningExpression()

Guard lldb_private::PolicyStack::PushPublicStateRunningExpression ( )
inlinenodiscard

Member Data Documentation

◆ m_stack

llvm::SmallVector<Policy> lldb_private::PolicyStack::m_stack = {Policy{}}
private

Definition at line 154 of file Policy.h.

Referenced by Current(), Dump(), Pop(), and Push().


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