LLDB mainline
lldb_private::Breakpoint Class Reference

General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locations that have been determined for the filter/resolver pair, and finally a set of options for the breakpoint. More...

#include "lldb/Breakpoint/Breakpoint.h"

Inheritance diagram for lldb_private::Breakpoint:
[legend]

Classes

class  BreakpointEventData

Public Types

enum  MatchType { Exact , Regexp , Glob }
 An enum specifying the match style for breakpoint settings. More...

Public Member Functions

virtual StructuredData::ObjectSP SerializeToStructuredData ()
 ~Breakpoint () override
 Destructor.
bool IsInternal () const
 Tell whether this breakpoint is an "internal" breakpoint.
void Dump (Stream *s) override
 Standard "Dump" method. At present it does nothing.
void ClearAllBreakpointSites ()
 Tell this breakpoint to clear all its breakpoint sites.
void ResolveBreakpoint ()
 Tell this breakpoint to scan it's target's module list and resolve any new locations that match the breakpoint's specifications.
void ResolveBreakpointInModules (ModuleList &module_list, bool send_event=true)
 Tell this breakpoint to scan a given module list and resolve any new locations that match the breakpoint's specifications.
void ResolveBreakpointInModules (ModuleList &module_list, BreakpointLocationCollection &new_locations)
 Tell this breakpoint to scan a given module list and resolve any new locations that match the breakpoint's specifications.
void ModulesChanged (ModuleList &changed_modules, bool load_event, bool delete_locations=false)
 Like ResolveBreakpointInModules, but allows for "unload" events, in which case we will remove any locations that are in modules that got unloaded.
void ModuleReplaced (lldb::ModuleSP old_module_sp, lldb::ModuleSP new_module_sp)
 Tells the breakpoint the old module old_module_sp has been replaced by new_module_sp (usually because the underlying file has been rebuilt, and the old version is gone.)
lldb::BreakpointLocationSP AddLocation (const Address &addr, bool *new_location=nullptr)
 Add a location to the breakpoint's location list.
lldb::BreakpointLocationSP AddFacadeLocation ()
 Add a facade location to the breakpoint's collection of facade locations.
lldb::BreakpointLocationSP GetFacadeLocationByID (lldb::break_id_t)
lldb::BreakpointLocationSP FindLocationByAddress (const Address &addr)
 Find a breakpoint location by Address.
lldb::break_id_t FindLocationIDByAddress (const Address &addr)
 Find a breakpoint location ID by Address.
lldb::BreakpointLocationSP FindLocationByID (lldb::break_id_t bp_loc_id, bool use_facade=true)
 Find a breakpoint location for a given breakpoint location ID.
lldb::BreakpointLocationSP GetLocationAtIndex (size_t index, bool use_facade=true)
 Get breakpoint locations by index.
void RemoveInvalidLocations (const ArchSpec &arch)
 Removes all invalid breakpoint locations.
void SetEnabled (bool enable) override
 If enable is true, enable the breakpoint, if false disable it.
bool IsEnabled () override
 Check the Enable/Disable state.
void SetIgnoreCount (uint32_t count)
 Set the breakpoint to ignore the next count breakpoint hits.
uint32_t GetIgnoreCount () const
 Return the current ignore count/.
uint32_t GetHitCount () const
 Return the current hit count for all locations.
void ResetHitCount ()
 Resets the current hit count for all locations.
void SetOneShot (bool one_shot)
 If one_shot is true, breakpoint will be deleted on first hit.
bool IsOneShot () const
 Check the OneShot state.
void SetAutoContinue (bool auto_continue)
 If auto_continue is true, breakpoint will auto-continue when on hit.
bool IsAutoContinue () const
 Check the AutoContinue state.
void SetThreadID (lldb::tid_t thread_id)
 Set the valid thread to be checked when the breakpoint is hit.
lldb::tid_t GetThreadID () const
 Return the current stop thread value.
void SetThreadIndex (uint32_t index)
uint32_t GetThreadIndex () const
void SetThreadName (const char *thread_name)
const char * GetThreadName () const
void SetQueueName (const char *queue_name)
const char * GetQueueName () const
void SetCallback (BreakpointHitCallback callback, void *baton, bool is_synchronous=false)
 Set the callback action invoked when the breakpoint is hit.
void SetCallback (BreakpointHitCallback callback, const lldb::BatonSP &callback_baton_sp, bool is_synchronous=false)
void ClearCallback ()
void SetCondition (StopCondition condition)
 Set the breakpoint's condition.
const StopConditionGetCondition () const
 Return the breakpoint condition.
size_t GetNumResolvedLocations (bool use_facade=true) const
 Return the number of breakpoint locations that have resolved to actual breakpoint sites.
bool HasResolvedLocations () const
 Return whether this breakpoint has any resolved locations.
size_t GetNumLocations (bool use_facade=true) const
 Return the number of breakpoint locations.
void GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations=false)
 Put a description of this breakpoint into the stream s.
void SetBreakpointKind (const char *kind)
 Set the "kind" description for a breakpoint.
const char * GetBreakpointKind () const
 Return the "kind" description for a breakpoint.
TargetGetTarget ()
 Accessor for the breakpoint Target.
const TargetGetTarget () const
const lldb::TargetSP GetTargetSP ()
void GetResolverDescription (Stream *s)
bool GetMatchingFileLine (ConstString filename, uint32_t line_number, BreakpointLocationCollection &loc_coll)
 Find breakpoint locations which match the (filename, line_number) description.
