aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/asm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/asm.rs')
-rw-r--r--src/asm.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/asm.rs b/src/asm.rs
index 8647e83..1790e4e 100644
--- a/src/asm.rs
+++ b/src/asm.rs
@@ -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);