[Lldb-commits] [lldb] r253008 - Fix commit 252963 to work around a bug on some platforms where they don't

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 12 19:37:48 PST 2015


Author: jingham
Date: Thu Nov 12 21:37:48 2015
New Revision: 253008

URL: http://llvm.org/viewvc/llvm-project?rev=253008&view=rev
Log:
Fix commit 252963 to work around a bug on some platforms where they don't 
correctly handle stepping over one breakpoint directly onto another breakpoint.  
This isn't fixing that bug, but rather just changing 252963 to not use breakpoints
if it is only stepping one instruction.

Modified:
    lldb/trunk/source/Target/ThreadPlanStepRange.cpp

Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=253008&r1=253007&r2=253008&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Thu Nov 12 21:37:48 2015
@@ -389,13 +389,23 @@ ThreadPlanStepRange::SetNextBranchBreakp
         // If we didn't find a branch, run to the end of the range.
         if (branch_index == UINT32_MAX)
         {
-            branch_index = instructions->GetSize() - 1;
+            uint32_t last_index = instructions->GetSize() - 1;
+            if (last_index - pc_index > 1)
+            {
+                InstructionSP last_inst = instructions->GetInstructionAtIndex(last_index);
+                size_t last_inst_size = last_inst->GetOpcode().GetByteSize();
+                run_to_address = last_inst->GetAddress();
+                run_to_address.Slide(last_inst_size);
+            }
+        }
+        else if (branch_index - pc_index > 1)
+        {
+            run_to_address = instructions->GetInstructionAtIndex(branch_index)->GetAddress();
         }
         
-        if (branch_index - pc_index > 1)
+        if (run_to_address.IsValid())
         {
             const bool is_internal = true;
-            run_to_address = instructions->GetInstructionAtIndex(branch_index)->GetAddress();
             m_next_branch_bp_sp = GetTarget().CreateBreakpoint(run_to_address, is_internal, false);
             if (m_next_branch_bp_sp)
             {




More information about the lldb-commits mailing list