void GetFilterDescription (Stream *s)
BreakpointOptionsGetOptions ()
 Returns the BreakpointOptions structure set at the breakpoint level.
const BreakpointOptionsGetOptions () const
 Returns the BreakpointOptions structure set at the breakpoint level.
bool InvokeCallback (StoppointCallbackContext *context, lldb::break_id_t bp_loc_id)
 Invoke the callback action when the breakpoint is hit.
bool IsHardware () const
llvm::Error SetIsHardware (bool is_hardware)
lldb::BreakpointResolverSP GetResolver ()
lldb::SearchFilterSP GetSearchFilter ()
bool MatchesName (const char *name)
void GetNames (std::vector< std::string > &names)
void SetPrecondition (lldb::BreakpointPreconditionSP precondition_sp)
 Set a pre-condition filter that overrides all user provided filters/callbacks etc.
bool EvaluatePrecondition (StoppointCallbackContext &context)
lldb::BreakpointPreconditionSP GetPrecondition ()
const BreakpointName::PermissionsGetPermissions () const
BreakpointName::PermissionsGetPermissions ()
bool AllowList () const
bool AllowDisable () const
bool AllowDelete () const
llvm::json::Value GetStatistics ()
 Get statistics associated with this breakpoint in JSON format.
void ResetStatistics ()
StatsDuration::Duration GetResolveTime () const
 Get the time it took to resolve all locations in this breakpoint.
Public Member Functions inherited from lldb_private::Stoppoint
 Stoppoint ()
virtual ~Stoppoint ()
lldb::break_id_t GetID () const
void SetID (lldb::break_id_t bid)

Static Public Member Functions

static const char * BreakpointEventTypeAsCString (lldb::BreakpointEventType type)
static lldb::BreakpointSP CreateFromStructuredData (lldb::TargetSP target_sp, StructuredData::ObjectSP &data_object_sp, Status &error)
static bool SerializedBreakpointMatchesNames (StructuredData::ObjectSP &bkpt_object_sp, std::vector< std::string > &names)
static const char * GetSerializationKey ()
static lldb::BreakpointSP CopyFromBreakpoint (lldb::TargetSP new_target, const Breakpoint &bp_to_copy_from)

Protected Member Functions

 Breakpoint (Target &target, lldb::SearchFilterSP &filter_sp, lldb::BreakpointResolverSP &resolver_sp, bool hardware, bool resolve_indirect_symbols=true)
 Constructors and Destructors Only the Target can make a breakpoint, and it owns the breakpoint lifespans.
void DecrementIgnoreCount ()

Private Types

enum class  OptionNames : uint32_t { Names = 0 , Hardware , LastOptionName }
enum  DisplayType { eDisplayFacade = 1 , eDisplayReal = 1 << 1 , eDisplayHeader = 1 << 2 }
 This controls whether to display information about the facade locations or the real locations. More...

Private Member Functions

void AddName (llvm::StringRef new_name)
void RemoveName (const char *name_to_remove)
void GetDescriptionForType (Stream *s, lldb::DescriptionLevel level, uint8_t display_type, bool show_locations)
bool HasFacadeLocations ()
 Breakpoint (Target &new_target, const Breakpoint &bp_to_copy_from)
void SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind)
void SendBreakpointChangedEvent (const lldb::EventDataSP &breakpoint_data_sp)
 Breakpoint (const Breakpoint &)=delete
const Breakpointoperator= (const Breakpoint &)=delete

Static Private Member Functions

static const char * GetKey (OptionNames enum_value)

Private Attributes

bool m_hardware
Targetm_target
std::unordered_set< std::string > m_name_list
lldb::SearchFilterSP m_filter_sp
lldb::BreakpointResolverSP m_resolver_sp
lldb::BreakpointPreconditionSP m_precondition_sp
BreakpointOptions m_options
BreakpointLocationList m_locations
BreakpointLocationCollection m_facade_locations
std::string m_kind_description
bool m_resolve_indirect_symbols
StoppointHitCounter m_hit_counter
 Number of times this breakpoint has been hit.
BreakpointName::Permissions m_permissions
StatsDuration m_resolve_time

Static Private Attributes

static const char * g_option_names [static_cast< uint32_t >(OptionNames::LastOptionName)] {"Names", "Hardware"}

Friends

class Target
class BreakpointLocation

Additional Inherited Members

Protected Attributes inherited from lldb_private::Stoppoint
lldb::break_id_t m_bid = LLDB_INVALID_BREAK_ID

Detailed Description

General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locations that have been determined for the filter/resolver pair, and finally a set of options for the breakpoint.

Class that manages logical breakpoint setting.

Filter: This is an object derived from SearchFilter. It manages the search for breakpoint location matches through the symbols in the module list of the target that owns it. It also filters out locations based on whatever logic it wants.

Resolver: This is an object derived from BreakpointResolver. It provides a callback to the filter that will find breakpoint locations. How it does this is determined by what kind of resolver it is.

The Breakpoint class also provides constructors for the common breakpoint cases which make the appropriate filter and resolver for you.

Location List: This stores the breakpoint locations that have been determined to date. For a given breakpoint, there will be only one location with a given address. Adding a location at an already taken address will just return the location already at that address. Locations can be looked up by ID, or by address.

