Skip to content
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

Warn when we can't read compressed debug info. #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions src/bloaty.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ struct File {
StringPiece debug_abbrev;
StringPiece debug_aranges;
StringPiece debug_line;
StringPiece zdebug_info;
StringPiece zdebug_types;
StringPiece zdebug_str;
StringPiece zdebug_abbrev;
StringPiece zdebug_aranges;
StringPiece zdebug_line;
};

} // namespace dwarf
Expand Down
12 changes: 10 additions & 2 deletions src/dwarf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,11 @@ static bool ReadDWARFDebugInfo(const dwarf::File& file,
bool ReadDWARFCompileUnits(const dwarf::File& file, const SymbolTable& symtab,
RangeSink* sink) {
if (!file.debug_info.size()) {
fprintf(stderr, "bloaty: missing debug info\n");
if (file.zdebug_info.size()) {
fprintf(stderr, "bloaty: can't read compressed debug info: \n");
} else {
fprintf(stderr, "bloaty: missing debug info\n");
}
return false;
}

Expand All @@ -1805,7 +1809,11 @@ static std::string LineInfoKey(const std::string& file, uint32_t line,
bool ReadDWARFInlines(const dwarf::File& file, RangeSink* sink,
bool include_line) {
if (!file.debug_info.size() || !file.debug_line.size()) {
fprintf(stderr, "bloaty: missing debug info\n");
if (file.zdebug_info.size() && file.zdebug_line.size()) {
fprintf(stderr, "bloaty: can't read compressed debug info: \n");
} else {
fprintf(stderr, "bloaty: missing debug info\n");
}
return false;
}

Expand Down
10 changes: 10 additions & 0 deletions src/elf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,16 @@ static bool ReadDWARFSections(const ElfFile& elf, dwarf::File* dwarf) {
dwarf->debug_abbrev = section.contents();
} else if (name == ".debug_line") {
dwarf->debug_line = section.contents();
} else if (name == ".zdebug_aranges") {
dwarf->zdebug_aranges = section.contents();
} else if (name == ".zdebug_str") {
dwarf->zdebug_str = section.contents();
} else if (name == ".zdebug_info") {
dwarf->zdebug_info = section.contents();
} else if (name == ".zdebug_abbrev") {
dwarf->zdebug_abbrev = section.contents();
} else if (name == ".zdebug_line") {
dwarf->zdebug_line = section.contents();
}
}

Expand Down