Skip to content

Return an error instead of panicking when encountering unsupported registers during unwind#56

Open
m-mueller678 wants to merge 3 commits into
nbdd0121:trunkfrom
m-mueller678:trunk
Open

Return an error instead of panicking when encountering unsupported registers during unwind#56
m-mueller678 wants to merge 3 commits into
nbdd0121:trunkfrom
m-mueller678:trunk

Conversation

@m-mueller678
Copy link
Copy Markdown

This fixes #55.

I have changed Frame::unwind to return a unit error type instead of a gimli error. The error information is currently discarded at all call sites of Frame::unwind. I have considered two alternatives:

  • introduce a custom error type than can be either a gimli error or an unsupported register error. Given that the information is not used anyway, this feels like needless complexity.
  • reuse the UnsupportedRegister variant of gimli's error type. This feels misleading, especially in the context of gimli's documentation:

    Registers larger than u16 are not supported.

This fixes the problem I had encountered in #55. However, I am unsure of what testing procedures unwind uses. I have only run cargo check and cargo test. The test output looks the same as before my changes.

@nbdd0121
Copy link
Copy Markdown
Owner

nbdd0121 commented Mar 8, 2026

I suppose we might also be able to skip over any unsupported registers when unwinding (for phase 1 / stacktracing only, obviously we can't actually install contexts in such case).

@m-mueller678
Copy link
Copy Markdown
Author

Could that not break unwinding of future frames? I am not very familiar with unwinding, so I do not know how things could break when resuming with wrong register values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

panics when used from x86_64 interrupt handler

2 participants