LLDB  mainline
Public Types | Public Member Functions | Friends | List of all members
lldb_private::BreakpointSite Class Reference

Class that manages the actual breakpoint that will be inserted into the running program. More...

#include "lldb/Breakpoint/BreakpointSite.h"

Inheritance diagram for lldb_private::BreakpointSite:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::BreakpointSite:
Collaboration graph
[legend]

Public Types

enum  Type { eSoftware, eHardware, eExternal }
 

Public Member Functions

 ~BreakpointSite () override
 
uint8_t * GetTrapOpcodeBytes ()
 Returns the Opcode Bytes for this breakpoint. More...
 
const uint8_t * GetTrapOpcodeBytes () const
 Returns the Opcode Bytes for this breakpoint - const version. More...
 
size_t GetTrapOpcodeMaxByteSize () const
 Get the size of the trap opcode for this address. More...
 
bool SetTrapOpcode (const uint8_t *trap_opcode, uint32_t trap_opcode_size)
 Sets the trap opcode. More...
 
uint8_t * GetSavedOpcodeBytes ()
 Gets the original instruction bytes that were overwritten by the trap. More...
 
const uint8_t * GetSavedOpcodeBytes () const
 Gets the original instruction bytes that were overwritten by the trap const version. More...
 
bool IntersectsRange (lldb::addr_t addr, size_t size, lldb::addr_t *intersect_addr, size_t *intersect_size, size_t *opcode_offset) const
 Says whether addr and size size intersects with the address intersect_addr. More...
 
bool IsEnabled () const
 Tells whether the current breakpoint site is enabled or not. More...
 
void SetEnabled (bool enabled)
 Sets whether the current breakpoint site is enabled or not. More...
 
bool ShouldStop (StoppointCallbackContext *context) override
 Enquires of the breakpoint locations that produced this breakpoint site whether we should stop at this location. More...
 
void Dump (Stream *s) const override
 Standard Dump method. More...
 
void AddOwner (const lldb::BreakpointLocationSP &owner)
 The "Owners" are the breakpoint locations that share this breakpoint site. More...
 
size_t GetNumberOfOwners ()
 This method returns the number of breakpoint locations currently located at this breakpoint site. More...
 
lldb::BreakpointLocationSP GetOwnerAtIndex (size_t idx)
 This method returns the breakpoint location at index index located at this breakpoint site. More...
 
size_t CopyOwnersList (BreakpointLocationCollection &out_collection)
 This method copies the breakpoint site's owners into a new collection. More...
 
bool ValidForThisThread (Thread *thread)
 Check whether the owners of this breakpoint site have any thread specifiers, and if yes, is thread contained in any of these specifiers. More...
 
void GetDescription (Stream *s, lldb::DescriptionLevel level)
 Print a description of this breakpoint site to the stream s. More...
 
bool IsBreakpointAtThisSite (lldb::break_id_t bp_id)
 Tell whether a breakpoint has a location at this site. More...
 
bool IsInternal () const
 Tell whether ALL the breakpoints in the location collection are internal. More...
 
BreakpointSite::Type GetType () const
 
void SetType (BreakpointSite::Type type)
 
- Public Member Functions inherited from lldb_private::StoppointLocation
 StoppointLocation (lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware)
 
 StoppointLocation (lldb::break_id_t bid, lldb::addr_t m_addr, uint32_t byte_size, bool hardware)
 
virtual ~StoppointLocation ()
 
virtual lldb::addr_t GetLoadAddress () const
 
virtual void SetLoadAddress (lldb::addr_t addr)
 
uint32_t GetByteSize () const
 
uint32_t GetHitCount () const
 
uint32_t GetHardwareIndex () const
 
bool HardwareRequired () const
 
virtual bool IsHardware () const
 
void SetHardwareIndex (uint32_t index)
 
lldb::break_id_t GetID () const
 

Friends

class Process
 
class BreakpointLocation
 
class StopInfoBreakpoint
 

Additional Inherited Members

- Protected Member Functions inherited from lldb_private::StoppointLocation
void IncrementHitCount ()
 
void DecrementHitCount ()
 
- Protected Attributes inherited from lldb_private::StoppointLocation
lldb::break_id_t m_loc_id
 
lldb::addr_t m_addr
 
bool m_hardware
 
uint32_t m_hardware_index
 
uint32_t m_byte_size
 
