Skip to content

Commit 9677678

Browse files
authored
[llvm-profgen] Print DWP related warnings under show-detailed-warning (llvm#68019)
Printing DWP related warnings under show-detailed-warning so that they won't flood user log.
1 parent 2176c5e commit 9677678

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

llvm/tools/llvm-profgen/ProfiledBinary.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -810,24 +810,31 @@ void ProfiledBinary::loadSymbolsFromDWARF(ObjectFile &Obj) {
810810
loadSymbolsFromDWARFUnit(*CompilationUnit.get());
811811

812812
// Handles DWO sections that can either be in .o, .dwo or .dwp files.
813+
uint32_t NumOfDWOMissing = 0;
813814
for (const auto &CompilationUnit : DebugContext->compile_units()) {
814815
DWARFUnit *const DwarfUnit = CompilationUnit.get();
815816
if (DwarfUnit->getDWOId()) {
816817
DWARFUnit *DWOCU = DwarfUnit->getNonSkeletonUnitDIE(false).getDwarfUnit();
817818
if (!DWOCU->isDWOUnit()) {
818-
std::string DWOName = dwarf::toString(
819-
DwarfUnit->getUnitDIE().find(
820-
{dwarf::DW_AT_dwo_name, dwarf::DW_AT_GNU_dwo_name}),
821-
"");
822-
WithColor::warning()
823-
<< "DWO debug information for " << DWOName
824-
<< " was not loaded. Please check the .o, .dwo or .dwp path.\n";
819+
NumOfDWOMissing++;
820+
if (ShowDetailedWarning) {
821+
std::string DWOName = dwarf::toString(
822+
DwarfUnit->getUnitDIE().find(
823+
{dwarf::DW_AT_dwo_name, dwarf::DW_AT_GNU_dwo_name}),
824+
"");
825+
WithColor::warning() << "DWO debug information for " << DWOName
826+
<< " was not loaded.\n";
827+
}
825828
continue;
826829
}
827830
loadSymbolsFromDWARFUnit(*DWOCU);
828831
}
829832
}
830833

834+
if (NumOfDWOMissing)
835+
WithColor::warning()
836+
<< " DWO debug information was not loaded for " << NumOfDWOMissing
837+
<< " modules. Please check the .o, .dwo or .dwp path.\n";
831838
if (BinaryFunctions.empty())
832839
WithColor::warning() << "Loading of DWARF info completed, but no binary "
833840
"functions have been retrieved.\n";

0 commit comments

Comments
 (0)