LLDB mainline
lldb_private::Target::Hook Class Reference

#include <Target.h>

Inheritance diagram for lldb_private::Target::Hook:
[legend]

Public Types

enum class  HookKind : uint32_t { CommandBased = 0 , ScriptBased }
enum  TriggerBit : uint32_t { kModulesLoaded = (1u << 0) , kModulesUnloaded = (1u << 1) , kProcessStop = (1u << 2) }
 Individual trigger bits. Combine with bitwise OR to form a trigger mask. More...

Public Member Functions

 Hook (const Hook &rhs)
virtual ~Hook ()=default
HookKind GetHookKind () const
lldb::TargetSPGetTarget ()
bool IsEnabled ()
void SetIsEnabled (bool enabled)
uint32_t GetTriggerMask () const
 Return the bitmask of triggers this hook responds to.
bool FiresOn (uint32_t trigger) const
 Return true if this hook fires on the given trigger.
void SetSCSpecifier (SymbolContextSpecifier *specifier)
 Set the symbol context specifier. The hook takes ownership.
SymbolContextSpecifierGetSCSpecifier ()
bool ExecutionContextPasses (const ExecutionContext &exe_ctx)
 Check if the execution context passes the specifier and thread spec filters.
void SetThreadSpecifier (ThreadSpec *specifier)
 Set the thread specifier. The hook takes ownership.
ThreadSpecGetThreadSpecifier ()
void SetRunAtInitialStop (bool at_initial_stop)
bool GetRunAtInitialStop () const
void SetAutoContinue (bool auto_continue)
bool GetAutoContinue () const
void SetSuppressOutput (bool suppress_output)
bool GetSuppressOutput () const
virtual void HandleModuleLoaded (lldb::StreamSP output)
virtual void HandleModuleUnloaded (lldb::StreamSP output)
virtual StopHook::StopHookResult HandleStop (ExecutionContext &exe_ctx, lldb::StreamSP output)
 Called when the process stops.
virtual void GetDescription (Stream &s, lldb::DescriptionLevel level) const
Public Member Functions inherited from lldb_private::UserID
 UserID (lldb::user_id_t uid=LLDB_INVALID_UID)
 Construct with optional user ID.
 ~UserID ()=default
 Destructor.
void Clear ()
 Clears the object state.
lldb::user_id_t GetID () const
 Get accessor for the user ID.
void SetID (lldb::user_id_t uid)
 Set accessor for the user ID.

Protected Member Functions

void GetFilterDescription (Stream &s, lldb::DescriptionLevel level) const
 Print the filter portion of the description (AutoContinue, Specifier, ThreadSpec).
 Hook (lldb::TargetSP target_sp, lldb::user_id_t uid, HookKind kind)

Protected Attributes

lldb::TargetSP m_target_sp
HookKind m_kind
bool m_enabled = true
uint32_t m_trigger_mask = 0
lldb::SymbolContextSpecifierSP m_sc_specifier_sp
std::unique_ptr< ThreadSpecm_thread_spec_up
bool m_at_initial_stop = true
bool m_auto_continue = false
bool m_suppress_output = false
Protected Attributes inherited from lldb_private::UserID
lldb::user_id_t m_uid
 The user ID that uniquely identifies an object.

Detailed Description

Definition at line 1683 of file Target.h.

Member Enumeration Documentation

◆ HookKind

enum class lldb_private::Target::Hook::HookKind : uint32_t
strong
Enumerator
CommandBased 
ScriptBased 

Definition at line 1688 of file Target.h.

◆ TriggerBit

Individual trigger bits. Combine with bitwise OR to form a trigger mask.

Enumerator
kModulesLoaded 
kModulesUnloaded 
kProcessStop 

Definition at line 1694 of file Target.h.

Constructor & Destructor Documentation

◆ Hook() [1/2]

◆ ~Hook()

virtual lldb_private::Target::Hook::~Hook ( )
virtualdefault

◆ Hook() [2/2]

