@@ -668,20 +668,12 @@ void DWARFRewriter::updateDebugInfo() {
668
668
auto processSplitCU = [&](DWARFUnit &Unit, DWARFUnit &SplitCU,
669
669
DIEBuilder &DIEBlder,
670
670
DebugRangesSectionWriter &TempRangesSectionWriter,
671
- DebugAddrWriter &AddressWriter) {
671
+ DebugAddrWriter &AddressWriter,
672
+ std::string &DWOName,
673
+ std::optional<std::string> &DwarfOutputPath) {
672
674
DIEBuilder DWODIEBuilder (BC, &(SplitCU).getContext (), DebugNamesTable,
673
675
&Unit);
674
676
DWODIEBuilder.buildDWOUnit (SplitCU);
675
- std::string DWOName = " " ;
676
- std::optional<std::string> DwarfOutputPath =
677
- opts::DwarfOutputPath.empty ()
678
- ? std::nullopt
679
- : std::optional<std::string>(opts::DwarfOutputPath.c_str ());
680
- {
681
- std::lock_guard<std::mutex> Lock (AccessMutex);
682
- DWOName = DIEBlder.updateDWONameCompDir (
683
- *StrOffstsWriter, *StrWriter, Unit, DwarfOutputPath, std::nullopt);
684
- }
685
677
DebugStrOffsetsWriter DWOStrOffstsWriter (BC);
686
678
DebugStrWriter DWOStrWriter ((SplitCU).getContext (), true );
687
679
DWODIEBuilder.updateDWONameCompDirForTypes (
@@ -759,8 +751,16 @@ void DWARFRewriter::updateDebugInfo() {
759
751
DebugRangesSectionWriter *TempRangesSectionWriter =
760
752
CU->getVersion () >= 5 ? RangeListsWritersByCU[*DWOId].get ()
761
753
: LegacyRangesWritersByCU[*DWOId].get ();
754
+ std::string DWOName = " " ;
755
+ std::optional<std::string> DwarfOutputPath =
756
+ opts::DwarfOutputPath.empty ()
757
+ ? std::nullopt
758
+ : std::optional<std::string>(opts::DwarfOutputPath.c_str ());
759
+ std::lock_guard<std::mutex> Lock (AccessMutex);
760
+ DWOName = DIEBlder.updateDWONameCompDir (*StrOffstsWriter, *StrWriter, *CU,
761
+ DwarfOutputPath, std::nullopt);
762
762
processSplitCU (*CU, **SplitCU, DIEBlder, *TempRangesSectionWriter,
763
- AddressWriter);
763
+ AddressWriter, DWOName, DwarfOutputPath );
764
764
}
765
765
for (DWARFUnit *CU : DIEBlder.getProcessedCUs ())
766
766
processMainBinaryCU (*CU, DIEBlder);
0 commit comments