LLDB  mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | Private Attributes | Friends | List of all members
lldb_private::BreakpointOptions Class Reference

#include <BreakpointOptions.h>

Collaboration diagram for lldb_private::BreakpointOptions:
Collaboration graph
[legend]

Classes

class  CommandBaton
 
struct  CommandData
 

Public Types

enum  OptionKind {
  eCallback = 1 << 0, eEnabled = 1 << 1, eOneShot = 1 << 2, eIgnoreCount = 1 << 3,
  eThreadSpec = 1 << 4, eCondition = 1 << 5, eAutoContinue = 1 << 6, eAllOptions
}
 
typedef std::shared_ptr< CommandBatonCommandBatonSP
 

Public Member Functions

 BreakpointOptions (const char *condition, bool enabled=true, int32_t ignore=0, bool one_shot=false, bool auto_continue=false)
 This constructor allows you to specify all the breakpoint options except the callback. More...
 
 BreakpointOptions (bool all_flags_set)
 Breakpoints make options with all flags set. More...
 
 BreakpointOptions (const BreakpointOptions &rhs)
 
virtual ~BreakpointOptions ()
 
virtual StructuredData::ObjectSP SerializeToStructuredData ()
 
const BreakpointOptionsoperator= (const BreakpointOptions &rhs)
 
void CopyOverSetOptions (const BreakpointOptions &rhs)
 Copy over only the options set in the incoming BreakpointOptions. More...
 
void SetCallback (BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous=false)
 Adds a callback to the breakpoint option set. More...
 
void SetCallback (BreakpointHitCallback callback, const BreakpointOptions::CommandBatonSP &command_baton_sp, bool synchronous=false)
 
bool GetCommandLineCallbacks (StringList &command_list)
 Returns the command line commands for the callback on this breakpoint. More...
 
void ClearCallback ()
 Remove the callback from this option set. More...
 
