Skip to content

Commit 5924b72

Browse files
author
Kevin Frei
committed
Added the top level lock to prevent clearDies from causing problems
1 parent c02ccf6 commit 5924b72

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ class DWARFUnit {
258258

259259
std::shared_ptr<DWARFUnit> DWO;
260260

261+
mutable llvm::sys::RWMutex CUDieFreeMutex;
261262
mutable llvm::sys::RWMutex CUDieArrayMutex;
262263
mutable llvm::sys::RWMutex AllDieArrayMutex;
263264

llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ void DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
496496
}
497497

498498
Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) {
499+
llvm::sys::ScopedReader FreeLock(CUDieFreeMutex);
499500
{
500501
llvm::sys::ScopedReader Lock(CUDieArrayMutex);
501502
if ((CUDieOnly && !DieArray.empty()) || DieArray.size() > 1)
@@ -673,6 +674,7 @@ void DWARFUnit::clearDIEs(bool KeepCUDie) {
673674
// It depends on the implementation whether the request is fulfilled.
674675
// Create a new vector with a small capacity and assign it to the DieArray to
675676
// have previous contents freed.
677+
llvm::sys::ScopedWriter FreeLock(CUDieFreeMutex);
676678
llvm::sys::ScopedWriter CULock(CUDieArrayMutex);
677679
llvm::sys::ScopedWriter AllLock(AllDieArrayMutex);
678680
DieArray = (KeepCUDie && !DieArray.empty())

0 commit comments

Comments
 (0)