Added a mutex to the call frame info to guard

generation of the FDE index.

<rdar://problem/11813705>

llvm-svn: 160099
This commit is contained in:
Sean Callanan 2012-07-12 01:11:40 +00:00
parent d2aabd3bb2
commit 7d69f12e75
2 changed files with 8 additions and 1 deletions

View File

@ -18,6 +18,7 @@
#include "lldb/Core/AddressRange.h" #include "lldb/Core/AddressRange.h"
#include "lldb/Core/VMRange.h" #include "lldb/Core/VMRange.h"
#include "lldb/Core/dwarf.h" #include "lldb/Core/dwarf.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Symbol/UnwindPlan.h" #include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/ObjectFile.h"
@ -128,6 +129,7 @@ private:
std::vector<FDEEntry> m_fde_index; std::vector<FDEEntry> m_fde_index;
bool m_fde_index_initialized; // only scan the section for FDEs once 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; bool m_is_eh_frame;

View File

@ -293,9 +293,14 @@ DWARFCallFrameInfo::GetFDEIndex ()
{ {
if (m_section_sp.get() == NULL || m_section_sp->IsEncrypted()) if (m_section_sp.get() == NULL || m_section_sp->IsEncrypted())
return; return;
if (m_fde_index_initialized) if (m_fde_index_initialized)
return; 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; dw_offset_t offset = 0;
if (m_cfi_data_initialized == false) if (m_cfi_data_initialized == false)