Options: This includes: Enabled/Disabled Ignore Count Callback Condition Note, these options can be set on the breakpoint, and they can also be set on the individual locations. The options set on the breakpoint take precedence over the options set on the individual location. So for instance disabling the breakpoint will cause NONE of the locations to get hit. But if the breakpoint is enabled, then the location's enabled state will be checked to determine whether to insert that breakpoint location. Similarly, if the breakpoint condition says "stop", we won't check the location's condition. But if the breakpoint condition says "continue", then we will check the location for whether to actually stop or not. One subtle point worth observing here is that you don't actually stop at a Breakpoint, you always stop at one of its locations. So the "should stop" tests are done by the location, not by the breakpoint.

Definition at line 80 of file Breakpoint.h.

Member Enumeration Documentation

◆ DisplayType

This controls whether to display information about the facade locations or the real locations.

Enumerator
eDisplayFacade 
eDisplayReal 
eDisplayHeader 

Definition at line 568 of file Breakpoint.h.

◆ MatchType

An enum specifying the match style for breakpoint settings.

At present only used for function name style breakpoints.

Enumerator
Exact 
Regexp 
Glob 

Definition at line 88 of file Breakpoint.h.

◆ OptionNames

enum class lldb_private::Breakpoint::OptionNames : uint32_t
strongprivate
Enumerator
Names 
Hardware 
LastOptionName 

Definition at line 91 of file Breakpoint.h.

Constructor & Destructor Documentation

◆ ~Breakpoint()

Breakpoint::~Breakpoint ( )
override

Destructor.

The destructor is not virtual since there should be no reason to subclass breakpoints. The varieties of breakpoints are specified instead by providing different resolvers & filters.

Definition at line 61 of file Breakpoint.cpp.

References m_facade_locations, and m_locations.

◆ Breakpoint() [1/3]

Breakpoint::Breakpoint ( Target & target,
lldb::SearchFilterSP & filter_sp,
lldb::BreakpointResolverSP & resolver_sp,
bool hardware,
bool resolve_indirect_symbols = true )
protected

Constructors and Destructors Only the Target can make a breakpoint, and it owns the breakpoint lifespans.

The constructor takes a filter and a resolver. Up in Target there are convenience variants that make breakpoints for some common cases.

Parameters
[in]targetThe target in which the breakpoint will be set.
[in]filter_spShared pointer to the search filter that restricts the search domain of the breakpoint.
[in]resolver_spShared pointer to the resolver object that will determine breakpoint matches.
hardwareIf true, request a hardware breakpoint to be used to implement the breakpoint locations.
resolve_indirect_symbolsIf true, and the address of a given breakpoint location in this breakpoint is set on an indirect symbol (i.e. Symbol::IsIndirect returns true) then the actual breakpoint site will be set on the target of the indirect symbol.

Definition at line 46 of file Breakpoint.cpp.

References m_filter_sp, m_hardware, m_hit_counter, m_locations, m_options, m_resolve_indirect_symbols, m_resolver_sp, m_target, and Target.

Referenced by Breakpoint(), Breakpoint(), BreakpointLocation, CopyFromBreakpoint(), and operator=().

◆ Breakpoint() [2/3]

Breakpoint::Breakpoint ( Target & new_target,
const Breakpoint & bp_to_copy_from )
private

◆ Breakpoint() [3/3]

lldb_private::Breakpoint::Breakpoint ( const Breakpoint & )
privatedelete

References Breakpoint().

Member Function Documentation

◆ AddFacadeLocation()

BreakpointLocationSP Breakpoint::AddFacadeLocation ( )

Add a facade location to the breakpoint's collection of facade locations.

This is only meant to be called by the breakpoint's resolver. Facade locations are placeholders that a scripted breakpoint can use to represent the stop locations provided by the breakpoint. The scripted breakpoint should record the id of the facade location, and provide the description of the location in the GetDescription method To emulate hitting a facade location, the breakpoint's WasHit should return the ID of the facade that was "hit".

Parameters
[out]new_locationSet to true if a new location was created, to false if there already was a location at this Address.
Returns
Returns a pointer to the new location.

Definition at line 311 of file Breakpoint.cpp.

References m_facade_locations.

◆ AddLocation()

BreakpointLocationSP Breakpoint::AddLocation ( const Address & addr,
bool * new_location = nullptr )

Add a location to the breakpoint's location list.

This is only meant to be called by the breakpoint's resolver. FIXME: how do I ensure that?

Parameters
[in]addrThe Address specifying the new location.
[out]new_locationSet to true if a new location was created, to false if there already was a location at this Address.
Returns
Returns a pointer to the new location.

Definition at line 305 of file Breakpoint.cpp.

References m_locations, and m_resolve_indirect_symbols.

◆ AddName()

void Breakpoint::AddName ( llvm::StringRef new_name)
private

Definition at line 920 of file Breakpoint.cpp.

References m_name_list.

◆ AllowDelete()

bool lldb_private::Breakpoint::AllowDelete ( ) const
inline

◆ AllowDisable()

bool lldb_private::Breakpoint::AllowDisable ( ) const
inline

◆ AllowList()

bool lldb_private::Breakpoint::AllowList ( ) const
inline

◆ BreakpointEventTypeAsCString()

const char * Breakpoint::BreakpointEventTypeAsCString ( lldb::BreakpointEventType type)
static

◆ ClearAllBreakpointSites()

