diff options
Diffstat (limited to 'src/asm.rs')
-rw-r--r-- | src/asm.rs | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -42,6 +42,19 @@ impl Asm { self.buf } + /// Disassemble the code currently added to the runtime, using + /// [`ndisasm`](https://nasm.us/index.php) and print it to _stdout_. If + /// `ndisasm` is not available on the system this prints a warning and + /// becomes a nop. + /// + /// # Panics + /// + /// Panics if anything goes wrong with spawning, writing to or reading from + /// the `ndisasm` child process. + pub fn disasm(&self) { + crate::disasm::disasm(&self.buf); + } + /// Emit a slice of bytes. pub(crate) fn emit(&mut self, bytes: &[u8]) { self.buf.extend_from_slice(bytes); |