[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
Author: Greg Clayton <gclayton at fb.com>
Date: 2023-09-01 (Fri, 01 Sep 2023)
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