Dynasm-rs: dump assembly instructions instead of machine code?

dynasm-rs: https://github.com/CensoredUsername/dynasm-rs

Is there a way to get dynasm to dump assembly instructions instead of machine code ? This sounds silly: an assembler that dumps asm instead of machine code is kind of pointless. The context / use case is this: I'm playing with a toy JIT. I want to dump the asm that the JIT produces. The way dynasm works is that it it is a rust procedural macro that is called in many different places.

After the dynasm! macro is called in lots of different places (possibly inside loops / nested function calls), I want a way to get the equivalent asm (instead of machine code)

(Looking at the src of the default assemblers, it seems them only keep track of a Vec<u8>, i.e. the machine code, but not the intermediate instructions.)

As workaround you can use a disassembler like capstone which has rust bindings:


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.