This is an archive of the discontinued LLVM Phabricator instance.

[DWARF] Store CFA value on DW_CFA_remember_state
ClosedPublic

Authored by aengelke on Dec 19 2022, 12:37 PM.

Details

Summary

Previously, CFA_remember_state stored only the register locations but ignored the CFA value. This needs also to be remembered and restored for correct behavior. The problem occurs, e.g., on functions with multiple epilogues, where the CFA value after the first epilogue is becomes wrong.

Diff Detail

Event Timeline

aengelke created this revision.Dec 19 2022, 12:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2022, 12:37 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
aengelke requested review of this revision.Dec 19 2022, 12:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2022, 12:37 PM
MaskRay accepted this revision.EditedJan 3 2023, 11:01 AM
MaskRay added a subscriber: MaskRay.

Looks good. The behavior matches libunwind and libgcc.

This revision is now accepted and ready to land.Jan 3 2023, 11:01 AM
MaskRay added a comment.EditedJan 3 2023, 11:09 AM

DWARF v5 says:

The DW_CFA_remember_state instruction takes no operands. The required action is to push the set of rules for every register onto an implicit stack.

I think it should mention that "the current CFA rule" is saved as well.

Filed an issue on https://dwarfstd.org/Issues.php , waiting for a link.

Thanks! I have no commit access; could you commit this for me (Alexis Engelke <engelke@in.tum.de>)?

Thanks! I have no commit access; could you commit this for me (Alexis Engelke <engelke@in.tum.de>)?

I will wait a bit for further feedback and then push this on your behalf (likely tomorrow) :)

This revision was automatically updated to reflect the committed changes.

DWARF v5 says:

The DW_CFA_remember_state instruction takes no operands. The required action is to push the set of rules for every register onto an implicit stack.

I think it should mention that "the current CFA rule" is saved as well.

Filed an issue on https://dwarfstd.org/Issues.php , waiting for a link.

Got a link: https://dwarfstd.org/ShowIssue.php?issue=230103.1