[all-commits] [llvm/llvm-project] 576f3f: Make DWARFContext more thread safe.
Greg Clayton via All-commits
all-commits at lists.llvm.org
Fri Sep 1 14:11:51 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 576f3f0cc930dc9aee157b76dd80319dfe7d51b9
https://github.com/llvm/llvm-project/commit/576f3f0cc930dc9aee157b76dd80319dfe7d51b9
Author: Greg Clayton <gclayton at fb.com>
Date: 2023-09-01 (Fri, 01 Sep 2023)
Changed paths:
M llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
M llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
M llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
Log Message:
-----------
Make DWARFContext more thread safe.
llvm-gsymutil uses a DWARFContext from multiple threads as it parses each compile unit. As it finds issues it might end up dumping a DIE to an output stream which can cause accesses to the DWARFContext from multiple threads. In llvm-gsymutil it can end up dumping a DIE from multiple threads into thread specific stream which was causing DWARFContext::getTUIndex() to be called and can crash the process.
This fix puts a recursive mutex into the DWARFContext class and makes most APIs threadsafe for access. Many of the methods in DWARFContext will check if a member variable has been filled in yet, and parse what is needed and populate a member variagle with the results. Now a mutex protects these functions.
Differential Revision: https://reviews.llvm.org/D157459
More information about the All-commits
mailing list