[Lldb-commits] [PATCH] D103271: [lldb/Target] Select most relevant frame only in case of signal

Levon Ter-Grigoryan via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 27 11:06:37 PDT 2021


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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103271.348325.patch
Type: text/x-patch
Size: 555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210527/a5e7987b/attachment.bin>


More information about the lldb-commits mailing list