[all-commits] [llvm/llvm-project] 5aa934: Make DWARFUnitVector threadsafe. (#71487)
Greg Clayton via All-commits
all-commits at lists.llvm.org
Wed Nov 8 10:20:16 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5aa934e2af8727852dec0ec1cfa0cba05d858f70
https://github.com/llvm/llvm-project/commit/5aa934e2af8727852dec0ec1cfa0cba05d858f70
Author: Greg Clayton <gclayton at fb.com>
Date: 2023-11-08 (Wed, 08 Nov 2023)
Changed paths:
M llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
Log Message:
-----------
Make DWARFUnitVector threadsafe. (#71487)
The DWARFUnitVector class lives inside of the DWARFContextState. Prior
to this fix a non const reference was being handed out to clients. When
fetching the DWO units, there used to be a "bool Lazy" parameter that
could be passed that would allow the DWARFUnitVector to parse individual
units on the fly. There were two major issues with this approach:
- not thread safe and causes crashes
- the accessor would check if DWARFUnitVector was empty and if not empty
it would return a partially filled in DWARFUnitVector if it was
constructed with "Lazy = true"
This patch fixes the issues by always fully parsing the DWARFUnitVector
when it is requested and only hands out a "const DWARFUnitVector &".
This allows the thread safety mechanism built into the DWARFContext
class to work corrrectly, and avoids the issue where if someone
construct DWARFUnitVector with "Lazy = true", and then calls an API that
partially fills in the DWARFUnitVector with individual entries, and then
someone accesses the DWARFUnitVector, they would get a partial and
incomplete listing of the DWARF units for the DWOs.
More information about the All-commits
mailing list