Target::Hook::Hook ( lldb::TargetSP target_sp,
lldb::user_id_t uid,
HookKind kind )
protected

Definition at line 4323 of file Target.cpp.

References m_kind, m_target_sp, and lldb_private::UserID::UserID().

Member Function Documentation

◆ ExecutionContextPasses()

bool Target::Hook::ExecutionContextPasses ( const ExecutionContext & exe_ctx)

Check if the execution context passes the specifier and thread spec filters.

Always returns true if no filters are set.

Definition at line 4345 of file Target.cpp.

References lldb_private::ExecutionContext::GetFramePtr(), GetSCSpecifier(), lldb_private::StackFrame::GetSymbolContext(), lldb_private::ExecutionContext::GetThreadRef(), GetThreadSpecifier(), and lldb_private::SymbolContextSpecifier::SymbolContextMatches().

◆ FiresOn()

bool lldb_private::Target::Hook::FiresOn ( uint32_t trigger) const
inline

Return true if this hook fires on the given trigger.

Definition at line 1710 of file Target.h.

References m_trigger_mask.

◆ GetAutoContinue()

bool lldb_private::Target::Hook::GetAutoContinue ( ) const
inline

Definition at line 1736 of file Target.h.

References m_auto_continue.

◆ GetDescription()

◆ GetFilterDescription()

void Target::Hook::GetFilterDescription ( Stream & s,
lldb::DescriptionLevel level ) const
protected

Print the filter portion of the description (AutoContinue, Specifier, ThreadSpec).

Called by subclass GetDescription after printing the hook-specific content (commands or class).

Definition at line 4394 of file Target.cpp.

References lldb_private::StreamString::GetString(), lldb_private::Stream::Indent(), lldb_private::Stream::IndentLess(), lldb_private::Stream::IndentMore(), m_auto_continue, m_sc_specifier_sp, m_thread_spec_up, and lldb_private::Stream::PutCString().

Referenced by lldb_private::Target::HookCommandLine::GetDescription(), and lldb_private::Target::HookScripted::GetDescription().

◆ GetHookKind()

HookKind lldb_private::Target::Hook::GetHookKind ( ) const
inline

Definition at line 1690 of file Target.h.

References m_kind.

◆ GetRunAtInitialStop()

bool lldb_private::Target::Hook::GetRunAtInitialStop ( ) const
inline

Definition at line 1729 of file Target.h.

References m_at_initial_stop.

◆ GetSCSpecifier()

SymbolContextSpecifier * lldb_private::Target::Hook::GetSCSpecifier ( )
inline

Definition at line 1716 of file Target.h.

References m_sc_specifier_sp.

Referenced by ExecutionContextPasses().

◆ GetSuppressOutput()

bool lldb_private::Target::Hook::GetSuppressOutput ( ) const
inline

Definition at line 1741 of file Target.h.

References m_suppress_output.

◆ GetTarget()

lldb::TargetSP & lldb_private::Target::Hook::GetTarget ( )
inline

◆ GetThreadSpecifier()

ThreadSpec * lldb_private::Target::Hook::GetThreadSpecifier ( )
inline

Definition at line 1724 of file Target.h.

References m_thread_spec_up.

Referenced by ExecutionContextPasses().

◆ GetTriggerMask()

uint32_t lldb_private::Target::Hook::GetTriggerMask ( ) const
inline

Return the bitmask of triggers this hook responds to.

Each bit corresponds to a TriggerBit value.

Definition at line 1707 of file Target.h.

References m_trigger_mask.

◆ HandleModuleLoaded()

virtual void lldb_private::Target::Hook::HandleModuleLoaded ( lldb::StreamSP output)
inlinevirtual

Reimplemented in lldb_private::Target::HookCommandLine, and lldb_private::Target::HookScripted.

Definition at line 1745 of file Target.h.

◆ HandleModuleUnloaded()

virtual void lldb_private::Target::Hook::HandleModuleUnloaded ( lldb::StreamSP output)
inlinevirtual

Reimplemented in lldb_private::Target::HookCommandLine, and lldb_private::Target::HookScripted.

