Fix step-over when SymbolContext.function is missing and symbol is present.
authorSam McCall <sam.mccall@gmail.com>
Thu, 17 Nov 2016 22:29:31 +0000 (22:29 +0000)
committerSam McCall <sam.mccall@gmail.com>
Thu, 17 Nov 2016 22:29:31 +0000 (22:29 +0000)
Summary:
Fix step-over when SymbolContext.function is missing and symbol is present.

With targets from our build configuration,
ThreadPlanStepOverRange::IsEquivalentContext fails to fire for relevant frames,
leading to ShouldStop() returning true prematurely.

The frame's SymbolContext, and m_addr_context have:
  - comp_unit set and matching
  - function = nullptr
  - symbol set and matching (but this is never checked)
My naive guess is that the context should be equivalent in this case :-)

Reviewers: jingham

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D26804

llvm-svn: 287274

lldb/source/Target/ThreadPlanStepOverRange.cpp

index c8fd6f9..48c7ff8 100644 (file)
@@ -107,21 +107,22 @@ bool ThreadPlanStepOverRange::IsEquivalentContext(
   // the .o file from the
   // inlined range, so I left that out too...
   if (m_addr_context.comp_unit) {
-    if (m_addr_context.comp_unit == context.comp_unit) {
-      if (m_addr_context.function &&
-          m_addr_context.function == context.function) {
-        // It is okay to return to a different block of a straight function, we
-        // only have to
-        // be more careful if returning from one inlined block to another.
-        if (m_addr_context.block->GetInlinedFunctionInfo() == nullptr &&
-            context.block->GetInlinedFunctionInfo() == nullptr)
-          return true;
-
-        if (m_addr_context.block && m_addr_context.block == context.block)
-          return true;
-      }
+    if (m_addr_context.comp_unit != context.comp_unit)
+      return false;
+    if (m_addr_context.function) {
+      if (m_addr_context.function != context.function)
+        return false;
+      // It is okay to return to a different block of a straight function, we
+      // only have to
+      // be more careful if returning from one inlined block to another.
+      if (m_addr_context.block->GetInlinedFunctionInfo() == nullptr &&
+          context.block->GetInlinedFunctionInfo() == nullptr)
+        return true;
+      return m_addr_context.block == context.block;
     }
-  } else if (m_addr_context.symbol && m_addr_context.symbol == context.symbol) {
+  }
+  // Fall back to symbol if we have no decision from comp_unit/function/block.
+  if (m_addr_context.symbol && m_addr_context.symbol == context.symbol) {
     return true;
   }
   return false;