void Breakpoint::ClearAllBreakpointSites ( )

Tell this breakpoint to clear all its breakpoint sites.

Done when the process holding the breakpoint sites is destroyed.

Definition at line 546 of file Breakpoint.cpp.

References m_locations.

◆ ClearCallback()

void Breakpoint::ClearCallback ( )

Definition at line 498 of file Breakpoint.cpp.

References m_options.

Referenced by CommandObjectBreakpointCommandDelete::DoExecute().

◆ CopyFromBreakpoint()

BreakpointSP Breakpoint::CopyFromBreakpoint ( lldb::TargetSP new_target,
const Breakpoint & bp_to_copy_from )
static

Definition at line 69 of file Breakpoint.cpp.

References Breakpoint(), m_filter_sp, and m_resolver_sp.

Referenced by lldb_private::Target::PrimeFromDummyTarget().

◆ CreateFromStructuredData()

◆ DecrementIgnoreCount()

void Breakpoint::DecrementIgnoreCount ( )
protected

Definition at line 385 of file Breakpoint.cpp.

References m_options.

◆ Dump()

void Breakpoint::Dump ( Stream * s)
overridevirtual

Standard "Dump" method. At present it does nothing.

Implements lldb_private::Stoppoint.

Definition at line 893 of file Breakpoint.cpp.

Referenced by lldb_private::ThreadPlanRunToAddress::GetDescription(), and GetDescriptionForType().

◆ EvaluatePrecondition()

bool Breakpoint::EvaluatePrecondition ( StoppointCallbackContext & context)

Definition at line 1093 of file Breakpoint.cpp.

References m_precondition_sp.

◆ FindLocationByAddress()

BreakpointLocationSP Breakpoint::FindLocationByAddress ( const Address & addr)

Find a breakpoint location by Address.

Parameters
[in]addrThe Address specifying the location.
Returns
Returns a shared pointer to the location at addr. The pointer in the shared pointer will be nullptr if there is no location at that address.

Definition at line 325 of file Breakpoint.cpp.

References m_locations.

◆ FindLocationByID()

BreakpointLocationSP Breakpoint::FindLocationByID ( lldb::break_id_t bp_loc_id,
bool use_facade = true )

Find a breakpoint location for a given breakpoint location ID.

If there are Facade Locations in the breakpoint, the facade locations will be searched instead of the "real" ones.

Parameters
[in]bp_loc_idThe ID specifying the location.
[in]use_facadeIf true, then prefer facade locations over "real" ones if they exist.
Returns
Returns a shared pointer to the location with ID bp_loc_id. The pointer in the shared pointer will be nullptr if there is no location with that ID.

Definition at line 333 of file Breakpoint.cpp.

References GetFacadeLocationByID(), m_facade_locations, and m_locations.

Referenced by CommandObjectBreakpointCommandDelete::DoExecute(), CommandObjectBreakpointCommandList::DoExecute(), CommandObjectBreakpointDelete::DoExecute(), CommandObjectBreakpointEnable::DoExecute(), CommandObjectBreakpointModify::DoExecute(), and lldb_private::CommandObjectMultiwordBreakpoint::VerifyIDs().

◆ FindLocationIDByAddress()

break_id_t Breakpoint::FindLocationIDByAddress ( const Address & addr)

Find a breakpoint location ID by Address.

Parameters
[in]addrThe Address specifying the location.
Returns
Returns the UID of the location at addr, or LLDB_INVALID_ID if there is no breakpoint location at that address.

Definition at line 329 of file Breakpoint.cpp.

References m_locations.

◆ GetBreakpointKind()

const char * lldb_private::Breakpoint::GetBreakpointKind ( ) const
inline

Return the "kind" description for a breakpoint.

Returns
The breakpoint kind, or nullptr if none is set.

Definition at line 488 of file Breakpoint.h.

References m_kind_description.

Referenced by GetDescription(), and lldb_private::TargetStats::ToJSON().

◆ GetCondition()

const StopCondition & Breakpoint::GetCondition ( ) const

Return the breakpoint condition.

Definition at line 475 of file Breakpoint.cpp.

References m_options.

◆ GetDescription()

void Breakpoint::GetDescription ( Stream * s,
lldb::DescriptionLevel level,
bool show_locations = false )

◆ GetDescriptionForType()

◆ GetFacadeLocationByID()

BreakpointLocationSP Breakpoint::GetFacadeLocationByID ( lldb::break_id_t loc_id)

Definition at line 321 of file Breakpoint.cpp.

References m_facade_locations.

Referenced by FindLocationByID().

◆ GetFilterDescription()

void Breakpoint::GetFilterDescription ( Stream * s)

Definition at line 1089 of file Breakpoint.cpp.

References m_filter_sp.

Referenced by GetDescriptionForType().

◆ GetHitCount()

uint32_t Breakpoint::GetHitCount ( ) const

Return the current hit count for all locations.

Returns
The current hit count for all locations.

Definition at line 395 of file Breakpoint.cpp.

References m_hit_counter.

Referenced by GetDescriptionForType(), GetStatistics(), and lldb_private::TargetStats::ToJSON().

◆ GetIgnoreCount()

uint32_t Breakpoint::GetIgnoreCount ( ) const

Return the current ignore count/.

Returns
The number of breakpoint hits to be ignored.

Definition at line 391 of file Breakpoint.cpp.

References m_options.

