[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
Fri Jun 18 04:00:50 PDT 2021
PatriosTheGreat updated this revision to Diff 352966.
PatriosTheGreat added a comment.
Thanks for the review feedback.
Looks like moving frame recognizer call to StackFrameList::GetFramesUpTo also fixes infinity recursion issue.
Regarding the zeroth frame issue: I'm actually using the lldb-server compiled with followed cmake command:
cmake -G Ninja -DLLVM_ENABLE_PROJECTS='lldb;clang;libcxx' ../llvm
I see a performance improvement even on a local run, however it's not as huge:
In the sample I provided previously with this patch the execution time will be around 4 seconds instead of 6 seconds without it during the local run.
I see at the profiler that asking 0th frame triggers UnwindLLDB::DoGetFrameInfoAtIndex -> UnwindLLDB::AddFirstFrame -> UnwindLLDB::UpdateUnwindPlanForFirstFrameIfInvalid -> UnwindLLDB::AddOneMoreFrame -> UnwindLLDB::GetOneMoreFrame -> RegisterContextUnwind::RegisterContextUnwind -> RegisterContextUnwind::InitializeNonZerothFrame
- which is costly.
If I understand correctly the LLDB won't do any of this for background threads by default.
Could it be that accelerated stop-reply packets you said previously is turned off by default in lldb-server and I need to set a special setting to turn them on?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103271/new/
https://reviews.llvm.org/D103271
Files:
lldb/include/lldb/Target/Thread.h
lldb/source/Target/StackFrameList.cpp
lldb/source/Target/Thread.cpp
Index: lldb/source/Target/Thread.cpp
===================================================================
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -578,15 +578,9 @@
return raw_stop_description;
}
-void Thread::SelectMostRelevantFrame() {
+void Thread::SelectMostRelevantFrame(lldb::StackFrameSP first_frame) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD);
-
- auto frames_list_sp = GetStackFrameList();
-
- // Only the top frame should be recognized.
- auto frame_sp = frames_list_sp->GetFrameAtIndex(0);
-
- auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
+ auto recognized_frame_sp = first_frame->GetRecognizedFrame();
if (!recognized_frame_sp) {
LLDB_LOG(log, "Frame #0 not recognized");
@@ -606,8 +600,6 @@
void Thread::WillStop() {
ThreadPlan *current_plan = GetCurrentPlan();
- SelectMostRelevantFrame();
-
// FIXME: I may decide to disallow threads with no plans. In which
// case this should go to an assert.
Index: lldb/source/Target/StackFrameList.cpp
===================================================================
--- lldb/source/Target/StackFrameList.cpp
+++ lldb/source/Target/StackFrameList.cpp
@@ -547,6 +547,9 @@
curr_frame_address = next_frame_address;
}
}
+
+ if (idx == 0)
+ m_thread.SelectMostRelevantFrame(unwind_frame_sp);
} while (m_frames.size() - 1 < end_idx);
// Don't try to merge till you've calculated all the frames in this stack.
Index: lldb/include/lldb/Target/Thread.h
===================================================================
--- lldb/include/lldb/Target/Thread.h
+++ lldb/include/lldb/Target/Thread.h
@@ -218,7 +218,7 @@
virtual void RefreshStateAfterStop() = 0;
- void SelectMostRelevantFrame();
+ void SelectMostRelevantFrame(lldb::StackFrameSP first_frame);
std::string GetStopDescription();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103271.352966.patch
Type: text/x-patch
Size: 1903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210618/4e144876/attachment-0001.bin>
More information about the lldb-commits
mailing list