-
Notifications
You must be signed in to change notification settings - Fork 78
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
capstone ints and enums #56
Comments
I was curious about what the process would be like so for consideration: I did not update the documentation to clearly reflect the changes, and there are still a number of arch specific enums that would need to be converted to work cleanly in the model above. It was more a PoC to show myself if it would be a fair way to tackle the above issue. |
Thanks for filing the issue! I see what you are saying, Possible solutions:
For the short-term, I think we can go with (1) is the easiest. The other methods require more work. It should be easy enough to do. Please feel free to file PRs! |
Also, to do what you wanted, with the current fn is_valid_ret(insn: Insn) -> bool {
match insn.id().0 {
x if x == arch::x86::X86Insn::X86_INS_RET as InsnIdInt => true,
_ => false
}
} |
Thanks for the ideas! I also worry about the type safety but I think most people would be familiar with that specific usage pattern from capstone and other bindings. I would be happy to clean up my existing const branch (option 1) and make pull requests on both this project and -sys. |
I am also having this issue. |
I ran into a problem with matching instruction id's to their enum counter parts defined in capstone-sys. Because rust does not have a provide a simple/safe way to cast a u32 to an enum value matching something like instruction id's to a list of possible instructions seems to get tricky.
This applies to instruction ID's as well as reg_ids, op_types and all the other capstone-sys enums.
For example it would be nice to have code as clean as:
Maybe the bindgen could be changed for capstone-sys to output constants instead of enums for these types of values? Or am I missing something defined in capstone-sys?
The text was updated successfully, but these errors were encountered: