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 } |
typedef lldb::break_id_t | SiteID |
typedef lldb::break_id_t | ConstituentID |
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 | AddConstituent (const lldb::BreakpointLocationSP &constituent) |
The "Constituents" are the breakpoint locations that share this breakpoint site. | |
size_t | GetNumberOfConstituents () |
This method returns the number of breakpoint locations currently located at this breakpoint site. | |
lldb::BreakpointLocationSP | GetConstituentAtIndex (size_t idx) |
This method returns the breakpoint location at index index located at this breakpoint site. | |
size_t | CopyConstituentsList (BreakpointLocationCollection &out_collection) |
This method copies the breakpoint site's constituents into a new collection. | |
bool | ValidForThisThread (Thread &thread) |
Check whether the constituents 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) |
Public Member Functions inherited from lldb_private::StoppointSite | |
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 |
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 | RemoveConstituent (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) |
The method removes the constituent at break_loc_id from this breakpoint list. | |
BreakpointSite (const lldb::BreakpointLocationSP &constituent, 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_constituents |
This has the BreakpointLocations that share this breakpoint site. | |
std::recursive_mutex | m_constituents_mutex |
This mutex protects the constituents collection. | |
Friends | |
class | Process |
class | BreakpointLocation |
class | StopInfoBreakpoint |
Additional Inherited Members | |
Protected Attributes inherited from lldb_private::StoppointSite | |
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_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.
Definition at line 49 of file BreakpointSite.h.
Definition at line 48 of file BreakpointSite.h.
Enumerator | |
---|---|
eSoftware | |
eHardware | |
eExternal |
Definition at line 38 of file BreakpointSite.h.
|
override |
Definition at line 32 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::GetByIndex(), lldb_private::BreakpointLocationCollection::GetSize(), and m_constituents.
|
private |
Definition at line 20 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::Add(), and m_constituents.
|
privatedelete |
void BreakpointSite::AddConstituent | ( | const lldb::BreakpointLocationSP & | constituent | ) |
The "Constituents" are the breakpoint locations that share this breakpoint site.
The method adds the constituent to this breakpoint site's constituent list.
[in] | constituent | constituent is the Breakpoint Location to add. |
Definition at line 123 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::Add(), m_constituents, and m_constituents_mutex.
|
private |
Definition at line 150 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::BreakpointLocations(), m_constituents, and m_constituents_mutex.
size_t BreakpointSite::CopyConstituentsList | ( | BreakpointLocationCollection & | out_collection | ) |
This method copies the breakpoint site's constituents into a new collection.
It does this while the constituents mutex is locked.
[out] | out_collection | The BreakpointLocationCollection into which to put the constituents of this breakpoint site. |
Definition at line 199 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::Add(), lldb_private::BreakpointLocationCollection::BreakpointLocations(), lldb_private::BreakpointLocationCollection::GetSize(), m_constituents, and m_constituents_mutex.
|
overridevirtual |
Standard Dump method.
Implements lldb_private::StoppointSite.
Definition at line 72 of file BreakpointSite.cpp.
References lldb_private::StoppointSite::GetHitCount(), lldb_private::StoppointSite::GetID(), IsHardware(), lldb_private::StoppointSite::m_addr, and lldb_private::Stream::Printf().
BreakpointLocationSP BreakpointSite::GetConstituentAtIndex | ( | size_t | idx | ) |
This method returns the breakpoint location at index index located at this breakpoint site.
The constituents are listed ordinally from 0 to GetNumberOfConstituents() - 1 so you can use this method to iterate over the constituents
[in] | idx | The index in the list of constituents for which you wish the constituent location. |
Definition at line 140 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::GetByIndex(), m_constituents, and m_constituents_mutex.
Referenced by lldb_private::Platform::GetSoftwareBreakpointTrapOpcode(), and lldb_private::PlatformDarwin::GetSoftwareBreakpointTrapOpcode().
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 constituents. 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 82 of file BreakpointSite.cpp.
References lldb::eDescriptionLevelBrief, lldb_private::BreakpointLocationCollection::GetDescription(), lldb_private::StoppointSite::GetID(), lldb_private::StoppointSite::GetLoadAddress(), m_constituents, m_constituents_mutex, and lldb_private::Stream::Printf().
|
staticprivate |
Definition at line 40 of file BreakpointSite.cpp.
size_t BreakpointSite::GetNumberOfConstituents | ( | ) |
This method returns the number of breakpoint locations currently located at this breakpoint site.
Definition at line 135 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::GetSize(), m_constituents, and m_constituents_mutex.
uint8_t * BreakpointSite::GetSavedOpcodeBytes | ( | ) |
Gets the original instruction bytes that were overwritten by the trap.
Definition at line 113 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 115 of file BreakpointSite.cpp.
References m_saved_opcode.
uint8_t * BreakpointSite::GetTrapOpcodeBytes | ( | ) |
Returns the Opcode Bytes for this breakpoint.
Definition at line 92 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 94 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 98 of file BreakpointSite.cpp.
References m_trap_opcode.
|
inline |
Definition at line 197 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 157 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 62 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::GetByIndex(), lldb_private::BreakpointLocationCollection::GetSize(), m_constituents, and m_constituents_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 constituents, 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 119 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 191 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 90 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::IsInternal(), and m_constituents.
|
privatedelete |
|
private |
The method removes the constituent at break_loc_id from this breakpoint list.
Definition at line 128 of file BreakpointSite.cpp.
References lldb_private::BreakpointLocationCollection::GetSize(), m_constituents, m_constituents_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 121 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 102 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 199 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 48 of file BreakpointSite.cpp.
References lldb_private::StoppointHitCounter::Increment(), m_constituents, m_constituents_mutex, lldb_private::StoppointSite::m_hit_counter, and lldb_private::BreakpointLocationCollection::ShouldStop().
bool BreakpointSite::ValidForThisThread | ( | Thread & | thread | ) |
Check whether the constituents 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 145 of file BreakpointSite.cpp.
References m_constituents, m_constituents_mutex, and lldb_private::BreakpointLocationCollection::ValidForThisThread().
|
friend |
Definition at line 203 of file BreakpointSite.h.
|
friend |
Definition at line 202 of file BreakpointSite.h.
|
friend |
Definition at line 207 of file BreakpointSite.h.
|
private |
This has the BreakpointLocations that share this breakpoint site.
Definition at line 227 of file BreakpointSite.h.
Referenced by AddConstituent(), BreakpointSite(), BumpHitCounts(), CopyConstituentsList(), GetConstituentAtIndex(), GetDescription(), GetNumberOfConstituents(), IsBreakpointAtThisSite(), IsInternal(), RemoveConstituent(), ShouldStop(), ValidForThisThread(), and ~BreakpointSite().
|
private |
This mutex protects the constituents collection.
Definition at line 229 of file BreakpointSite.h.
Referenced by AddConstituent(), BumpHitCounts(), CopyConstituentsList(), GetConstituentAtIndex(), GetDescription(), GetNumberOfConstituents(), IsBreakpointAtThisSite(), RemoveConstituent(), ShouldStop(), and ValidForThisThread().
|
private |
Boolean indicating if this breakpoint site enabled or not.
Definition at line 222 of file BreakpointSite.h.
Referenced by IsEnabled(), and SetEnabled().
|
private |
The saved opcode bytes if this breakpoint site uses trap opcodes.
Definition at line 217 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 219 of file BreakpointSite.h.
Referenced by GetTrapOpcodeBytes(), GetTrapOpcodeMaxByteSize(), and SetTrapOpcode().
|
private |
The type of this breakpoint site.
Definition at line 216 of file BreakpointSite.h.