Page MenuHomePhabricator

[DebugInfo] Support zero-length CIE in the _eh_frame parser
ClosedPublic

Authored by igor-laevsky on Jan 26 2016, 9:37 AM.

Details

Summary

MCJIT emits zero-length CIE at the end of the _eh_frame section. This change
ensures that parser inside DebugInfo will not crash and correctly record such cases.
We are now recording DW_EH_PE_omit as a default value for FDE and LSDA encodings.
This seems to be in sync with MCDwarf.cpp _eh_frame emitter. Also Offset != EndAugmentationOffset
assertion check will only happen if augmentation string had 'z' letter in it.

Unfortunately I couldn't think of an easy way to write llvm-lit tests for this.
However feature seems simple enough to survive using existing tests.

Diff Detail

Repository
rL LLVM

Event Timeline

igor-laevsky retitled this revision from to [DebugInfo] Support zero-length CIE in the _eh_frame parser.
igor-laevsky updated this object.
igor-laevsky added reviewers: pete, dblaikie, rafael.
igor-laevsky set the repository for this revision to rL LLVM.
igor-laevsky updated this object.
igor-laevsky added a subscriber: llvm-commits.
pete accepted this revision.Jan 26 2016, 10:18 AM
pete edited edge metadata.

I took a look at the code in LLVM to emit the eh_frame's and there are paths in there that would allow us to get an eh_frame emitted with omitted LSDA's. I can't really get my head around what it would take to write a test for that either, but the code being able to emit such a thing means I think its good to support it in the parser too.

So after all that, LGTM :)

This revision is now accepted and ready to land.Jan 26 2016, 10:18 AM
rafael edited edge metadata.Jan 26 2016, 10:48 AM
rafael added a subscriber: rafael.

You should be able to test it by writing a .eh_frame manually. In
particularly, the terminator CIE is just

.section .eh_frame
.long 0

No?

Cheers,
Rafael

This revision was automatically updated to reflect the committed changes.

You should be able to test it by writing a .eh_frame manually. In
particularly, the terminator CIE is just

.section .eh_frame
.long 0

Yes, actually this works. For some reason I though it shouldn't. Submitted change with a test case.

ygao added a subscriber: ygao.Feb 1 2016, 3:28 PM
ygao added inline comments.
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
645

I noticed a compile-time warning on this line:
warning: variable ‘LSDA’ set but not used [-Wunused-but-set-variable]