Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add newtype for registers #328

Merged
merged 3 commits into from
Sep 18, 2018
Merged

Add newtype for registers #328

merged 3 commits into from
Sep 18, 2018

Conversation

philipc
Copy link
Collaborator

@philipc philipc commented Sep 16, 2018

  • Add a struct Register(u16). u16 is chosen because the ARM ABI specifies values larger than 256. Replace all register usage with the newtype. Previously we used u8 for CFI and u64 for expressions.

  • Add constants for X86/X86-64 and some ARM registers. Add register_name methods. These are defined within empty structs rather than modules. This gives us the option in future of implementing a trait for these structs (eg register_name may make sense as a trait method, and maybe things like a fn sp() -> Register, although that may be better in the unwinder).

  • Update dwarfdump to use the register names when dumping .eh_frame (but not expressions because they usually have register specific opcodes rather than register numbers).

Fixes #200

Note that this changes the supported register size to u16
(previously u8 for CFI and u64 for expressions).
And print the names in dwarfdump.
Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@philipc philipc merged commit 2e3e14d into gimli-rs:master Sep 18, 2018
@philipc philipc deleted the register branch September 18, 2018 04:10
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.

2 participants