Skip to content

[llvm-gsymutil] Print one-time DWO file missing warning under --quiet flag #79882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,17 +537,27 @@ void DwarfTransformer::handleDie(raw_ostream *OS, CUInfo &CUI, DWARFDie Die) {

Error DwarfTransformer::convert(uint32_t NumThreads, raw_ostream *OS) {
size_t NumBefore = Gsym.getNumFunctionInfos();
std::once_flag flag;
auto getDie = [&](DWARFUnit &DwarfUnit) -> DWARFDie {
DWARFDie ReturnDie = DwarfUnit.getUnitDIE(false);
if (DwarfUnit.getDWOId()) {
DWARFUnit *DWOCU = DwarfUnit.getNonSkeletonUnitDIE(false).getDwarfUnit();
if (OS && !DWOCU->isDWOUnit()) {
std::string DWOName = dwarf::toString(
DwarfUnit.getUnitDIE().find(
{dwarf::DW_AT_dwo_name, dwarf::DW_AT_GNU_dwo_name}),
"");
*OS << "warning: Unable to retrieve DWO .debug_info section for "
<< DWOName << "\n";
if (!DWOCU->isDWOUnit()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is --verbose option. Maybe have the same path for default verbosity and no OS, and print all the files for higher verbosity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the --verbose is only used for lookups. We will need to expose that option (the same way as --quiet) to Transformer level. If we want to go this path I will do it in a separate patch. Let's focus on the changing the --quiet behavior here :D

if (OS) {
std::string DWOName = dwarf::toString(
DwarfUnit.getUnitDIE().find(
{dwarf::DW_AT_dwo_name, dwarf::DW_AT_GNU_dwo_name}),
"");
*OS << "warning: Unable to retrieve DWO .debug_info section for "
<< DWOName << "\n";
} else {
std::call_once(flag, []() {
outs()
<< "warning: Unable to retrieve DWO .debug_info section for "
"some "
"object files. (Remove the --quiet flag for full output)\n";
});
}
} else {
ReturnDie = DWOCU->getUnitDIE(false);
}
Expand Down
Loading