Referenced by lldb_private::BreakpointLocation::IgnoreCountShouldStop().

◆ GetKey()

const char * lldb_private::Breakpoint::GetKey ( OptionNames enum_value)
inlinestaticprivate

◆ GetLocationAtIndex()

BreakpointLocationSP Breakpoint::GetLocationAtIndex ( size_t index,
bool use_facade = true )

Get breakpoint locations by index.

Parameters
[in]indexThe location index.
[in]use_facadeIf true, then prefer facade locations over "real" ones if they exist.
Returns
Returns a shared pointer to the location with index index. The shared pointer might contain nullptr if index is greater than then number of actual locations.

Definition at line 340 of file Breakpoint.cpp.

References m_facade_locations, and m_locations.

Referenced by lldb_private::BreakpointIDList::FindAndReplaceIDRanges(), GetDescriptionForType(), and lldb_private::BreakpointResolverAddress::SearchCallback().

◆ GetMatchingFileLine()

bool Breakpoint::GetMatchingFileLine ( ConstString filename,
uint32_t line_number,
BreakpointLocationCollection & loc_coll )

Find breakpoint locations which match the (filename, line_number) description.

The breakpoint location collection is to be filled with the matching locations. It should be initialized with 0 size by the API client.

Returns
True if there is a match

The locations which match the filename and line_number in loc_coll. If its size is 0 and true is returned, it means the breakpoint fully matches the description.

Definition at line 1067 of file Breakpoint.cpp.

References lldb_private::FileSpec::GetFilename(), lldb_private::SourceLocationSpec::GetFileSpec(), lldb_private::SourceLocationSpec::GetLine(), lldb_private::BreakpointResolverFileLine::m_location_spec, and m_resolver_sp.

Referenced by CommandObjectBreakpointClear::DoExecute().

◆ GetNames()

void lldb_private::Breakpoint::GetNames ( std::vector< std::string > & names)
inline

Definition at line 584 of file Breakpoint.h.

References m_name_list.

◆ GetNumLocations()

size_t Breakpoint::GetNumLocations ( bool use_facade = true) const

Return the number of breakpoint locations.

Parameters
[in]use_facadeIf true, then prefer facade locations over "real" ones if they exist.
Returns
The number breakpoint locations.

Definition at line 911 of file Breakpoint.cpp.

References m_facade_locations, and m_locations.

Referenced by lldb_private::BreakpointIDList::FindAndReplaceIDRanges(), GetDescriptionForType(), GetStatistics(), and lldb_private::BreakpointResolverAddress::SearchCallback().

◆ GetNumResolvedLocations()

size_t Breakpoint::GetNumResolvedLocations ( bool use_facade = true) const

Return the number of breakpoint locations that have resolved to actual breakpoint sites.

Parameters
[in]use_facadeIf true, then prefer facade locations over "real" ones if they exist.
Returns
The number locations resolved breakpoint sites.

Definition at line 895 of file Breakpoint.cpp.

References m_facade_locations, and m_locations.

Referenced by GetDescriptionForType(), GetStatistics(), and HasResolvedLocations().

◆ GetOptions() [1/2]

BreakpointOptions & Breakpoint::GetOptions ( )

Returns the BreakpointOptions structure set at the breakpoint level.

Meant to be used by the BreakpointLocation class.

Returns
A reference to this breakpoint's BreakpointOptions.

Definition at line 505 of file Breakpoint.cpp.

References m_options.

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

◆ GetOptions() [2/2]

const BreakpointOptions & Breakpoint::GetOptions ( ) const

Returns the BreakpointOptions structure set at the breakpoint level.

Meant to be used by the BreakpointLocation class.

Returns
A reference to this breakpoint's BreakpointOptions.

Definition at line 507 of file Breakpoint.cpp.

References m_options.

◆ GetPermissions() [1/2]

BreakpointName::Permissions & lldb_private::Breakpoint::GetPermissions ( )
inline

Definition at line 614 of file Breakpoint.h.

References m_permissions.

◆ GetPermissions() [2/2]

const BreakpointName::Permissions & lldb_private::Breakpoint::GetPermissions ( ) const
inline

Definition at line 610 of file Breakpoint.h.

References m_permissions.

Referenced by AllowDelete(), AllowDisable(), and AllowList().

◆ GetPrecondition()

lldb::BreakpointPreconditionSP lldb_private::Breakpoint::GetPrecondition ( )
inline

Definition at line 607 of file Breakpoint.h.

References m_precondition_sp.

◆ GetQueueName()

const char * Breakpoint::GetQueueName ( ) const

Definition at line 464 of file Breakpoint.cpp.

References m_options.

◆ GetResolver()

lldb::BreakpointResolverSP lldb_private::Breakpoint::GetResolver ( )
inline

◆ GetResolverDescription()

void Breakpoint::GetResolverDescription ( Stream * s)

Definition at line 1062 of file Breakpoint.cpp.

References m_resolver_sp.

Referenced by GetDescriptionForType().

◆ GetResolveTime()

StatsDuration::Duration lldb_private::Breakpoint::GetResolveTime ( ) const
inline

Get the time it took to resolve all locations in this breakpoint.

Definition at line 639 of file Breakpoint.h.

References m_resolve_time.

Referenced by lldb_private::TargetStats::ToJSON().

◆ GetSearchFilter()

lldb::SearchFilterSP lldb_private::Breakpoint::GetSearchFilter ( )
inline

