This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readelf] - Report a warning instead of an error when dumping a broken section header.
ClosedPublic

Authored by grimar on Jun 24 2020, 6:59 AM.

Details

Summary

There is no reason to report an error in printSectionHeaders(), we can report
a warning and continue dumping. This is what the patch does.

Diff Detail

Event Timeline

grimar created this revision.Jun 24 2020, 6:59 AM
Herald added a project: Restricted Project. · View Herald Transcript
MaskRay accepted this revision.Jun 24 2020, 12:09 PM

Thanks!

This revision is now accepted and ready to land.Jun 24 2020, 12:09 PM
jhenderson accepted this revision.Jun 25 2020, 12:45 AM

LGTM, with one suggestion. Thanks!

llvm/tools/llvm-readobj/ELFDumper.cpp
3829–3834

Consider using the following instead to limit the scope of SecStrTableOrErr:

if (Expected<StringRef> SecStrTableOrErr =
    Obj->getSectionStringTable(Sections, this->dumper()->WarningHandler);)
  SecStrTable = *SecStrTableOrErr;
else
  this->reportUniqueWarning(SecStrTableOrErr.takeError());

(I don't mind if you don't want to do that though)

grimar marked an inline comment as done.Jun 25 2020, 1:05 AM
grimar added inline comments.
llvm/tools/llvm-readobj/ELFDumper.cpp
3829–3834

Will do, I like the idea to limit scopes where possible. Thanks!

This revision was automatically updated to reflect the committed changes.