jarin created this revision.
jarin added reviewers: clayborg, labath.
jarin added a project: LLDB.
Herald added a subscriber: lldb-commits.

This patch improves step over performance for the case when we are stepping 
over a call with a next-branch-breakpoint (see 
https://reviews.llvm.org/D58678), and we encounter a stop during the call. 
Currently, this causes the thread plan to step-out //each frame// until it 
reaches the step-over range. This is a regression introduced by 
https://reviews.llvm.org/D58678 (which did improve other things!). Prior to 
that change, the step-over plan would always step-out just once.

With this patch, if we find ourselves stopped in a deeper stack frame and we 
already have a next branch breakpoint, we simply return from the step-over 
plan's ShouldStop handler without pushing the step out plan.

In my experiments this improved the time of stepping over a call that loads 12 
dlls from 14s to 5s. This was in remote debugging scenario with 10ms RTT, the 
call in question was Vulkan initialization (vkCreateInstance), which loads 
various driver dlls. Loading those dlls must stop on the rendezvous breakpoint, 
causing the perf problem described above.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76216

Files:
  lldb/source/Target/ThreadPlanStepOverRange.cpp


Index: lldb/source/Target/ThreadPlanStepOverRange.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStepOverRange.cpp
+++ lldb/source/Target/ThreadPlanStepOverRange.cpp
@@ -171,6 +171,10 @@
       const SymbolContext &older_context =
           older_frame_sp->GetSymbolContext(eSymbolContextEverything);
       if (IsEquivalentContext(older_context)) {
+        // If we have the next-branch-breakpoint in the range, we can just
+        // rely on that breakpoint to trigger once we return to the range.
+        if (m_next_branch_bp_sp)
+          return false;
         new_plan_sp = m_thread.QueueThreadPlanForStepOutNoShouldStop(
             false, nullptr, true, stop_others, eVoteNo, eVoteNoOpinion, 0,
             m_status, true);


Index: lldb/source/Target/ThreadPlanStepOverRange.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStepOverRange.cpp
+++ lldb/source/Target/ThreadPlanStepOverRange.cpp
@@ -171,6 +171,10 @@
       const SymbolContext &older_context =
           older_frame_sp->GetSymbolContext(eSymbolContextEverything);
       if (IsEquivalentContext(older_context)) {
+        // If we have the next-branch-breakpoint in the range, we can just
+        // rely on that breakpoint to trigger once we return to the range.
+        if (m_next_branch_bp_sp)
+          return false;
         new_plan_sp = m_thread.QueueThreadPlanForStepOutNoShouldStop(
             false, nullptr, true, stop_others, eVoteNo, eVoteNoOpinion, 0,
             m_status, true);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to