LLDB  mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Static Protected 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>

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
 Returns true 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]
 

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 349 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.

Definition at line 133 of file BreakpointOptions.cpp.

References eAutoContinue, eEnabled, eIgnoreCount, eOneShot, 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 lldb_private::Flags::Set().

◆ BreakpointOptions() [3/3]

BreakpointOptions::BreakpointOptions ( const BreakpointOptions rhs)

Definition at line 149 of file BreakpointOptions.cpp.

References operator=().

◆ ~BreakpointOptions()

BreakpointOptions::~BreakpointOptions ( )
virtualdefault

Referenced by CopyOverSetOptions().

Member Function Documentation

◆ AnySet()

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

Definition at line 338 of file BreakpointOptions.h.

References eAllOptions.

Referenced by lldb_private::BreakpointName::GetDescription().

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

Definition at line 660 of file BreakpointOptions.cpp.

References lldb_private::Flags::Clear().

Referenced by GetIgnoreCount().

◆ ClearCallback()

void BreakpointOptions::ClearCallback ( )

Remove the callback from this option set.

Definition at line 432 of file BreakpointOptions.cpp.

References lldb_private::Flags::Clear(), eCallback, and NullCallback().

Referenced by GetSerializationKey().

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

Referenced by CommandObjectBreakpointCommandList::DoExecute(), and IsCallbackSynchronous().

◆ GetBaton() [2/2]

const Baton * BreakpointOptions::GetBaton ( ) const

Fetch a const version of the baton from the callback.

Returns
The baton.

Definition at line 442 of file BreakpointOptions.cpp.

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

Definition at line 467 of file BreakpointOptions.cpp.

References HasCallback(), and lldb_private::static_pointer_cast().

Referenced by lldb::SBBreakpointName::GetCommandLineCommands(), and GetSerializationKey().

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

Referenced by lldb::SBBreakpointName::GetCondition(), and IsCallbackSynchronous().

◆ GetDescription()

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

◆ GetIgnoreCount()

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

Return the current Ignore Count.

Returns
The number of breakpoint hits to be ignored.

Definition at line 303 of file BreakpointOptions.h.

References Clear(), GetDescription(), GetThreadSpec(), GetThreadSpecNoCreate(), HasCallback(), NullCallback(), SetCommandDataCallback(), and SetThreadID().

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

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

Referenced by GetDescription(), and GetIgnoreCount().

◆ HasCallback()

bool BreakpointOptions::HasCallback ( ) const

Returns true if the breakpoint option has a callback set.

Definition at line 463 of file BreakpointOptions.cpp.

References NullCallback().

Referenced by GetCommandLineCallbacks(), and GetIgnoreCount().

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

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

Referenced by GetSerializationKey().

◆ 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 272 of file BreakpointOptions.h.

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

◆ 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 228 of file BreakpointOptions.h.

References GetBaton(), GetConditionText(), and SetCondition().

Referenced by InvokeCallback().

◆ 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 261 of file BreakpointOptions.h.

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

◆ 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 283 of file BreakpointOptions.h.

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

◆ IsOptionSet()

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

Definition at line 344 of file BreakpointOptions.h.

◆ 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(), GetIgnoreCount(), and HasCallback().

◆ operator=()

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

Definition at line 164 of file BreakpointOptions.cpp.

Referenced by BreakpointOptions(), and GetSerializationKey().

◆ SerializeToStructuredData()

StructuredData::ObjectSP BreakpointOptions::SerializeToStructuredData ( )
virtual

◆ SetAutoContinue()

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

Set the auto-continue state.

Definition at line 275 of file BreakpointOptions.h.

References eAutoContinue.

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

◆ SetCallback() [1/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 401 of file BreakpointOptions.cpp.

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

Referenced by GetSerializationKey(), lldb_private::ScriptInterpreterPythonImpl::SetBreakpointCommandCallback(), lldb::SBBreakpointName::SetCallback(), and SetCommandDataCallback().

◆ SetCallback() [2/2]

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

Definition at line 421 of file BreakpointOptions.cpp.

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

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

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

Referenced by GetIgnoreCount(), and 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 481 of file BreakpointOptions.cpp.

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

Referenced by BreakpointOptions(), IsCallbackSynchronous(), and lldb::SBBreakpointName::SetCondition().

◆ SetEnabled()

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

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

Definition at line 264 of file BreakpointOptions.h.

References eEnabled.

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

◆ SetIgnoreCount()

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

Set the breakpoint to ignore the next count breakpoint hits.

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

Definition at line 295 of file BreakpointOptions.h.

References eIgnoreCount.

Referenced by lldb::SBBreakpointName::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 286 of file BreakpointOptions.h.

References eOneShot.

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

◆ SetThreadID()

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

◆ SetThreadSpec()

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

Definition at line 523 of file BreakpointOptions.cpp.

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

Referenced by GetKey().

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 357 of file BreakpointOptions.h.


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