uint32_t m_hit_count
 

Detailed Description

Class that manages the actual breakpoint that will be inserted into the running program.

The BreakpointSite class handles the physical breakpoint that is actually inserted in the target program. As such, it is also the one that gets hit, when the program stops. It keeps a list of all BreakpointLocations that share this physical site. When the breakpoint is hit, all the locations are informed by the breakpoint site. Breakpoint sites are owned by the process.

Definition at line 35 of file BreakpointSite.h.

Member Enumeration Documentation

◆ Type

Enumerator
eSoftware 
eHardware 
eExternal 

Definition at line 38 of file BreakpointSite.h.

Constructor & Destructor Documentation

◆ ~BreakpointSite()

BreakpointSite::~BreakpointSite ( )
override

Definition at line 34 of file BreakpointSite.cpp.

Member Function Documentation

◆ AddOwner()

void BreakpointSite::AddOwner ( const lldb::BreakpointLocationSP &  owner)

The "Owners" are the breakpoint locations that share this breakpoint site.

The method adds the owner to this breakpoint site's owner list.

Parameters
[in]contextowner is the Breakpoint Location to add.

Definition at line 125 of file BreakpointSite.cpp.

◆ CopyOwnersList()

size_t BreakpointSite::CopyOwnersList ( BreakpointLocationCollection out_collection)

This method copies the breakpoint site's owners into a new collection.

It does this while the owners mutex is locked.

Parameters
[out]out_collectionThe BreakpointLocationCollection into which to put the owners of this breakpoint site.
Returns
The number of elements copied into out_collection.

Definition at line 200 of file BreakpointSite.cpp.

References lldb_private::BreakpointLocationCollection::Add(), and lldb_private::BreakpointLocationCollection::GetSize().

◆ Dump()

void BreakpointSite::Dump ( Stream s) const
overridevirtual

Standard Dump method.

Parameters
[in]contextThe stream to dump this output.

Reimplemented from lldb_private::StoppointLocation.

Definition at line 74 of file BreakpointSite.cpp.

References lldb_private::Stream::Printf().

◆ GetDescription()

void BreakpointSite::GetDescription ( Stream s,
lldb::DescriptionLevel  level 
)

Print a description of this breakpoint site to the stream s.

GetDescription tells you about the breakpoint site's owners. Use BreakpointSite::Dump(Stream *) to get information about the breakpoint site itself.

Parameters
[in]sThe stream to which to print the description.
[in]levelThe description level that indicates the detail level to provide.
See also
lldb::DescriptionLevel

Definition at line 84 of file BreakpointSite.cpp.

References lldb::eDescriptionLevelBrief, and lldb_private::Stream::Printf().

◆ GetNumberOfOwners()

size_t BreakpointSite::GetNumberOfOwners ( )

This method returns the number of breakpoint locations currently located at this breakpoint site.

Returns
The number of owners.

Definition at line 137 of file BreakpointSite.cpp.

◆ GetOwnerAtIndex()

BreakpointLocationSP BreakpointSite::GetOwnerAtIndex ( size_t  idx)

This method returns the breakpoint location at index index located at this breakpoint site.

The owners are listed ordinally from 0 to GetNumberOfOwners() - 1 so you can use this method to iterate over the owners

Parameters
[in]indexThe index in the list of owners for which you wish the owner location.
Returns
A shared pointer to the breakpoint location at that index.

Definition at line 142 of file BreakpointSite.cpp.

Referenced by PlatformDarwin::GetSoftwareBreakpointTrapOpcode(), lldb_private::platform_freebsd::PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode(), ProcessFreeBSD::GetSoftwareBreakpointTrapOpcode(), and lldb_private::Platform::GetSoftwareBreakpointTrapOpcode().

◆ GetSavedOpcodeBytes() [1/2]

uint8_t * BreakpointSite::GetSavedOpcodeBytes ( )

◆ GetSavedOpcodeBytes() [2/2]

const uint8_t * BreakpointSite::GetSavedOpcodeBytes ( ) const

Gets the original instruction bytes that were overwritten by the trap const version.

Definition at line 117 of file BreakpointSite.cpp.

◆ GetTrapOpcodeBytes() [1/2]

uint8_t * BreakpointSite::GetTrapOpcodeBytes ( )

Returns the Opcode Bytes for this breakpoint.

Definition at line 94 of file BreakpointSite.cpp.