Definition at line 556 of file Breakpoint.h.

References m_filter_sp.

◆ GetSerializationKey()

const char * lldb_private::Breakpoint::GetSerializationKey ( )
inlinestatic

◆ GetStatistics()

json::Value Breakpoint::GetStatistics ( )

◆ GetTarget() [1/2]

◆ GetTarget() [2/2]

const Target & lldb_private::Breakpoint::GetTarget ( ) const
inline

Definition at line 495 of file Breakpoint.h.

References m_target, and Target.

◆ GetTargetSP()

const lldb::TargetSP Breakpoint::GetTargetSP ( )

Definition at line 253 of file Breakpoint.cpp.

References m_target.

◆ GetThreadID()

lldb::tid_t Breakpoint::GetThreadID ( ) const

Return the current stop thread value.

Returns
The thread id for which the breakpoint hit will stop, LLDB_INVALID_THREAD_ID for all threads.

Definition at line 420 of file Breakpoint.cpp.

References LLDB_INVALID_THREAD_ID, and m_options.

◆ GetThreadIndex()

uint32_t Breakpoint::GetThreadIndex ( ) const

Definition at line 434 of file Breakpoint.cpp.

References m_options.

◆ GetThreadName()

const char * Breakpoint::GetThreadName ( ) const

Definition at line 449 of file Breakpoint.cpp.

References m_options.

◆ HasFacadeLocations()

bool lldb_private::Breakpoint::HasFacadeLocations ( )
inlineprivate

Definition at line 577 of file Breakpoint.h.

References m_facade_locations.

Referenced by GetDescription().

◆ HasResolvedLocations()

bool Breakpoint::HasResolvedLocations ( ) const

◆ InvokeCallback()

bool Breakpoint::InvokeCallback ( StoppointCallbackContext * context,
lldb::break_id_t bp_loc_id )

Invoke the callback action when the breakpoint is hit.

Meant to be used by the BreakpointLocation class.

Parameters
[in]contextDescribed the breakpoint event.
[in]bp_loc_idWhich breakpoint location hit this breakpoint.
Returns
true if the target should stop at this breakpoint and false not.

Definition at line 500 of file Breakpoint.cpp.

References lldb_private::Stoppoint::GetID(), and m_options.

◆ IsAutoContinue()

bool Breakpoint::IsAutoContinue ( ) const

Check the AutoContinue state.

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

Definition at line 406 of file Breakpoint.cpp.

References m_options.

◆ IsEnabled()

bool Breakpoint::IsEnabled ( )
overridevirtual

Check the Enable/Disable state.

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

Implements lldb_private::Stoppoint.

Definition at line 375 of file Breakpoint.cpp.

References m_options.

Referenced by GetDescription().

◆ IsHardware()

◆ IsInternal()

◆ IsOneShot()

bool Breakpoint::IsOneShot ( ) const

Check the OneShot state.

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

Definition at line 402 of file Breakpoint.cpp.

References m_options.

Referenced by lldb_private::StopInfoBreakpoint::StoreBPInfo().

◆ MatchesName()

bool lldb_private::Breakpoint::MatchesName ( const char * name)
inline

Definition at line 580 of file Breakpoint.h.

References m_name_list.

◆ ModuleReplaced()

void Breakpoint::ModuleReplaced ( lldb::ModuleSP old_module_sp,
lldb::ModuleSP new_module_sp )

Tells the breakpoint the old module old_module_sp has been replaced by new_module_sp (usually because the underlying file has been rebuilt, and the old version is gone.)

Parameters
[in]old_module_spThe old module that is going away.
[in]new_module_spThe new module that is replacing it.

Definition at line 712 of file Breakpoint.cpp.

References lldb_private::BreakpointLocationCollection::Add(), lldb_private::ModuleList::Append(), lldb_private::BreakpointLocationCollection::BreakpointLocations(), lldb_private::Breakpoints, lldb_private::BreakpointLocationCollection::FindByIDPair(), lldb_private::BreakpointLocationCollection::GetByIndex(), lldb_private::Stoppoint::GetID(), lldb_private::GetLog(), lldb_private::BreakpointLocationCollection::GetSize(), IsInternal(), LLDB_LOGF, m_locations, ResolveBreakpointInModules(), SendBreakpointChangedEvent(), and SymbolContextsMightBeEquivalent().

◆ ModulesChanged()

void Breakpoint::ModulesChanged ( ModuleList & changed_modules,
bool load_event,
bool delete_locations = false )

Like ResolveBreakpointInModules, but allows for "unload" events, in which case we will remove any locations that are in modules that got unloaded.

Parameters
[in]changed_modulesThe list of modules to look in for new locations.
[in]load_eventIf true then the modules were loaded, if false, unloaded.
[in]delete_locationsIf true then the modules were unloaded delete any locations in the changed modules.

Definition at line 552 of file Breakpoint.cpp.

References lldb_private::BreakpointLocationCollection::Add(), lldb_private::ModuleList::AppendIfNeeded(), lldb_private::Breakpoints, error(), lldb_private::BreakpointLocationCollection::GetByIndex(), lldb_private::Stoppoint::GetID(), lldb_private::GetLog(), lldb_private::Address::GetSection(), lldb_private::BreakpointLocationCollection::GetSize(), lldb_private::ModuleList::GetSize(), IsInternal(), LLDB_LOG_ERROR, LLDB_LOGF, m_filter_sp, m_locations, lldb_private::ModuleList::Modules(), ResolveBreakpointInModules(), lldb_private::Address::SectionWasDeleted(), and SendBreakpointChangedEvent().