Definition at line 1746 of file Target.h.

◆ HandleStop()

virtual StopHook::StopHookResult lldb_private::Target::Hook::HandleStop ( ExecutionContext & exe_ctx,
lldb::StreamSP output )
inlinevirtual

Called when the process stops.

Returns a StopHookResult indicating whether the process should remain stopped or continue.

Reimplemented in lldb_private::Target::HookCommandLine, and lldb_private::Target::HookScripted.

Definition at line 1750 of file Target.h.

References lldb_private::Target::StopHook::NoPreference.

◆ IsEnabled()

bool lldb_private::Target::Hook::IsEnabled ( )
inline

Definition at line 1702 of file Target.h.

References m_enabled.

◆ SetAutoContinue()

void lldb_private::Target::Hook::SetAutoContinue ( bool auto_continue)
inline

Definition at line 1733 of file Target.h.

References m_auto_continue.

◆ SetIsEnabled()

void lldb_private::Target::Hook::SetIsEnabled ( bool enabled)
inline

Definition at line 1703 of file Target.h.

References m_enabled.

◆ SetRunAtInitialStop()

void lldb_private::Target::Hook::SetRunAtInitialStop ( bool at_initial_stop)
inline

Definition at line 1726 of file Target.h.

References m_at_initial_stop.

◆ SetSCSpecifier()

void Target::Hook::SetSCSpecifier ( SymbolContextSpecifier * specifier)

Set the symbol context specifier. The hook takes ownership.

Definition at line 4337 of file Target.cpp.

References m_sc_specifier_sp.

◆ SetSuppressOutput()

void lldb_private::Target::Hook::SetSuppressOutput ( bool suppress_output)
inline

Definition at line 1738 of file Target.h.

References m_suppress_output.

◆ SetThreadSpecifier()

void Target::Hook::SetThreadSpecifier ( ThreadSpec * specifier)

Set the thread specifier. The hook takes ownership.

Definition at line 4341 of file Target.cpp.

References m_thread_spec_up.

Member Data Documentation

◆ m_at_initial_stop

bool lldb_private::Target::Hook::m_at_initial_stop = true
protected

Definition at line 1770 of file Target.h.

Referenced by GetRunAtInitialStop(), Hook(), and SetRunAtInitialStop().

◆ m_auto_continue

bool lldb_private::Target::Hook::m_auto_continue = false
protected

Definition at line 1773 of file Target.h.

Referenced by GetAutoContinue(), GetFilterDescription(), Hook(), and SetAutoContinue().

◆ m_enabled

bool lldb_private::Target::Hook::m_enabled = true
protected

Definition at line 1764 of file Target.h.

Referenced by GetDescription(), Hook(), IsEnabled(), and SetIsEnabled().

◆ m_kind

HookKind lldb_private::Target::Hook::m_kind
protected

Definition at line 1763 of file Target.h.

Referenced by GetHookKind(), Hook(), and Hook().

◆ m_sc_specifier_sp

lldb::SymbolContextSpecifierSP lldb_private::Target::Hook::m_sc_specifier_sp
protected

Definition at line 1768 of file Target.h.

Referenced by GetFilterDescription(), GetSCSpecifier(), Hook(), and SetSCSpecifier().

◆ m_suppress_output

bool lldb_private::Target::Hook::m_suppress_output = false
protected

Definition at line 1774 of file Target.h.

Referenced by GetSuppressOutput(), Hook(), and SetSuppressOutput().

◆ m_target_sp

lldb::TargetSP lldb_private::Target::Hook::m_target_sp
protected

Definition at line 1762 of file Target.h.

Referenced by GetTarget(), Hook(), and Hook().

◆ m_thread_spec_up

std::unique_ptr<ThreadSpec> lldb_private::Target::Hook::m_thread_spec_up
protected

Definition at line 1769 of file Target.h.

Referenced by GetFilterDescription(), GetThreadSpecifier(), Hook(), and SetThreadSpecifier().

◆ m_trigger_mask


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