bool InvokeCallback (StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
 Use this function to invoke the callback for a specific stop. More...
 
bool IsCallbackSynchronous () const
 Used in InvokeCallback to tell whether it is the right time to run this kind of callback. More...
 
BatonGetBaton ()
 Fetch the baton from the callback. More...
 
const BatonGetBaton () const
 Fetch a const version of the baton from the callback. More...
 
void SetCondition (const char *condition)
 Set the breakpoint option's condition. More...
 
const char * GetConditionText (size_t *hash=nullptr) const
 Return a pointer to the text of the condition expression. More...
 
bool IsEnabled () const
 Check the Enable/Disable state. More...
 
void SetEnabled (bool enabled)
 If enable is true, enable the breakpoint, if false disable it. More...
 
bool IsAutoContinue () const
 Check the auto-continue state. More...
 
void SetAutoContinue (bool auto_continue)
 Set the auto-continue state. More...
 
bool IsOneShot () const
 Check the One-shot state. More...
 
void SetOneShot (bool one_shot)
 If enable is true, enable the breakpoint, if false disable it. More...
 
void SetIgnoreCount (uint32_t n)
 Set the breakpoint to ignore the next count breakpoint hits. More...
 
uint32_t GetIgnoreCount () const
 Return the current Ignore Count. More...
 
const ThreadSpecGetThreadSpecNoCreate () const
 Return the current thread spec for this option. More...
 
ThreadSpecGetThreadSpec ()
 Returns a pointer to the ThreadSpec for this option, creating it. More...
 
void SetThreadID (lldb::tid_t thread_id)
 
void GetDescription (Stream *s, lldb::DescriptionLevel level) const
 
bool HasCallback () const
 Check if the breakpoint option has a callback set. More...
 
void SetCommandDataCallback (std::unique_ptr< CommandData > &cmd_data)
 Set a callback based on BreakpointOptions::CommandData. More...
 
void Clear ()
 
bool AnySet () const
 

Static Public Member Functions

static std::unique_ptr< BreakpointOptionsCreateFromStructuredData (Target &target, const StructuredData::Dictionary &data_dict, Status &error)
 
static const char * GetSerializationKey ()
 
static bool NullCallback (void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
 This is the default empty callback. More...
 

Protected Types

enum  OptionNames {
  OptionNames::ConditionText = 0, OptionNames::IgnoreCount, OptionNames::EnabledState, OptionNames::OneShotState,
  OptionNames::AutoContinue, OptionNames::LastOptionName
}
 

Protected Member Functions

bool IsOptionSet (OptionKind kind)
 
void SetThreadSpec (std::unique_ptr< ThreadSpec > &thread_spec_up)
 

Static Protected Member Functions

static const char * GetKey (OptionNames enum_value)
 
static bool BreakpointOptionsCallbackFunction (void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
 

Static Protected Attributes

static const char * g_option_names [(size_t) OptionNames::LastOptionName]
 

Private Attributes

BreakpointHitCallback m_callback
 For BreakpointOptions only. More...
 
lldb::BatonSP m_callback_baton_sp
 This is the client data for the callback. More...
 
bool m_baton_is_command_baton
 
bool m_callback_is_synchronous
 
bool m_enabled
 
bool m_one_shot
 If set, the breakpoint delete itself after being hit once. More...
 
uint32_t m_ignore_count
 Number of times to ignore this breakpoint. More...
 
std::unique_ptr< ThreadSpecm_thread_spec_up
 Thread for which this breakpoint will stop. More...
 
std::string m_condition_text
 The condition to test. More...
 
size_t m_condition_text_hash
 Its hash, so that locations know when the condition is updated. More...
 
bool m_inject_condition
 If set, inject breakpoint condition into process. More...
 
bool m_auto_continue
 If set, auto-continue from breakpoint. More...
 
Flags m_set_flags
 Which options are set at this level. More...
 

Friends

class BreakpointLocation
 
class BreakpointName
 
class lldb_private::BreakpointOptionGroup
 
class Breakpoint
 

Detailed Description

"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint location.

Definition at line 27 of file BreakpointOptions.h.

Member Typedef Documentation

◆ CommandBatonSP

Definition at line 94 of file BreakpointOptions.h.

Member Enumeration Documentation

◆ OptionKind

Enumerator
eCallback 
eEnabled 
eOneShot 
eIgnoreCount 
eThreadSpec 
eCondition 
eAutoContinue 
eAllOptions 

Definition at line 34 of file BreakpointOptions.h.

◆ OptionNames

Enumerator
ConditionText 
IgnoreCount 
EnabledState 
OneShotState 
AutoContinue 
LastOptionName 

Definition at line 357 of file BreakpointOptions.h.

Constructor & Destructor Documentation

◆ BreakpointOptions() [1/3]

BreakpointOptions::BreakpointOptions ( const char *  condition,
bool  enabled = true,
int32_t  ignore = 0,
bool  one_shot = false,
bool  auto_continue = false 
)

This constructor allows you to specify all the breakpoint options except the callback.

That one is more complicated, and better to do by hand.

Parameters
[in]conditionThe expression which if it evaluates to true if we are to stop
[in]enabledIs this breakpoint enabled.
[in]ignoreHow many breakpoint hits we should ignore before stopping.
[in]one_shotShould this breakpoint delete itself after being hit once.
[in]auto_continueShould this breakpoint auto-continue after running its commands.

Definition at line 133 of file BreakpointOptions.cpp.

References eAutoContinue, eEnabled, eIgnoreCount, eOneShot, m_set_flags, lldb_private::Flags::Set(), and SetCondition().

◆ BreakpointOptions() [2/3]

BreakpointOptions::BreakpointOptions ( bool  all_flags_set)

Breakpoints make options with all flags set.

Locations and Names make options with no flags set.

Definition at line 123 of file BreakpointOptions.cpp.

References m_set_flags, and lldb_private::Flags::Set().

◆ BreakpointOptions() [3/3]

BreakpointOptions::BreakpointOptions ( const BreakpointOptions rhs)

Definition at line 149 of file BreakpointOptions.cpp.

References m_condition_text, m_condition_text_hash, and m_thread_spec_up.

◆ ~BreakpointOptions()

BreakpointOptions::~BreakpointOptions ( )
virtualdefault

Member Function Documentation

◆ AnySet()

bool lldb_private::BreakpointOptions::AnySet ( ) const
inline

Definition at line 346 of file BreakpointOptions.h.

References lldb_private::Flags::AnySet(), eAllOptions, and m_set_flags.

◆ BreakpointOptionsCallbackFunction()

bool BreakpointOptions::BreakpointOptionsCallbackFunction ( void *  baton,
StoppointCallbackContext context,
lldb::user_id_t  break_id,
lldb::user_id_t  break_loc_id 
)
staticprotected

◆ Clear()

void BreakpointOptions::Clear ( )

◆ ClearCallback()

void BreakpointOptions::ClearCallback ( )

◆ CopyOverSetOptions()

void BreakpointOptions::CopyOverSetOptions ( const BreakpointOptions rhs)

◆ CreateFromStructuredData()

std::unique_ptr< BreakpointOptions > BreakpointOptions::CreateFromStructuredData ( Target target,
const StructuredData::Dictionary data_dict,
Status error 
)
static

◆ GetBaton() [1/2]

const Baton * BreakpointOptions::GetBaton ( )

Fetch the baton from the callback.

Returns
The baton.

Definition at line 441 of file BreakpointOptions.cpp.

References m_callback_baton_sp.

Referenced by CommandObjectBreakpointCommandList::DoExecute().

◆ GetBaton() [2/2]

const Baton* lldb_private::BreakpointOptions::GetBaton ( ) const

Fetch a const version of the baton from the callback.

Returns
The baton.

◆ GetCommandLineCallbacks()

bool BreakpointOptions::GetCommandLineCallbacks ( StringList command_list)

Returns the command line commands for the callback on this breakpoint.

Parameters
[out]command_listThe commands will be appended to this list.
Returns
\btrue if the command callback is a command-line callback, \bfalse otherwise.

Definition at line 466 of file BreakpointOptions.cpp.

References HasCallback(), m_baton_is_command_baton, m_callback_baton_sp, and lldb_private::BreakpointOptions::CommandData::user_source.

Referenced by lldb::SBBreakpointName::GetCommandLineCommands().

◆ GetConditionText()

const char * BreakpointOptions::GetConditionText ( size_t *  hash = nullptr) const

Return a pointer to the text of the condition expression.

Returns
A pointer to the condition expression text, or nullptr if no

Definition at line 493 of file BreakpointOptions.cpp.

References m_condition_text, and m_condition_text_hash.

Referenced by lldb::SBBreakpointName::GetCondition(), lldb_private::BreakpointLocation::GetConditionText(), and lldb_private::Breakpoint::GetConditionText().

◆ GetDescription()

void BreakpointOptions::GetDescription ( Stream s,
lldb::DescriptionLevel  level 
) const

◆ GetIgnoreCount()

uint32_t lldb_private::BreakpointOptions::GetIgnoreCount ( ) const
inline

◆ GetKey()

static const char* lldb_private::BreakpointOptions::GetKey ( OptionNames  enum_value)
inlinestaticprotected

Definition at line 367 of file BreakpointOptions.h.

References g_option_names.

Referenced by CreateFromStructuredData(), and SerializeToStructuredData().

◆ GetSerializationKey()

static const char* lldb_private::BreakpointOptions::GetSerializationKey ( )
inlinestatic

◆ GetThreadSpec()

ThreadSpec * BreakpointOptions::GetThreadSpec ( )

◆ GetThreadSpecNoCreate()

const ThreadSpec * BreakpointOptions::GetThreadSpecNoCreate ( ) const

Return the current thread spec for this option.

This will return nullptr if the no thread specifications have been set for this Option yet.

Returns
The thread specification pointer for this option, or nullptr if none has been set yet.

Definition at line 504 of file BreakpointOptions.cpp.

References m_thread_spec_up.

Referenced by lldb_private::BreakpointLocation::Dump(), GetDescription(), lldb_private::BreakpointLocation::GetQueueName(), lldb_private::Breakpoint::GetQueueName(), lldb_private::BreakpointLocation::GetThreadID(), lldb_private::Breakpoint::GetThreadID(), lldb_private::BreakpointLocation::GetThreadIndex(), lldb_private::Breakpoint::GetThreadIndex(), lldb_private::BreakpointLocation::GetThreadName(), and lldb_private::Breakpoint::GetThreadName().

◆ HasCallback()

bool BreakpointOptions::HasCallback ( ) const

Check if the breakpoint option has a callback set.

Returns
If the breakpoint option has a callback, true otherwise false.

Definition at line 462 of file BreakpointOptions.cpp.

References m_callback, and NullCallback().

Referenced by GetCommandLineCallbacks().

◆ InvokeCallback()

bool BreakpointOptions::InvokeCallback ( StoppointCallbackContext context,
lldb::user_id_t  break_id,
lldb::user_id_t  break_loc_id 
)

Use this function to invoke the callback for a specific stop.

Parameters
[in]contextThe context in which the callback is to be invoked. This includes the stop event, the execution context of the stop (since you might hit the same breakpoint on multiple threads) and whether we are currently executing synchronous or asynchronous callbacks.
[in]break_idThe breakpoint ID that owns this option set.
[in]break_loc_idThe breakpoint location ID that owns this option set.
Returns
The callback return value.

Definition at line 447 of file BreakpointOptions.cpp.

References lldb_private::StoppointCallbackContext::is_synchronous, IsCallbackSynchronous(), m_callback, and m_callback_baton_sp.

Referenced by lldb_private::Breakpoint::InvokeCallback().

◆ IsAutoContinue()

bool lldb_private::BreakpointOptions::IsAutoContinue ( ) const
inline

Check the auto-continue state.

Returns
true if the breakpoint is set to auto-continue, false otherwise.

Definition at line 278 of file BreakpointOptions.h.

References m_auto_continue.

Referenced by lldb::SBBreakpointName::GetAutoContinue(), and lldb_private::Breakpoint::IsAutoContinue().

◆ IsCallbackSynchronous()

bool lldb_private::BreakpointOptions::IsCallbackSynchronous ( ) const
inline

Used in InvokeCallback to tell whether it is the right time to run this kind of callback.

Returns
The synchronicity of our callback.

Definition at line 234 of file BreakpointOptions.h.

References m_callback_is_synchronous.

Referenced by InvokeCallback(), and lldb_private::BreakpointLocation::IsCallbackSynchronous().

◆ IsEnabled()

bool lldb_private::BreakpointOptions::IsEnabled ( ) const
inline

Check the Enable/Disable state.

Returns
true if the breakpoint is enabled, false if disabled.

Definition at line 267 of file BreakpointOptions.h.

References m_enabled.

Referenced by lldb::SBBreakpointName::IsEnabled(), lldb_private::Breakpoint::IsEnabled(), and lldb_private::Breakpoint::SetEnabled().

◆ IsOneShot()

bool lldb_private::BreakpointOptions::IsOneShot ( ) const
inline

Check the One-shot state.

Returns
true if the breakpoint is one-shot, false otherwise.

Definition at line 289 of file BreakpointOptions.h.

References m_one_shot.

Referenced by lldb::SBBreakpointName::IsOneShot(), and lldb_private::Breakpoint::IsOneShot().

◆ IsOptionSet()

bool lldb_private::BreakpointOptions::IsOptionSet ( OptionKind  kind)
inlineprotected

Definition at line 352 of file BreakpointOptions.h.

References m_set_flags, and lldb_private::Flags::Test().

◆ NullCallback()

bool BreakpointOptions::NullCallback ( void *  baton,
StoppointCallbackContext context,
lldb::user_id_t  break_id,
lldb::user_id_t  break_loc_id 
)
static

This is the default empty callback.

Definition at line 115 of file BreakpointOptions.cpp.

Referenced by ClearCallback(), and HasCallback().

◆ operator=()

const BreakpointOptions & BreakpointOptions::operator= ( const BreakpointOptions rhs)

◆ SerializeToStructuredData()

StructuredData::ObjectSP BreakpointOptions::SerializeToStructuredData ( )
virtual

◆ SetAutoContinue()

void lldb_private::BreakpointOptions::SetAutoContinue ( bool  auto_continue)
inline

◆ SetCallback() [1/2]

void BreakpointOptions::SetCallback ( BreakpointHitCallback  callback,
const BreakpointOptions::CommandBatonSP command_baton_sp,
bool  synchronous = false 
)

◆ SetCallback() [2/2]

void BreakpointOptions::SetCallback ( BreakpointHitCallback  callback,
const lldb::BatonSP &  baton_sp,
bool  synchronous = false 
)

Adds a callback to the breakpoint option set.

Parameters
[in]callbackThe function to be called when the breakpoint gets hit.
[in]baton_spA baton which will get passed back to the callback when it is invoked.
[in]synchronousWhether this is a synchronous or asynchronous callback. See discussion above.

Definition at line 402 of file BreakpointOptions.cpp.

References eCallback, m_baton_is_command_baton, m_callback, m_callback_baton_sp, m_callback_is_synchronous, m_set_flags, and lldb_private::Flags::Set().

Referenced by lldb_private::ScriptInterpreterLua::RegisterBreakpointCallback(), lldb::SBBreakpointName::SetCallback(), lldb_private::BreakpointLocation::SetCallback(), lldb_private::Breakpoint::SetCallback(), and SetCommandDataCallback().

◆ SetCommandDataCallback()

void BreakpointOptions::SetCommandDataCallback ( std::unique_ptr< CommandData > &  cmd_data)

Set a callback based on BreakpointOptions::CommandData.

Parameters
[in]cmd_dataA UP holding the new'ed CommandData object. The breakpoint will take ownership of pointer held by this object.

Definition at line 610 of file BreakpointOptions.cpp.

References BreakpointOptionsCallbackFunction(), eCallback, lldb::eScriptLanguageNone, m_set_flags, lldb_private::Flags::Set(), and SetCallback().

Referenced by lldb::SBBreakpointName::SetCommandLineCommands().

◆ SetCondition()

void BreakpointOptions::SetCondition ( const char *  condition)

Set the breakpoint option's condition.

Parameters
[in]conditionThe condition expression to evaluate when the breakpoint is hit.

Definition at line 480 of file BreakpointOptions.cpp.

References lldb_private::Flags::Clear(), eCondition, m_condition_text, m_condition_text_hash, m_set_flags, and lldb_private::Flags::Set().

Referenced by BreakpointOptions(), lldb::SBBreakpointName::SetCondition(), lldb_private::BreakpointLocation::SetCondition(), and lldb_private::Breakpoint::SetCondition().

◆ SetEnabled()

void lldb_private::BreakpointOptions::SetEnabled ( bool  enabled)
inline

If enable is true, enable the breakpoint, if false disable it.

Definition at line 270 of file BreakpointOptions.h.

References eEnabled, m_enabled, m_set_flags, and lldb_private::Flags::Set().

Referenced by lldb::SBBreakpointName::SetEnabled(), lldb_private::BreakpointLocation::SetEnabled(), and lldb_private::Breakpoint::SetEnabled().

◆ SetIgnoreCount()

void lldb_private::BreakpointOptions::SetIgnoreCount ( uint32_t  n)
inline

Set the breakpoint to ignore the next count breakpoint hits.

Parameters
[in]nThe number of breakpoint hits to ignore.

Definition at line 300 of file BreakpointOptions.h.

References eIgnoreCount, m_ignore_count, m_set_flags, and lldb_private::Flags::Set().

Referenced by lldb_private::Breakpoint::DecrementIgnoreCount(), lldb::SBBreakpointName::SetIgnoreCount(), lldb_private::BreakpointLocation::SetIgnoreCount(), and lldb_private::Breakpoint::SetIgnoreCount().

◆ SetOneShot()

void lldb_private::BreakpointOptions::SetOneShot ( bool  one_shot)
inline

If enable is true, enable the breakpoint, if false disable it.

Definition at line 292 of file BreakpointOptions.h.

References eOneShot, m_one_shot, m_set_flags, and lldb_private::Flags::Set().

Referenced by lldb::SBBreakpointName::SetOneShot(), and lldb_private::Breakpoint::SetOneShot().

◆ SetThreadID()

void BreakpointOptions::SetThreadID ( lldb::tid_t  thread_id)

◆ SetThreadSpec()

void BreakpointOptions::SetThreadSpec ( std::unique_ptr< ThreadSpec > &  thread_spec_up)
protected

Friends And Related Function Documentation

◆ Breakpoint

friend class Breakpoint
friend

Definition at line 31 of file BreakpointOptions.h.

◆ BreakpointLocation

friend class BreakpointLocation
friend

Definition at line 28 of file BreakpointOptions.h.

◆ BreakpointName

friend class BreakpointName
friend

Definition at line 29 of file BreakpointOptions.h.

◆ lldb_private::BreakpointOptionGroup

Definition at line 30 of file BreakpointOptions.h.

Member Data Documentation

◆ g_option_names

const char * BreakpointOptions::g_option_names
staticprotected
Initial value:
{
"ConditionText", "IgnoreCount",
"EnabledState", "OneShotState", "AutoContinue"}

Definition at line 365 of file BreakpointOptions.h.

Referenced by GetKey().

◆ m_auto_continue

bool lldb_private::BreakpointOptions::m_auto_continue
private

If set, auto-continue from breakpoint.

Definition at line 400 of file BreakpointOptions.h.

Referenced by Clear(), CopyOverSetOptions(), GetDescription(), IsAutoContinue(), operator=(), SerializeToStructuredData(), and SetAutoContinue().

◆ m_baton_is_command_baton

bool lldb_private::BreakpointOptions::m_baton_is_command_baton
private

◆ m_callback

BreakpointHitCallback lldb_private::BreakpointOptions::m_callback
private

For BreakpointOptions only.

This is the callback function pointer

Definition at line 381 of file BreakpointOptions.h.

Referenced by Clear(), ClearCallback(), CopyOverSetOptions(), HasCallback(), InvokeCallback(), operator=(), and SetCallback().

◆ m_callback_baton_sp

lldb::BatonSP lldb_private::BreakpointOptions::m_callback_baton_sp
private

◆ m_callback_is_synchronous

bool lldb_private::BreakpointOptions::m_callback_is_synchronous
private

◆ m_condition_text

std::string lldb_private::BreakpointOptions::m_condition_text
private

◆ m_condition_text_hash

size_t lldb_private::BreakpointOptions::m_condition_text_hash
private

Its hash, so that locations know when the condition is updated.

Definition at line 396 of file BreakpointOptions.h.

Referenced by BreakpointOptions(), CopyOverSetOptions(), GetConditionText(), operator=(), and SetCondition().

◆ m_enabled

bool lldb_private::BreakpointOptions::m_enabled
private

◆ m_ignore_count

uint32_t lldb_private::BreakpointOptions::m_ignore_count
private

Number of times to ignore this breakpoint.

Definition at line 390 of file BreakpointOptions.h.

Referenced by Clear(), CopyOverSetOptions(), GetDescription(), GetIgnoreCount(), operator=(), SerializeToStructuredData(), and SetIgnoreCount().

◆ m_inject_condition

bool lldb_private::BreakpointOptions::m_inject_condition
private

If set, inject breakpoint condition into process.

Definition at line 398 of file BreakpointOptions.h.

◆ m_one_shot

bool lldb_private::BreakpointOptions::m_one_shot
private

If set, the breakpoint delete itself after being hit once.

Definition at line 388 of file BreakpointOptions.h.

Referenced by Clear(), CopyOverSetOptions(), GetDescription(), IsOneShot(), operator=(), SerializeToStructuredData(), and SetOneShot().

◆ m_set_flags

Flags lldb_private::BreakpointOptions::m_set_flags
private

◆ m_thread_spec_up

std::unique_ptr<ThreadSpec> lldb_private::BreakpointOptions::m_thread_spec_up
private

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