[Lldb-commits] [lldb] r160099 - in /lldb/trunk: include/lldb/Symbol/DWARFCallFrameInfo.h source/Symbol/DWARFCallFrameInfo.cpp

Sean Callanan scallanan at apple.com
Wed Jul 11 18:11:40 PDT 2012


Author: spyffe
Date: Wed Jul 11 20:11:40 2012
New Revision: 160099

URL: http://llvm.org/viewvc/llvm-project?rev=160099&view=rev
Log:
Added a mutex to the call frame info to guard
generation of the FDE index.

<rdar://problem/11813705>

Modified:
    lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
    lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp

Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=160099&r1=160098&r2=160099&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h Wed Jul 11 20:11:40 2012
@@ -18,6 +18,7 @@
 #include "lldb/Core/AddressRange.h"
 #include "lldb/Core/VMRange.h"
 #include "lldb/Core/dwarf.h"
+#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/UnwindPlan.h"
 #include "lldb/Symbol/ObjectFile.h"
 
@@ -128,6 +129,7 @@
 
     std::vector<FDEEntry>       m_fde_index;
     bool                        m_fde_index_initialized;  // only scan the section for FDEs once
+    Mutex                       m_fde_index_mutex;        // and isolate the thread that does it
 
     bool                        m_is_eh_frame;
 

Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=160099&r1=160098&r2=160099&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Wed Jul 11 20:11:40 2012
@@ -293,9 +293,14 @@
 {
     if (m_section_sp.get() == NULL || m_section_sp->IsEncrypted())
         return;
+    
     if (m_fde_index_initialized)
         return;
-
+    
+    Mutex::Locker locker(m_fde_index_mutex);
+    
+    if (m_fde_index_initialized) // if two threads hit the locker
+        return;
 
     dw_offset_t offset = 0;
     if (m_cfi_data_initialized == false)





More information about the lldb-commits mailing list