[Lldb-commits] [lldb] d5c1f68 - [lldb/BreakpointSite] Handle all ways of control flow

Tatyana Krasnukha via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 29 11:53:33 PDT 2020


Author: Tatyana Krasnukha
Date: 2020-07-29T21:53:18+03:00
New Revision: d5c1f686e34fdd9ed8ec9b7a195799baf492e854

URL: https://github.com/llvm/llvm-project/commit/d5c1f686e34fdd9ed8ec9b7a195799baf492e854
DIFF: https://github.com/llvm/llvm-project/commit/d5c1f686e34fdd9ed8ec9b7a195799baf492e854.diff

LOG: [lldb/BreakpointSite] Handle all ways of control flow

Added: 
    

Modified: 
    lldb/source/Breakpoint/BreakpointSite.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Breakpoint/BreakpointSite.cpp b/lldb/source/Breakpoint/BreakpointSite.cpp
index bdcabd7cce5e..faa7e4c261e7 100644
--- a/lldb/source/Breakpoint/BreakpointSite.cpp
+++ b/lldb/source/Breakpoint/BreakpointSite.cpp
@@ -170,36 +170,39 @@ bool BreakpointSite::IntersectsRange(lldb::addr_t addr, size_t size,
   // The function should be called only for software breakpoints.
   lldbassert(GetType() == Type::eSoftware);
 
-  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;
-      }
+  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 true;
   }
+  return true;
 }
 
 size_t


        


More information about the lldb-commits mailing list