pub struct Insn<'a> { /* private fields */ }Expand description
A decoded instruction at its address, with the bytes it was decoded from.
Its Display is its text, as the native decoder writes it by default
(see the crate documentation).
Implementations§
Source§impl<'a> Insn<'a>
impl<'a> Insn<'a>
Sourcepub fn from_x86(
instruction: Instruction,
mode: Mode,
bytes: &'a [u8],
address: u64,
) -> Self
pub fn from_x86( instruction: Instruction, mode: Mode, bytes: &'a [u8], address: u64, ) -> Self
The x86 instruction instruction, which a decode in mode made
from bytes at address, as decode would give it: for code
that keeps native instructions and asks them again, without
decoding twice (binbun’s C API). bytes past the instruction’s
length are left out.
Sourcepub fn from_aarch64(
instruction: Instruction,
bytes: &'a [u8],
address: u64,
) -> Self
pub fn from_aarch64( instruction: Instruction, bytes: &'a [u8], address: u64, ) -> Self
The AArch64 instruction instruction, decoded from bytes at
address, as decode would give it; see Insn::from_x86.
Sourcepub const fn bytes(&self) -> &'a [u8]
pub const fn bytes(&self) -> &'a [u8]
The bytes it was decoded from, borrowed from the buffer decoded (AArch64’s are the word, little-endian).
Sourcepub fn mnemonic(&self) -> &'static str
pub fn mnemonic(&self) -> &'static str
The mnemonic its text writes, lower case: on x86 the word after any
prefix words (movsb of rep movsb; call far), on AArch64 after
alias selection, with its suffix (mov, b.eq). The native
mnemonics, XED’s iclass and Arm’s encoding mnemonic, are the native
instruction’s.
Sourcepub fn registers_read(&self) -> Registers
pub fn registers_read(&self) -> Registers
The registers it may read; see Registers.
Sourcepub fn registers_written(&self) -> Registers
pub fn registers_written(&self) -> Registers
The registers it may write; see Registers.
Sourcepub const fn as_x86(&self) -> Option<&Instruction>
pub const fn as_x86(&self) -> Option<&Instruction>
The x86 decoder’s instruction, if it is one.
Sourcepub const fn as_aarch64(&self) -> Option<&Instruction>
pub const fn as_aarch64(&self) -> Option<&Instruction>
The AArch64 decoder’s instruction, if it is one.