File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -2420,7 +2420,7 @@ class BinaryFunction {
24202420 }
24212421
24222422 // / Return DWARF compile units for this function.
2423- const SmallVector<DWARFUnit *, 1 > getDWARFUnits () const {
2423+ const SmallVector<DWARFUnit *, 1 >& getDWARFUnits () const {
24242424 return DwarfUnitVec;
24252425 }
24262426
Original file line number Diff line number Diff line change @@ -1718,9 +1718,15 @@ void BinaryContext::preprocessDebugInfo() {
17181718 // Clear debug info for functions from units that we are not going to process.
17191719 for (auto &KV : BinaryFunctions) {
17201720 BinaryFunction &BF = KV.second ;
1721+ // Collect units to remove to avoid iterator invalidation
1722+ SmallVector<DWARFUnit *, 1 > UnitsToRemove;
17211723 for (auto *Unit : BF.getDWARFUnits ()) {
17221724 if (!ProcessedCUs.count (Unit))
1723- BF.removeDWARFUnit (Unit);
1725+ UnitsToRemove.push_back (Unit);
1726+ }
1727+ // Remove the collected units
1728+ for (auto *Unit : UnitsToRemove) {
1729+ BF.removeDWARFUnit (Unit);
17241730 }
17251731 }
17261732
You can’t perform that action at this time.
0 commit comments