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