-
Notifications
You must be signed in to change notification settings - Fork 2
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
Extract DecodedInst::disassemble
to a fmt
module?
#4
Comments
I think a good approach might be to see how far we can push a |
This is my attempt at wrapping xed_format_generic in an idiomatic wrapper. I'm rather happy with how it turned out. This PR introduces three function variants to cover the different use cases for xed_format_generic. All three are methods of `DecodedInst`. fn disassemble(&self, syntax: Syntax) -> String This is the simplest one. No configuration, just provide a syntax and get a disassembly string. fn disassemble_with<F>(&self, options: DisassembleOptions<F>) -> String More complex. Now you configure it by passing in options. This variant is still infallible so it probably won't work with any complicated disassembly callback. In order to be infallible it requires that the callback's error type is std::convert::Infallible. fn try_disassemble_with<F>(&self, options: DisassembleOptions<F>) -> Result<String, F::Error> This one supports the most options. It supports any disassembly callback and takes care of plumbing the error around in the XED callback. There are a couple of different types that are used as part of this API. I've created a new top-level `disassemble` module and stuck them in there. It also gives a convenient place to stick some guide level documentation and example on how to use the API. Closes rust-xed#4
I took a shot at wrapping Would appreciate some opinions on it. |
There are a lot options about
disassemble
, we may need afmt
module for it, and need consider the issue of symbol resolution base on the context.The text was updated successfully, but these errors were encountered: