[Lldb-commits] [PATCH] Avoid querying thread stop info if the thread hasn't been running

Pavel Labath labath at google.com
Thu Jun 18 14:42:12 PDT 2015

Hi jingham, clayborg,

A step over operation on a single thread typically consists of several
start-stop cycles (stepping over breakpoints, etc.). Currently, LLDB queries
the debug server for thread stop info of all threads after each stop, even
though the the other threads have not been running (and hence, their stop info
should remain the same). This introduces significant delay if the application
has many threads (e.g. a typical android application has about 20 threads,
which results in about 80 redundant packets for each step operation). This
commit makes LLDB reuse the stop reason from the previous stop if the thread
hasn't been running, thereby reducing the stepping latency.



Index: source/Target/Thread.cpp
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -427,6 +427,12 @@
+        if (m_temporary_resume_state == eStateStopped || m_temporary_resume_state == eStateSuspended)
+        {
+            SetStopInfo(m_stop_info_sp); // This thread hasn't been running, so the stop info is still valid.
+            return m_stop_info_sp;
+        }
         if ((m_stop_info_stop_id == stop_id) ||   // Stop info is valid, just return what we have (even if empty)
             (m_stop_info_sp && m_stop_info_sp->IsValid()))  // Stop info is valid, just return what we have
@@ -746,8 +752,9 @@
         // If the WillResume for the plan says we are faking a resume, then it will have set an appropriate stop info.
         // In that case, don't reset it here.
+        // Also, don't reset in case we're stopped or suspended, as the stop info will remain unchanged.
-        if (need_to_resume && resume_state != eStateSuspended)
+        if (need_to_resume && resume_state != eStateSuspended && resume_state != eStateStopped)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10550.27963.patch
Type: text/x-patch
Size: 1245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150618/2d8588d9/attachment.bin>

More information about the lldb-commits mailing list