This is an archive of the discontinued LLVM Phabricator instance.

When unwinding out of a trap handler, fetch the saved pc even if there's a return address register defined
ClosedPublic

Authored by jasonmolenda on Feb 21 2020, 7:36 PM.

Details

Summary

On targets with a return address register (e.g. $lr on arm), when the unwinder is asked to fetch the caller's pc, we rewrite that to fetch the return address value.

However, when we're in a trap handler -- either from an interrupt or an async signal -- we will have a full register context for the frame that was interrupted/trapped. The unwinder correctly allows you to fetch volatile registers when you're above a trap handler. But we are still rewriting the "fetch the pc" request when the trap handler is asked to find the caller's saved pc. This is incorrect, and results in lldb showing the wrong function that was interrupted/faulted.

Diff Detail

Event Timeline

jasonmolenda created this revision.Feb 21 2020, 7:36 PM
This revision was not accepted when it landed; it landed in state Needs Review.Feb 24 2020, 4:18 PM
This revision was automatically updated to reflect the committed changes.