PatriosTheGreat created this revision.
PatriosTheGreat added reviewers: mib, labath, jarin.
PatriosTheGreat added a project: LLDB.
Herald added a subscriber: JDevlieghere.
PatriosTheGreat requested review of this revision.
Herald added a subscriber: lldb-commits.

In order to select most relevant frame the debugger needs to unwind current 
frames for each thread which could be slow.
This is a problem in case of executing with remote debugger attached and 
conditional breakpoints set.
In that case the debugger will stop the execution on a breakpoint hit to run 
conditional expression and will resume the execution after.
If there are a lot of threads (90+) the simple "for" loop with 50 iterations 
and conditional breakpoint could take more than 2 minutes to execute.
>From my observation most of this time will be spent on SelectMostRelevantFrame 
>method (since it need to unwind stack for all threads).

Since the most relevant frame is needed only for assert failure it looks like 
we can collect it only for signals.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103271

Files:
  lldb/source/Target/Thread.cpp


Index: lldb/source/Target/Thread.cpp
===================================================================
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -606,7 +606,9 @@
 void Thread::WillStop() {
   ThreadPlan *current_plan = GetCurrentPlan();
 
-  SelectMostRelevantFrame();
+  lldb::StopReason stop_reason = GetStopReason();
+  if (stop_reason == lldb::StopReason::eStopReasonSignal)
+    SelectMostRelevantFrame();
 
   // FIXME: I may decide to disallow threads with no plans.  In which
   // case this should go to an assert.


Index: lldb/source/Target/Thread.cpp
===================================================================
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -606,7 +606,9 @@
 void Thread::WillStop() {
   ThreadPlan *current_plan = GetCurrentPlan();
 
-  SelectMostRelevantFrame();
+  lldb::StopReason stop_reason = GetStopReason();
+  if (stop_reason == lldb::StopReason::eStopReasonSignal)
+    SelectMostRelevantFrame();
 
   // FIXME: I may decide to disallow threads with no plans.  In which
   // case this should go to an assert.
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to