[Lldb-commits] [lldb] Convert the StackFrameList mutex to a shared mutex. (PR #117252)

via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 6 17:42:56 PST 2024


================
@@ -128,30 +130,41 @@ bool StackFrameList::DecrementCurrentInlinedDepth() {
 }
 
 void StackFrameList::SetCurrentInlinedDepth(uint32_t new_depth) {
+  std::lock_guard<std::mutex> guard(m_inlined_depth_mutex);
   m_current_inlined_depth = new_depth;
   if (new_depth == UINT32_MAX)
     m_current_inlined_pc = LLDB_INVALID_ADDRESS;
   else
     m_current_inlined_pc = m_thread.GetRegisterContext()->GetPC();
 }
 
-void StackFrameList::GetOnlyConcreteFramesUpTo(uint32_t end_idx,
-                                               Unwind &unwinder) {
+void StackFrameList::GetOnlyConcreteFramesUpTo(
+    uint32_t end_idx, Unwind &unwinder,
+    std::shared_lock<std::shared_mutex> &guard) {
----------------
jimingham wrote:

I don't understand this comment.  In the patch as posted, GetOnly ConcreteFramesUpTo gets called before the shared lock is dropped and the exclusive mutex acquired (since it returned right away in its only use, it seemed nicer to put that dance in the function.  That should be clear by moving the equivalent "get concrete and inlined frames" code into its own function.

https://github.com/llvm/llvm-project/pull/117252


More information about the lldb-commits mailing list