Struct capstone::prelude::Capstone [−][src]
pub struct Capstone { /* fields omitted */ }
Expand description
An instance of the capstone disassembler
Implementations
Create a new instance of the decompiler using the builder pattern interface.
This is the recommended interface to Capstone
.
use capstone::prelude::*; let cs = Capstone::new().x86().mode(arch::x86::ArchMode::Mode32).build();
Create a new instance of the decompiler using the “raw” interface.
The user must ensure that only sensible Arch
/Mode
combinations are used.
use capstone::{Arch, Capstone, NO_EXTRA_MODE, Mode}; let cs = Capstone::new_raw(Arch::X86, Mode::Mode64, NO_EXTRA_MODE, None); assert!(cs.is_ok());
Disassemble all instructions in buffer
pub fn disasm_count<'a>(
&'a self,
code: &[u8],
addr: u64,
count: usize
) -> CsResult<Instructions<'a>>
pub fn disasm_count<'a>(
&'a self,
code: &[u8],
addr: u64,
count: usize
) -> CsResult<Instructions<'a>>
Disassemble count
instructions in code
pub fn set_extra_mode<T: Iterator<Item = ExtraMode>>(
&mut self,
extra_mode: T
) -> CsResult<()>
pub fn set_extra_mode<T: Iterator<Item = ExtraMode>>(
&mut self,
extra_mode: T
) -> CsResult<()>
Set extra modes in addition to normal mode
Set the assembly syntax (has no effect on some platforms)
Set the endianness (has no effect on some platforms).
Sets the engine’s disassembly mode. Be careful, various combinations of modes aren’t supported See the capstone-sys documentation for more information.
Controls whether to capstone will generate extra details about disassembled instructions.
Pass true
to enable detail or false
to disable detail.
Controls whether capstone will skip over invalid or data instructions.
Pass true
to enable skipdata or false
to disable skipdata.
Converts a register id reg_id
to a String
containing the register name.
Converts an instruction id insn_id
to a String
containing the instruction name.
Note: This function ignores the current syntax and uses the default syntax.
Converts a group id group_id
to a String
containing the group name.
Returns Detail
structure for a given instruction
Requires:
- Instruction was created with detail enabled
- Skipdata is disabled
- Capstone was not compiled in diet mode
Returns a tuple (major, minor) indicating the version of the capstone C library.
Returns whether the capstone library supports a given architecture.