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

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

#include <BreakpointOptions.h>

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.
 
 BreakpointOptions (bool all_flags_set)
 Breakpoints make options with all flags set.
 
 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.
 
void SetCallback (BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous=false)
 Adds a callback to the breakpoint option set.
 
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.
 
void ClearCallback ()
 Remove the callback from this option set.
 
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.
 
bool IsCallbackSynchronous () const
 Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
 
BatonGetBaton ()
 Fetch the baton from the callback.
 
const BatonGetBaton () const
 Fetch a const version of the baton from the callback.
 
void SetCondition (const char *condition)
 Set the breakpoint option's condition.
 
const char * GetConditionText (size_t *hash=nullptr) const
 Return a pointer to the text of the condition expression.
 
bool IsEnabled () const
 Check the Enable/Disable state.
 
void SetEnabled (bool enabled)
 If enable is true, enable the breakpoint, if false disable it.
 
bool IsAutoContinue () const
 Check the auto-continue state.
 
void SetAutoContinue (bool auto_continue)
 Set the auto-continue state.
 
bool IsOneShot () const
 Check the One-shot state.
 
void SetOneShot (bool one_shot)
 If enable is true, enable the breakpoint, if false disable it.
 
void SetIgnoreCount (uint32_t n)
 Set the breakpoint to ignore the next count breakpoint hits.
 
uint32_t GetIgnoreCount () const
 Return the current Ignore Count.
 
const ThreadSpecGetThreadSpecNoCreate () const
 Return the current thread spec for this option.
 
ThreadSpecGetThreadSpec ()
 Returns a pointer to the ThreadSpec for this option, creating it.
 
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.
 
void SetCommandDataCallback (std::unique_ptr< CommandData > &cmd_data)
 Set a callback based on BreakpointOptions::CommandData.
 
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.
 

Protected Types

enum class  OptionNames {
  ConditionText = 0 , IgnoreCount , EnabledState , OneShotState ,
  AutoContinue , 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.
 
lldb::BatonSP m_callback_baton_sp
 This is the client data for the callback.
 
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.
 
uint32_t m_ignore_count
 Number of times to ignore this breakpoint.
 
std::unique_ptr< ThreadSpecm_thread_spec_up
 Thread for which this breakpoint will stop.
 
std::string m_condition_text
 The condition to test.
 
size_t m_condition_text_hash
 Its hash, so that locations know when the condition is updated.
 
bool m_inject_condition
 If set, inject breakpoint condition into process.
 
bool m_auto_continue
 If set, auto-continue from breakpoint.
 
Flags m_set_flags
 Which options are set at this level.
 

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 93 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 356 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 123 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 113 of file BreakpointOptions.cpp.

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

◆ BreakpointOptions() [3/3]

BreakpointOptions::BreakpointOptions ( const BreakpointOptions rhs)

Definition at line 137 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 345 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]

Baton * BreakpointOptions::GetBaton ( )

Fetch the baton from the callback.

Returns
The baton.

Definition at line 430 of file BreakpointOptions.cpp.

References m_callback_baton_sp.

Referenced by CommandObjectBreakpointCommandList::DoExecute().

◆ GetBaton() [2/2]

const Baton * BreakpointOptions::GetBaton ( ) const

Fetch a const version of the baton from the callback.

Returns
The baton.

Definition at line 432 of file BreakpointOptions.cpp.

References m_callback_baton_sp.

◆ 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
true if the command callback is a command-line callback, false otherwise.

Definition at line 455 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 482 of file BreakpointOptions.cpp.

References m_condition_text, and m_condition_text_hash.

Referenced by lldb::SBBreakpointName::GetCondition(), lldb_private::Breakpoint::GetConditionText(), and lldb_private::BreakpointLocation::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

◆ 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 493 of file BreakpointOptions.cpp.

References m_thread_spec_up.

Referenced by lldb_private::BreakpointLocation::Dump(), GetDescription(), lldb_private::Breakpoint::GetQueueName(), lldb_private::BreakpointLocation::GetQueueName(), lldb_private::BreakpointLocation::GetThreadID(), lldb_private::Breakpoint::GetThreadID(), lldb_private::Breakpoint::GetThreadIndex(), lldb_private::BreakpointLocation::GetThreadIndex(), lldb_private::Breakpoint::GetThreadName(), and lldb_private::BreakpointLocation::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 451 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 436 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 277 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 233 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 266 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 288 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 351 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 105 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 391 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_private::BreakpointLocation::SetCallback(), lldb_private::Breakpoint::SetCallback(), lldb::SBBreakpointName::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 599 of file BreakpointOptions.cpp.

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

Referenced by lldb_private::BreakpointOptionGroup::OptionParsingFinished(), and lldb::SBBreakpointName::SetCommandLineCommands().

◆ SetCondition()

void BreakpointOptions::SetCondition ( const char *  condition)

◆ SetEnabled()

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

◆ SetIgnoreCount()

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

◆ SetOneShot()

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

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

Definition at line 291 of file BreakpointOptions.h.

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

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

◆ 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 364 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 399 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 380 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 395 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 389 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 397 of file BreakpointOptions.h.

Referenced by operator=().

◆ m_one_shot

bool lldb_private::BreakpointOptions::m_one_shot
private

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

Definition at line 387 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: