diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-12-20 23:35:12 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-12-20 23:35:12 +0100 |
commit | 2bb15c8d75a75f1d75d52ca63017e9492753b8ef (patch) | |
tree | b3d68435d865238f393878c6a5d7cb861fd57646 /src/asm.rs | |
parent | 8ca27aeeb99a0da43e92e39918aa07c0b1443c07 (diff) | |
download | juicebox-asm-2bb15c8d75a75f1d75d52ca63017e9492753b8ef.tar.gz juicebox-asm-2bb15c8d75a75f1d75d52ca63017e9492753b8ef.zip |
disasm: move out and implement on asm/rt
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); |