[llvm] [DebugInfo/DWARF] Fix data race in DWARFUnit DIE extraction (PR #180470)

Shivam Kunwar via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 9 22:20:40 PST 2026


phyBrackets wrote:

> Can you cross-reference other thread-enabling/thread safety changes for libDebugInfoDWARF - I think we'd historically tried to isolate the locking and thread safety to a wrapper/decorator design, and this change looks like a divergence from that approach that should be avoided if possible/practical.

Thanks @dwblaikie for the context.  I wasn't aware of the wrapper/decorator pattern used in `ThreadSafeState` . 

Looking at the existing design, I see few alternatives,  race specifically occurs when following DW_AT_abstract_origin/DW_AT_specification across CU boundaries. We could hold the existing `ThreadSafeState` mutex during such operations. Or does it make sense to extend the `ThreadSafeState` , we can add per-unit extraction state/locking to the ThreadSafeState class rather than DWARFUnit, keeping the core class lock-free.

Let me know if you have any other/better approach?

https://github.com/llvm/llvm-project/pull/180470


More information about the llvm-commits mailing list