Skip to main content

x86_decode_single

Function x86_decode_single 

pub fn x86_decode_single(
    bytes: &[u8],
    bitness: u32,
    base_address: u64,
    offset: u64,
) -> Result<X86DecodedInstruction>
Expand description

Decode a single instruction at the given offset.

This is useful for on-demand decoding during analysis, such as when exploring indirect jump targets or validating specific code locations.

§Arguments

  • bytes - The x86/x64 machine code bytes
  • bitness - 32 for x86, 64 for x64
  • base_address - The base address (RVA) of the code
  • offset - Offset within bytes to decode at

§Returns

The decoded instruction at the specified offset.

§Errors

Returns crate::Error::X86Error if:

  • bytes is empty
  • bitness is not 32 or 64
  • offset is beyond the end of bytes
  • The instruction at offset is invalid