◆ operator=()

const Breakpoint & lldb_private::Breakpoint::operator= ( const Breakpoint & )
privatedelete

References Breakpoint().

◆ RemoveInvalidLocations()

void Breakpoint::RemoveInvalidLocations ( const ArchSpec & arch)

Removes all invalid breakpoint locations.

Removes all breakpoint locations with architectures that aren't compatible with arch. Also remove any breakpoint locations with whose locations have address where the section has been deleted (module and object files no longer exist).

This is typically used after the process calls exec, or anytime the architecture of the target changes.

Parameters
[in]archIf valid, check the module in each breakpoint to make sure they are compatible, otherwise, ignore architecture.

Definition at line 347 of file Breakpoint.cpp.

References m_locations.

◆ RemoveName()

void lldb_private::Breakpoint::RemoveName ( const char * name_to_remove)
inlineprivate

Definition at line 561 of file Breakpoint.h.

References m_name_list.

◆ ResetHitCount()

void Breakpoint::ResetHitCount ( )

Resets the current hit count for all locations.

Definition at line 397 of file Breakpoint.cpp.

References m_hit_counter, and m_locations.

◆ ResetStatistics()

void Breakpoint::ResetStatistics ( )

Definition at line 1276 of file Breakpoint.cpp.

References m_resolve_time.

Referenced by lldb_private::TargetStats::Reset().

◆ ResolveBreakpoint()

void Breakpoint::ResolveBreakpoint ( )

Tell this breakpoint to scan it's target's module list and resolve any new locations that match the breakpoint's specifications.

Definition at line 509 of file Breakpoint.cpp.

References elapsed(), m_filter_sp, m_resolve_time, and m_resolver_sp.

◆ ResolveBreakpointInModules() [1/2]

void Breakpoint::ResolveBreakpointInModules ( ModuleList & module_list,
bool send_event = true )

Tell this breakpoint to scan a given module list and resolve any new locations that match the breakpoint's specifications.

Parameters
[in]module_listThe list of modules to look in for new locations.
[in]send_eventIf true, send a breakpoint location added event for non-internal breakpoints.

Definition at line 526 of file Breakpoint.cpp.

References elapsed(), IsInternal(), m_filter_sp, m_resolve_time, m_resolver_sp, ResolveBreakpointInModules(), and SendBreakpointChangedEvent().

Referenced by ModuleReplaced(), ModulesChanged(), and ResolveBreakpointInModules().

◆ ResolveBreakpointInModules() [2/2]

void Breakpoint::ResolveBreakpointInModules ( ModuleList & module_list,
BreakpointLocationCollection & new_locations )

Tell this breakpoint to scan a given module list and resolve any new locations that match the breakpoint's specifications.

Parameters
[in]module_listThe list of modules to look in for new locations.
[in]new_locationsFills new_locations with the new locations that were made.

Definition at line 516 of file Breakpoint.cpp.

References elapsed(), m_filter_sp, m_locations, m_resolve_time, and m_resolver_sp.

◆ SendBreakpointChangedEvent() [1/2]

void Breakpoint::SendBreakpointChangedEvent ( const lldb::EventDataSP & breakpoint_data_sp)
private

◆ SendBreakpointChangedEvent() [2/2]

◆ SerializedBreakpointMatchesNames()

◆ SerializeToStructuredData()

◆ SetAutoContinue()

void Breakpoint::SetAutoContinue ( bool auto_continue)

If auto_continue is true, breakpoint will auto-continue when on hit.

Definition at line 408 of file Breakpoint.cpp.

References m_options.

◆ SetBreakpointKind()

◆ SetCallback() [1/2]

void Breakpoint::SetCallback ( BreakpointHitCallback callback,
const lldb::BatonSP & callback_baton_sp,
bool is_synchronous = false )

Definition at line 492 of file Breakpoint.cpp.

References m_options.

◆ SetCallback() [2/2]

void Breakpoint::SetCallback ( BreakpointHitCallback callback,
void * baton,
bool is_synchronous = false )

Set the callback action invoked when the breakpoint is hit.

Parameters
[in]callbackThe method that will get called when the breakpoint is hit.
[in]batonA void * pointer that will get passed back to the callback function.
[in]is_synchronousIf true the callback will be run on the private event thread before the stop event gets reported. If false, the callback will get handled on the public event thread while the stop event is being pulled off the event queue. Note: synchronous callbacks cannot cause the target to run, in particular, they should not try to run the expression evaluator.

Definition at line 480 of file Breakpoint.cpp.

References m_options, and SendBreakpointChangedEvent().

Referenced by InstrumentationRuntimeASanLibsanitizers::Activate(), lldb_private::InstrumentationRuntimeASan::Activate(), lldb_private::InstrumentationRuntimeMainThreadChecker::Activate(), lldb_private::InstrumentationRuntimeTSan::Activate(), lldb_private::InstrumentationRuntimeUBSan::Activate(), DynamicLoaderPOSIXDYLD::ProbeEntry(), JITLoaderGDB::SetJITBreakpoint(), DynamicLoaderMacOS::SetNotificationBreakpoint(), DynamicLoaderMacOSXDYLD::SetNotificationBreakpoint(), DynamicLoaderDarwinKernel::SetNotificationBreakpointIfNeeded(), and DynamicLoaderHexagonDYLD::SetRendezvousBreakpoint().

