LLDB mainline
|
Class that manages the actual breakpoint that will be inserted into the running program. More...
#include "lldb/Breakpoint/BreakpointSite.h"
Public Types | |
enum | Type { eSoftware , eHardware , eExternal } |
Public Member Functions | |
~BreakpointSite () override | |
uint8_t * | GetTrapOpcodeBytes () |
Returns the Opcode Bytes for this breakpoint. | |
const uint8_t * | GetTrapOpcodeBytes () const |
Returns the Opcode Bytes for this breakpoint - const version. | |
size_t | GetTrapOpcodeMaxByteSize () const |
Get the size of the trap opcode for this address. | |
bool | SetTrapOpcode (const uint8_t *trap_opcode, uint32_t trap_opcode_size) |
Sets the trap opcode. | |
uint8_t * | GetSavedOpcodeBytes () |
Gets the original instruction bytes that were overwritten by the trap. | |
const uint8_t * | GetSavedOpcodeBytes () const |
Gets the original instruction bytes that were overwritten by the trap const version. | |
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. | |
bool | IsEnabled () const |
Tells whether the current breakpoint site is enabled or not. | |
void | SetEnabled (bool enabled) |
Sets whether the current breakpoint site is enabled or not. | |
bool | ShouldStop (StoppointCallbackContext *context) override |
Enquires of the breakpoint locations that produced this breakpoint site whether we should stop at this location. | |
void | Dump (Stream *s) const override |
Standard Dump method. | |
void | AddOwner (const lldb::BreakpointLocationSP &owner) |
The "Owners" are the breakpoint locations that share this breakpoint site. | |
size_t | GetNumberOfOwners () |
This method returns the number of breakpoint locations currently located at this breakpoint site. | |
lldb::BreakpointLocationSP | GetOwnerAtIndex (size_t idx) |
This method returns the breakpoint location at index index located at this breakpoint site. | |
size_t | CopyOwnersList (BreakpointLocationCollection &out_collection) |
This method copies the breakpoint site's owners into a new collection. | |
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. | |
void | GetDescription (Stream *s, lldb::DescriptionLevel level) |
Print a description of this breakpoint site to the stream s. | |
bool | IsBreakpointAtThisSite (lldb::break_id_t bp_id) |
Tell whether a breakpoint has a location at this site. | |
bool | IsInternal () const |
Tell whether ALL the breakpoints in the location collection are internal. | |
bool | IsHardware () const override |
BreakpointSite::Type | GetType () const |
void | SetType (BreakpointSite::Type type) |
![]() | |
StoppointSite (lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware) | |
StoppointSite (lldb::break_id_t bid, lldb::addr_t m_addr, uint32_t byte_size, bool hardware) | |
virtual | ~StoppointSite ()=default |
virtual lldb::addr_t | GetLoadAddress () const |
virtual void | SetLoadAddress (lldb::addr_t addr) |
uint32_t | GetByteSize () const |
uint32_t | GetHitCount () const |
void | ResetHitCount () |
bool | HardwareRequired () const |
virtual bool | IsHardware () const =0 |
uint32_t | GetHardwareIndex () const |
void | SetHardwareIndex (uint32_t index) |
virtual bool | ShouldStop (StoppointCallbackContext *context)=0 |
virtual void | Dump (Stream *stream) const =0 |
lldb::break_id_t | GetID () const |
Private Member Functions | |
void | BumpHitCounts () |
size_t | RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) |
The method removes the owner at break_loc_id from this breakpoint list. | |
BreakpointSite (BreakpointSiteList *list, const lldb::BreakpointLocationSP &owner, lldb::addr_t m_addr, bool use_hardware) | |
BreakpointSite (const BreakpointSite &)=delete | |
const BreakpointSite & | operator= (const BreakpointSite &)=delete |
Static Private Member Functions | |
static lldb::break_id_t | GetNextID () |
Private Attributes | |
BreakpointSite::Type | m_type |
The type of this breakpoint site. | |
uint8_t | m_saved_opcode [8] |
The saved opcode bytes if this breakpoint site uses trap opcodes. | |
uint8_t | m_trap_opcode [8] |
The opcode that was used to create the breakpoint if it is a software breakpoint site. | |
bool | m_enabled |
Boolean indicating if this breakpoint site enabled or not. | |
BreakpointLocationCollection | m_owners |
This has the BreakpointLocations that share this breakpoint site. | |
std::recursive_mutex | m_owners_mutex |
This mutex protects the owners collection. | |
Friends | |
class | Process |
class | BreakpointLocation |
class | StopInfoBreakpoint |
Additional Inherited Members | |
![]() | |
lldb::break_id_t | m_id |
Stoppoint site ID. | |
lldb::addr_t | m_addr |
The load address of this stop point. | |
bool | m_is_hardware_required |
True if this point is required to use hardware (which may fail due to the lack of resources). | |
uint32_t | m_hardware_index |
The hardware resource index for this breakpoint/watchpoint. | |
uint32_t | m_byte_size |
The size in bytes of stoppoint, e.g. | |
StoppointHitCounter | m_hit_counter |
Number of times this breakpoint/watchpoint has been hit. | |
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.
Enumerator | |
---|---|
eSoftware | |
eHardware | |
eExternal |
Definition at line 38 of file BreakpointSite.h.
|
override |
Definition at line 34 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::GetByIndex(), lldb_private::BreakpointLocationCollection::GetSize(), and m_owners.
|
private |
|
privatedelete |
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.
[in] | owner | owner is the Breakpoint Location to add. |
Definition at line 125 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::Add(), m_owners, and m_owners_mutex.
|
private |
Definition at line 152 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::BreakpointLocations(), m_owners, and m_owners_mutex.
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.
[out] | out_collection | The BreakpointLocationCollection into which to put the owners of this breakpoint site. |
Definition at line 202 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::Add(), lldb_private::BreakpointLocationCollection::BreakpointLocations(), lldb_private::BreakpointLocationCollection::GetSize(), m_owners, and m_owners_mutex.
|
overridevirtual |
Standard Dump method.
Implements lldb_private::StoppointSite.
Definition at line 74 of file BreakpointSite.cpp.
References lldb_private::StoppointSite::GetHardwareIndex(), lldb_private::StoppointSite::GetHitCount(), lldb_private::StoppointSite::GetID(), IsHardware(), lldb_private::StoppointSite::m_addr, and lldb_private::Stream::Printf().
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.
[in] | s | The stream to which to print the description. |
[in] | level | The description level that indicates the detail level to provide. |
Definition at line 84 of file BreakpointSite.cpp.
References lldb::eDescriptionLevelBrief, lldb_private::BreakpointLocationCollection::GetDescription(), lldb_private::StoppointSite::GetID(), lldb_private::StoppointSite::GetLoadAddress(), m_owners, m_owners_mutex, and lldb_private::Stream::Printf().
|
staticprivate |
Definition at line 42 of file BreakpointSite.cpp.
size_t BreakpointSite::GetNumberOfOwners | ( | ) |
This method returns the number of breakpoint locations currently located at this breakpoint site.
Definition at line 137 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::GetSize(), m_owners, and m_owners_mutex.
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
[in] | idx | The index in the list of owners for which you wish the owner location. |
Definition at line 142 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::GetByIndex(), m_owners, and m_owners_mutex.
Referenced by lldb_private::Platform::GetSoftwareBreakpointTrapOpcode(), and lldb_private::PlatformDarwin::GetSoftwareBreakpointTrapOpcode().
uint8_t * BreakpointSite::GetSavedOpcodeBytes | ( | ) |
Gets the original instruction bytes that were overwritten by the trap.
Definition at line 115 of file BreakpointSite.cpp.
References m_saved_opcode.
Referenced by lldb_private::Process::DisableSoftwareBreakpoint(), lldb_private::Process::EnableSoftwareBreakpoint(), and lldb_private::Process::WriteMemory().
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.
References m_saved_opcode.
uint8_t * BreakpointSite::GetTrapOpcodeBytes | ( | ) |
Returns the Opcode Bytes for this breakpoint.
Definition at line 94 of file BreakpointSite.cpp.
References m_trap_opcode.
Referenced by lldb_private::Process::DisableSoftwareBreakpoint(), and lldb_private::Process::EnableSoftwareBreakpoint().
const uint8_t * BreakpointSite::GetTrapOpcodeBytes | ( | ) | const |
Returns the Opcode Bytes for this breakpoint - const version.
Definition at line 96 of file BreakpointSite.cpp.
References m_trap_opcode.
size_t BreakpointSite::GetTrapOpcodeMaxByteSize | ( | ) | const |
Get the size of the trap opcode for this address.
Definition at line 100 of file BreakpointSite.cpp.
References m_trap_opcode.
|
inline |
Definition at line 192 of file BreakpointSite.h.
References m_type.
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::DidForkSwitchHardwareTraps(), lldb_private::process_gdb_remote::ProcessGDBRemote::DidForkSwitchSoftwareBreakpoints(), lldb_private::process_gdb_remote::ProcessGDBRemote::DisableBreakpointSite(), ProcessKDP::DisableBreakpointSite(), IntersectsRange(), IsHardware(), lldb_private::Process::RemoveBreakpointOpcodesFromBuffer(), and lldb_private::Process::WriteMemory().
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.
References eSoftware, GetType(), lldbassert, lldb_private::StoppointSite::m_addr, and lldb_private::StoppointSite::m_byte_size.
Referenced by lldb_private::Process::WriteMemory().
bool BreakpointSite::IsBreakpointAtThisSite | ( | lldb::break_id_t | bp_id | ) |
Tell whether a breakpoint has a location at this site.
[in] | bp_id | The breakpoint id to query. |
Definition at line 64 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::GetByIndex(), lldb_private::BreakpointLocationCollection::GetSize(), m_owners, and m_owners_mutex.
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.
References m_enabled.
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::DidForkSwitchHardwareTraps(), lldb_private::process_gdb_remote::ProcessGDBRemote::DidForkSwitchSoftwareBreakpoints(), lldb_private::process_gdb_remote::ProcessGDBRemote::DisableBreakpointSite(), ProcessKDP::DisableBreakpointSite(), lldb_private::Process::DisableSoftwareBreakpoint(), lldb_private::process_gdb_remote::ProcessGDBRemote::EnableBreakpointSite(), lldb_private::ScriptedProcess::EnableBreakpointSite(), ProcessKDP::EnableBreakpointSite(), and lldb_private::Process::EnableSoftwareBreakpoint().
|
inlineoverridevirtual |
Implements lldb_private::StoppointSite.
Definition at line 186 of file BreakpointSite.h.
References eHardware, GetType(), lldb_private::StoppointSite::HardwareRequired(), and lldbassert.
Referenced by lldb_private::Process::DisableSoftwareBreakpoint(), and Dump().
bool BreakpointSite::IsInternal | ( | ) | const |
Tell whether ALL the breakpoints in the location collection are internal.
Definition at line 92 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::IsInternal(), and m_owners.
|
privatedelete |
|
private |
The method removes the owner at break_loc_id from this breakpoint list.
Definition at line 130 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::GetSize(), m_owners, m_owners_mutex, and lldb_private::BreakpointLocationCollection::Remove().
void BreakpointSite::SetEnabled | ( | bool | enabled | ) |
Sets whether the current breakpoint site is enabled or not.
[in] | enabled | true if the breakpoint is enabled, false otherwise. |
Definition at line 123 of file BreakpointSite.cpp.
References m_enabled.
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::DisableBreakpointSite(), ProcessKDP::DisableBreakpointSite(), lldb_private::Process::DisableSoftwareBreakpoint(), lldb_private::process_gdb_remote::ProcessGDBRemote::EnableBreakpointSite(), ProcessKDP::EnableBreakpointSite(), and lldb_private::Process::EnableSoftwareBreakpoint().
bool BreakpointSite::SetTrapOpcode | ( | const uint8_t * | trap_opcode, |
uint32_t | trap_opcode_size | ||
) |
Sets the trap opcode.
Definition at line 104 of file BreakpointSite.cpp.
References lldb_private::StoppointSite::m_byte_size, and m_trap_opcode.
Referenced by lldb_private::Platform::GetSoftwareBreakpointTrapOpcode(), lldb_private::PlatformDarwin::GetSoftwareBreakpointTrapOpcode(), and lldb_private::PlatformWindows::GetSoftwareBreakpointTrapOpcode().
|
inline |
Definition at line 194 of file BreakpointSite.h.
References m_type.
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::EnableBreakpointSite(), ProcessKDP::EnableBreakpointSite(), and lldb_private::Process::EnableSoftwareBreakpoint().
|
overridevirtual |
Enquires of the breakpoint locations that produced this breakpoint site whether we should stop at this location.
[in] | context | This contains the information about this stop. |
Implements lldb_private::StoppointSite.
Definition at line 50 of file BreakpointSite.cpp.
References lldb_private::StoppointHitCounter::Increment(), lldb_private::StoppointSite::m_hit_counter, m_owners, m_owners_mutex, and lldb_private::BreakpointLocationCollection::ShouldStop().
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.
[in] | thread | The 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.
References m_owners, m_owners_mutex, and lldb_private::BreakpointLocationCollection::ValidForThisThread().
|
friend |
Definition at line 198 of file BreakpointSite.h.
|
friend |
Definition at line 197 of file BreakpointSite.h.
|
friend |
Definition at line 202 of file BreakpointSite.h.
|
private |
Boolean indicating if this breakpoint site enabled or not.
Definition at line 216 of file BreakpointSite.h.
Referenced by IsEnabled(), and SetEnabled().
|
private |
This has the BreakpointLocations that share this breakpoint site.
Definition at line 220 of file BreakpointSite.h.
Referenced by AddOwner(), BumpHitCounts(), CopyOwnersList(), GetDescription(), GetNumberOfOwners(), GetOwnerAtIndex(), IsBreakpointAtThisSite(), IsInternal(), RemoveOwner(), ShouldStop(), ValidForThisThread(), and ~BreakpointSite().
|
private |
This mutex protects the owners collection.
Definition at line 223 of file BreakpointSite.h.
Referenced by AddOwner(), BumpHitCounts(), CopyOwnersList(), GetDescription(), GetNumberOfOwners(), GetOwnerAtIndex(), IsBreakpointAtThisSite(), RemoveOwner(), ShouldStop(), and ValidForThisThread().
|
private |
The saved opcode bytes if this breakpoint site uses trap opcodes.
Definition at line 211 of file BreakpointSite.h.
Referenced by GetSavedOpcodeBytes().
|
private |
The opcode that was used to create the breakpoint if it is a software breakpoint site.
Definition at line 213 of file BreakpointSite.h.
Referenced by GetTrapOpcodeBytes(), GetTrapOpcodeMaxByteSize(), and SetTrapOpcode().
|
private |
The type of this breakpoint site.
Definition at line 210 of file BreakpointSite.h.