This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Add error handling to DWARFDebugAbbrev::getAbbreviationDeclarationSet
ClosedPublic

Authored by bulbazord on Jun 21 2023, 12:53 PM.

Details

Summary

This gives us more meaningful information when
getAbbreviationDeclarationSet fails. Right now only
verifyAbbrevSection actually uses the error that it returns, but the
other call sites could be rewritten to take advantage of the returned error.

Diff Detail

Event Timeline

bulbazord created this revision.Jun 21 2023, 12:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2023, 12:53 PM
bulbazord requested review of this revision.Jun 21 2023, 12:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2023, 12:53 PM
jhenderson added inline comments.Jun 21 2023, 11:51 PM
llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
167

Not sure why you've added the parentheses? Oh, I see they're there in the other return clauses in this method - but they're unnecessary there too, and should probably be removed to avoid confusion.

llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
157

Comment?

I'm not too familiar with the verifier, but it seems to me that if there's an error parsing the abbrevs, we should report it as a verification failure, including the error's message, rather than throwing away that message. Of course, that isn't part of this patch, hence a FIXME comment would probably be appropriate.

bulbazord updated this revision to Diff 534073.Jun 23 2023, 2:14 PM

Address feedback from @jhenderson

bulbazord marked 2 inline comments as done.Jun 23 2023, 2:14 PM
dblaikie added inline comments.Jun 26 2023, 11:49 AM
llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
162

no need for std::move here, I think? (implicit move from a local variable when you return local)

bulbazord added inline comments.Jun 26 2023, 11:57 AM
llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
162

Last time I did that, some older compilers on some buildbots didn't like it. I added the std::move to be explicit.

jhenderson accepted this revision.Jun 27 2023, 1:05 AM

LGTM, but please wait for @dblaikie too.

This revision is now accepted and ready to land.Jun 27 2023, 1:05 AM
fdeazeve accepted this revision.Jun 27 2023, 5:45 AM

LGTM!

llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
162

The move is required because the return type is Expected so, without the move, we are calling the constructor of Expected with an Error &, and this ctor doesn't exist. We need an Error && for the right ctor to be found

llvm/test/tools/llvm-dwarfdump/X86/empty-CU.s
22

Out of curiosity, do you know what EOM stands for? End of <something>? End <something> Marker?

dblaikie accepted this revision.Jun 27 2023, 10:10 AM

Fine by me

bulbazord marked 3 inline comments as done.Jun 27 2023, 10:11 AM

Thanks all!

llvm/test/tools/llvm-dwarfdump/X86/empty-CU.s
22

I don't know for sure, but I assume it means "End Of" Marker.

This revision was landed with ongoing or failed builds.Jun 27 2023, 10:32 AM
This revision was automatically updated to reflect the committed changes.
bulbazord marked an inline comment as done.