Referenced by lldb_private::Process::DisableSoftwareBreakpoint(), and lldb_private::Process::EnableSoftwareBreakpoint().

◆ GetTrapOpcodeBytes() [2/2]

const uint8_t * BreakpointSite::GetTrapOpcodeBytes ( ) const

Returns the Opcode Bytes for this breakpoint - const version.

Definition at line 96 of file BreakpointSite.cpp.

◆ GetTrapOpcodeMaxByteSize()

size_t BreakpointSite::GetTrapOpcodeMaxByteSize ( ) const

Get the size of the trap opcode for this address.

Definition at line 100 of file BreakpointSite.cpp.

◆ GetType()

BreakpointSite::Type lldb_private::BreakpointSite::GetType ( ) const
inline

◆ IntersectsRange()

bool BreakpointSite::IntersectsRange ( lldb::addr_t  addr,
size_t  size,
lldb::addr_t intersect_addr,
size_t *  intersect_size,
size_t *  opcode_offset 
) const

Says whether addr and size size intersects with the address intersect_addr.

Definition at line 159 of file BreakpointSite.cpp.

Referenced by lldb_private::Process::RemoveBreakpointOpcodesFromBuffer(), and lldb_private::Process::WriteMemory().

◆ IsBreakpointAtThisSite()

bool BreakpointSite::IsBreakpointAtThisSite ( lldb::break_id_t  bp_id)

Tell whether a breakpoint has a location at this site.

Parameters
[in]bp_idThe breakpoint id to query.
Returns
true if bp_id has a location that is at this site, false otherwise.

Definition at line 64 of file BreakpointSite.cpp.

◆ IsEnabled()

bool BreakpointSite::IsEnabled ( ) const

Tells whether the current breakpoint site is enabled or not.

This is a low-level enable bit for the breakpoint sites. If a breakpoint site has no enabled owners, it should just get removed. This enable/disable is for the low-level target code to enable and disable breakpoint sites when single stepping, etc.

Definition at line 121 of file BreakpointSite.cpp.

Referenced by ProcessKDP::DisableBreakpointSite(), lldb_private::process_gdb_remote::ProcessGDBRemote::DisableBreakpointSite(), lldb_private::Process::DisableSoftwareBreakpoint(), ProcessKDP::EnableBreakpointSite(), lldb_private::process_gdb_remote::ProcessGDBRemote::EnableBreakpointSite(), and lldb_private::Process::EnableSoftwareBreakpoint().

◆ IsInternal()

bool BreakpointSite::IsInternal ( ) const

Tell whether ALL the breakpoints in the location collection are internal.

Returns
true if all breakpoint locations are owned by internal breakpoints, false otherwise.

Definition at line 92 of file BreakpointSite.cpp.

◆ SetEnabled()

void BreakpointSite::SetEnabled ( bool  enabled)

◆ SetTrapOpcode()

bool BreakpointSite::SetTrapOpcode ( const uint8_t *  trap_opcode,
uint32_t  trap_opcode_size 
)

◆ SetType()

void lldb_private::BreakpointSite::SetType ( BreakpointSite::Type  type)
inline

◆ ShouldStop()

bool BreakpointSite::ShouldStop ( StoppointCallbackContext context)
overridevirtual

Enquires of the breakpoint locations that produced this breakpoint site whether we should stop at this location.

Parameters
[in]contextThis contains the information about this stop.
Returns
true if we should stop, false otherwise.

Reimplemented from lldb_private::StoppointLocation.

Definition at line 50 of file BreakpointSite.cpp.

References lldb_private::BreakpointLocationCollection::ShouldStop().

◆ ValidForThisThread()

bool BreakpointSite::ValidForThisThread ( Thread thread)

Check whether the owners of this breakpoint site have any thread specifiers, and if yes, is thread contained in any of these specifiers.

Parameters
[in]threadThe thread against which to test.

return true if the collection contains at least one location that would be valid for this thread, false otherwise.

Definition at line 147 of file BreakpointSite.cpp.

Friends And Related Function Documentation

◆ BreakpointLocation

friend class BreakpointLocation
friend

Definition at line 194 of file BreakpointSite.h.

◆ Process

friend class Process
friend

Definition at line 193 of file BreakpointSite.h.

◆ StopInfoBreakpoint

friend class StopInfoBreakpoint
friend

Definition at line 198 of file BreakpointSite.h.


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