aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Breakpoint/BreakpointSite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/lldb/source/Breakpoint/BreakpointSite.cpp')
-rw-r--r--contrib/llvm-project/lldb/source/Breakpoint/BreakpointSite.cpp77
1 files changed, 36 insertions, 41 deletions
diff --git a/contrib/llvm-project/lldb/source/Breakpoint/BreakpointSite.cpp b/contrib/llvm-project/lldb/source/Breakpoint/BreakpointSite.cpp
index a33fd0a1c462..fb3f0cd06897 100644
--- a/contrib/llvm-project/lldb/source/Breakpoint/BreakpointSite.cpp
+++ b/contrib/llvm-project/lldb/source/Breakpoint/BreakpointSite.cpp
@@ -21,7 +21,7 @@ using namespace lldb_private;
BreakpointSite::BreakpointSite(BreakpointSiteList *list,
const BreakpointLocationSP &owner,
lldb::addr_t addr, bool use_hardware)
- : StoppointLocation(GetNextID(), addr, 0, use_hardware),
+ : StoppointSite(GetNextID(), addr, 0, use_hardware),
m_type(eSoftware), // Process subclasses need to set this correctly using
// SetType()
m_saved_opcode(), m_trap_opcode(),
@@ -48,7 +48,7 @@ break_id_t BreakpointSite::GetNextID() {
// should continue.
bool BreakpointSite::ShouldStop(StoppointCallbackContext *context) {
- IncrementHitCount();
+ m_hit_counter.Increment();
// ShouldStop can do a lot of work, and might even come come back and hit
// this breakpoint site again. So don't hold the m_owners_mutex the whole
// while. Instead make a local copy of the collection and call ShouldStop on
@@ -156,51 +156,46 @@ void BreakpointSite::BumpHitCounts() {
}
}
-void BreakpointSite::SetHardwareIndex(uint32_t index) {
- std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
- for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations()) {
- loc_sp->SetHardwareIndex(index);
- }
-}
-
bool BreakpointSite::IntersectsRange(lldb::addr_t addr, size_t size,
lldb::addr_t *intersect_addr,
size_t *intersect_size,
size_t *opcode_offset) const {
- // We only use software traps for software breakpoints
- if (!IsHardware()) {
- if (m_byte_size > 0) {
- const lldb::addr_t bp_end_addr = m_addr + m_byte_size;
- const lldb::addr_t end_addr = addr + size;
- // Is the breakpoint end address before the passed in start address?
- if (bp_end_addr <= addr)
- return false;
- // Is the breakpoint start address after passed in end address?
- if (end_addr <= m_addr)
- return false;
- if (intersect_addr || intersect_size || opcode_offset) {
- if (m_addr < addr) {
- if (intersect_addr)
- *intersect_addr = addr;
- if (intersect_size)
- *intersect_size =
- std::min<lldb::addr_t>(bp_end_addr, end_addr) - addr;
- if (opcode_offset)
- *opcode_offset = addr - m_addr;
- } else {
- if (intersect_addr)
- *intersect_addr = m_addr;
- if (intersect_size)
- *intersect_size =
- std::min<lldb::addr_t>(bp_end_addr, end_addr) - m_addr;
- if (opcode_offset)
- *opcode_offset = 0;
- }
- }
- return true;
+ // The function should be called only for software breakpoints.
+ lldbassert(GetType() == Type::eSoftware);
+
+ if (m_byte_size == 0)
+ return false;
+
+ const lldb::addr_t bp_end_addr = m_addr + m_byte_size;
+ const lldb::addr_t end_addr = addr + size;
+ // Is the breakpoint end address before the passed in start address?
+ if (bp_end_addr <= addr)
+ return false;
+
+ // Is the breakpoint start address after passed in end address?
+ if (end_addr <= m_addr)
+ return false;
+
+ if (intersect_addr || intersect_size || opcode_offset) {
+ if (m_addr < addr) {
+ if (intersect_addr)
+ *intersect_addr = addr;
+ if (intersect_size)
+ *intersect_size =
+ std::min<lldb::addr_t>(bp_end_addr, end_addr) - addr;
+ if (opcode_offset)
+ *opcode_offset = addr - m_addr;
+ } else {
+ if (intersect_addr)
+ *intersect_addr = m_addr;
+ if (intersect_size)
+ *intersect_size =
+ std::min<lldb::addr_t>(bp_end_addr, end_addr) - m_addr;
+ if (opcode_offset)
+ *opcode_offset = 0;
}
}
- return false;
+ return true;
}
size_t