◆ SetCondition()

void Breakpoint::SetCondition ( StopCondition condition)

Set the breakpoint's condition.

Parameters
[in]conditionThe condition to evaluate when the breakpoint is hit. Pass in an empty condition to clear the condition.

Definition at line 470 of file Breakpoint.cpp.

References m_options, and SendBreakpointChangedEvent().

◆ SetEnabled()

◆ SetIgnoreCount()

void Breakpoint::SetIgnoreCount ( uint32_t count)

Set the breakpoint to ignore the next count breakpoint hits.

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

Definition at line 377 of file Breakpoint.cpp.

References m_options, and SendBreakpointChangedEvent().

Referenced by CommandObjectProcessContinue::DoExecute().

◆ SetIsHardware()

llvm::Error Breakpoint::SetIsHardware ( bool is_hardware)

◆ SetOneShot()

void Breakpoint::SetOneShot ( bool one_shot)

If one_shot is true, breakpoint will be deleted on first hit.

Definition at line 404 of file Breakpoint.cpp.

References m_options.

Referenced by DynamicLoaderPOSIXDYLD::ProbeEntry().

◆ SetPrecondition()

void lldb_private::Breakpoint::SetPrecondition ( lldb::BreakpointPreconditionSP precondition_sp)
inline

Set a pre-condition filter that overrides all user provided filters/callbacks etc.

Used to define fancy breakpoints that can do dynamic hit detection without taking up the condition slot - which really belongs to the user anyway...

The Precondition should not continue the target, it should return true if the condition says to stop and false otherwise.

Definition at line 601 of file Breakpoint.h.

References m_precondition_sp.

◆ SetQueueName()

void Breakpoint::SetQueueName ( const char * queue_name)

Definition at line 455 of file Breakpoint.cpp.

References m_options, and SendBreakpointChangedEvent().

◆ SetThreadID()

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

Set the valid thread to be checked when the breakpoint is hit.

Parameters
[in]thread_idIf this thread hits the breakpoint, we stop, otherwise not.

Definition at line 412 of file Breakpoint.cpp.

References m_options, and SendBreakpointChangedEvent().

Referenced by lldb_private::ThreadPlanRunToAddress::SetInitialBreakpoints(), lldb_private::ThreadPlanStepOut::SetupReturnAddress(), lldb_private::ThreadPlanStepThrough::ThreadPlanStepThrough(), and lldb_private::ThreadPlanStepUntil::ThreadPlanStepUntil().

◆ SetThreadIndex()

void Breakpoint::SetThreadIndex ( uint32_t index)

Definition at line 426 of file Breakpoint.cpp.

References m_options, and SendBreakpointChangedEvent().

◆ SetThreadName()

void Breakpoint::SetThreadName ( const char * thread_name)

Definition at line 440 of file Breakpoint.cpp.

References m_options, and SendBreakpointChangedEvent().

◆ BreakpointLocation

friend class BreakpointLocation
friend

Definition at line 677 of file Breakpoint.h.

References Breakpoint(), BreakpointLocation, and Target.

Referenced by BreakpointLocation, and GetDescriptionForType().

◆ Target

friend class Target
friend

Member Data Documentation

◆ g_option_names

const char * Breakpoint::g_option_names {"Names", "Hardware"}
staticprivate

Definition at line 94 of file Breakpoint.h.

Referenced by GetKey().

◆ m_facade_locations

◆ m_filter_sp

◆ m_hardware

bool lldb_private::Breakpoint::m_hardware
private

◆ m_hit_counter

StoppointHitCounter lldb_private::Breakpoint::m_hit_counter
private

Number of times this breakpoint has been hit.

This is kept separately from the locations hit counts, since locations can go away when their backing library gets unloaded, and we would lose hit counts.

Definition at line 715 of file Breakpoint.h.

Referenced by Breakpoint(), Breakpoint(), GetHitCount(), and ResetHitCount().

◆ m_kind_description

std::string lldb_private::Breakpoint::m_kind_description
private

Definition at line 709 of file Breakpoint.h.

Referenced by GetBreakpointKind(), GetDescription(), GetStatistics(), and SetBreakpointKind().

◆ m_locations

◆ m_name_list

std::unordered_set<std::string> lldb_private::Breakpoint::m_name_list
private

◆ m_options

◆ m_permissions

BreakpointName::Permissions lldb_private::Breakpoint::m_permissions
private

Definition at line 717 of file Breakpoint.h.

Referenced by GetPermissions(), and GetPermissions().

◆ m_precondition_sp

lldb::BreakpointPreconditionSP lldb_private::Breakpoint::m_precondition_sp
private

◆ m_resolve_indirect_symbols

bool lldb_private::Breakpoint::m_resolve_indirect_symbols
private

Definition at line 710 of file Breakpoint.h.

Referenced by AddLocation(), Breakpoint(), and Breakpoint().

◆ m_resolve_time

StatsDuration lldb_private::Breakpoint::m_resolve_time
private

◆ m_resolver_sp

◆ m_target

Target& lldb_private::Breakpoint::m_target
private

Definition at line 689 of file Breakpoint.h.

Referenced by Breakpoint(), Breakpoint(), GetTarget(), GetTarget(), and GetTargetSP().


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