forked from OSchip/llvm-project
Revert "Protect DWARFCompileUnit::m_die_array by a new mutex"
Pavel Labath found this patch is incomplete and racy. I think there needs to be some more mutexes even before considering DW_TAG_partial_unit. This reverts commit 331229 which was: https://reviews.llvm.org/D40470 llvm-svn: 332200
This commit is contained in:
parent
f170b85d40
commit
03aff468c9
|
|
@ -41,20 +41,9 @@ DWARFUnit::~DWARFUnit() {}
|
||||||
// Parses a compile unit and indexes its DIEs if it hasn't already been done.
|
// Parses a compile unit and indexes its DIEs if it hasn't already been done.
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) {
|
size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) {
|
||||||
size_t initial_die_array_size;
|
const size_t initial_die_array_size = m_die_array.size();
|
||||||
auto already_parsed = [cu_die_only, &initial_die_array_size, this]() -> bool {
|
if ((cu_die_only && initial_die_array_size > 0) || initial_die_array_size > 1)
|
||||||
initial_die_array_size = m_die_array.size();
|
return 0; // Already parsed
|
||||||
return (cu_die_only && initial_die_array_size > 0)
|
|
||||||
|| initial_die_array_size > 1;
|
|
||||||
};
|
|
||||||
{
|
|
||||||
llvm::sys::ScopedReader lock(m_extractdies_mutex);
|
|
||||||
if (already_parsed())
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
llvm::sys::ScopedWriter lock(m_extractdies_mutex);
|
|
||||||
if (already_parsed())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
|
|
@ -302,8 +291,6 @@ void DWARFUnit::SetAddrBase(dw_addr_t addr_base,
|
||||||
|
|
||||||
void DWARFUnit::ClearDIEs(bool keep_compile_unit_die) {
|
void DWARFUnit::ClearDIEs(bool keep_compile_unit_die) {
|
||||||
if (m_die_array.size() > 1) {
|
if (m_die_array.size() > 1) {
|
||||||
llvm::sys::ScopedWriter lock(m_extractdies_mutex);
|
|
||||||
|
|
||||||
// std::vectors never get any smaller when resized to a smaller size, or
|
// std::vectors never get any smaller when resized to a smaller size, or
|
||||||
// when clear() or erase() are called, the size will report that it is
|
// when clear() or erase() are called, the size will report that it is
|
||||||
// smaller, but the memory allocated remains intact (call capacity() to see
|
// smaller, but the memory allocated remains intact (call capacity() to see
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
#include "DWARFDIE.h"
|
#include "DWARFDIE.h"
|
||||||
#include "DWARFDebugInfoEntry.h"
|
#include "DWARFDebugInfoEntry.h"
|
||||||
#include "lldb/lldb-enumerations.h"
|
#include "lldb/lldb-enumerations.h"
|
||||||
#include "llvm/Support/RWMutex.h"
|
|
||||||
|
|
||||||
class DWARFUnit;
|
class DWARFUnit;
|
||||||
class DWARFCompileUnit;
|
class DWARFCompileUnit;
|
||||||
|
|
@ -190,7 +189,6 @@ protected:
|
||||||
// If this is a dwo compile unit this is the offset of the base compile unit
|
// If this is a dwo compile unit this is the offset of the base compile unit
|
||||||
// in the main object file
|
// in the main object file
|
||||||
dw_offset_t m_base_obj_offset = DW_INVALID_OFFSET;
|
dw_offset_t m_base_obj_offset = DW_INVALID_OFFSET;
|
||||||
llvm::sys::RWMutex m_extractdies_mutex;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
IndexPrivate(DWARFUnit *dwarf_cu, const lldb::LanguageType cu_language,
|
IndexPrivate(DWARFUnit *dwarf_cu, const lldb::LanguageType cu_language,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue