[Lldb-commits] [lldb] r270358 - Fix an incorrectly used locking in HistoryThread and HistoryUnwind, where unique_lock's release() was called causing the mutex to stay locked.

Kuba Brecka via lldb-commits lldb-commits at lists.llvm.org
Sun May 22 05:24:41 PDT 2016


Author: kuba.brecka
Date: Sun May 22 07:24:38 2016
New Revision: 270358

URL: http://llvm.org/viewvc/llvm-project?rev=270358&view=rev
Log:
Fix an incorrectly used locking in HistoryThread and HistoryUnwind, where unique_lock's release() was called causing the mutex to stay locked.


Modified:
    lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp
    lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp?rev=270358&r1=270357&r2=270358&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp Sun May 22 07:24:38 2016
@@ -75,8 +75,7 @@ lldb::StackFrameListSP
 HistoryThread::GetStackFrameList ()
 {
     // FIXME do not throw away the lock after we acquire it..
-    std::unique_lock<std::mutex> lock(m_framelist_mutex);
-    lock.release();
+    std::lock_guard<std::mutex> lock(m_framelist_mutex);
     if (m_framelist.get() == NULL)
     {
         m_framelist.reset (new StackFrameList (*this, StackFrameListSP(), true));

Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.cpp?rev=270358&r1=270357&r2=270358&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.cpp Sun May 22 07:24:38 2016
@@ -65,8 +65,7 @@ bool
 HistoryUnwind::DoGetFrameInfoAtIndex (uint32_t frame_idx, lldb::addr_t& cfa, lldb::addr_t& pc)
 {
     // FIXME do not throw away the lock after we acquire it..
-    std::unique_lock<std::recursive_mutex> guard(m_unwind_mutex);
-    guard.release();
+    std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
     if (frame_idx < m_pcs.size())
     {
         cfa = frame_idx;




More information about the lldb-commits mailing list