[lldb/BreakpointSite] Handle all ways of control flow
authorTatyana Krasnukha <tatyana@synopsys.com>
Wed, 29 Jul 2020 18:52:40 +0000 (21:52 +0300)
committerTatyana Krasnukha <tatyana@synopsys.com>
Wed, 29 Jul 2020 18:53:18 +0000 (21:53 +0300)
lldb/source/Breakpoint/BreakpointSite.cpp

index bdcabd7..faa7e4c 100644 (file)
@@ -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