[Lldb-commits] [lldb] Convert the StackFrameList mutex to a shared mutex. (PR #117252)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 10 07:54:27 PST 2024
================
@@ -534,33 +569,27 @@ bool StackFrameList::GetFramesUpTo(uint32_t end_idx,
// We are done with the old stack frame list, we can release it now.
m_prev_frames_sp.reset();
}
-
-#if defined(DEBUG_STACK_FRAMES)
- s.PutCString("\n\nNew frames:\n");
- Dump(&s);
- s.EOL();
-#endif
// Don't report interrupted if we happen to have gotten all the frames:
if (!GetAllFramesFetched())
return was_interrupted;
return false;
}
uint32_t StackFrameList::GetNumFrames(bool can_create) {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
-
- if (can_create) {
+ if (!WereAllFramesFetched() && can_create) {
// Don't allow interrupt or we might not return the correct count
- GetFramesUpTo(UINT32_MAX, DoNotAllowInterruption);
+ GetFramesUpTo(UINT32_MAX, DoNotAllowInterruption);
}
+ // Formally we should acquire the shared lock here, but since we've forced
+ // fetching all the frames, it can't change anymore so that's not required.
----------------
labath wrote:
This is only true if `can_create==true`. I think you'll still need the read lock here.
https://github.com/llvm/llvm-project/pull/117252
More information about the lldb-commits
mailing list