Crate capstone [−] [src]
Bindings to the capstone library disassembly framework.
This crate is a wrapper around the Capstone disassembly library, a "lightweight multi-platform, multi-architecture disassembly framework."
The Capstone
struct is the main interface to the library.
extern crate capstone; const CODE: &'static [u8] = b"\x55\x48\x8b\x05\xb8\x13\x00\x00"; fn main() { match capstone::Capstone::new(capstone::Arch::X86, capstone::Mode::LittleEndian) { Ok(cs) => { match cs.disasm_all(CODE, 0x1000) { Ok(insns) => { println!("Got {} instructions", insns.len()); for i in insns.iter() { println!("{}", i); } }, Err(err) => { println!("Error: {}", err) } } }, Err(err) => { println!("Error: {}", err) } } }
Produces:
Got 2 instructions
0x1000: push rbp
0x1001: mov rax, qword ptr [rip + 0x13b8]
Structs
Capstone |
An instance of the capstone disassembler |
Detail |
A wrapper for the raw capstone-sys detail struct, which contains register information in addition to architecture specific information |
Insn |
A wrapper for the raw capstone-sys instruction |
InstructionIterator |
An iterator over the instructions returned by disasm |
Instructions |
Representation of the array of instructions returned by disasm |
Enums
Arch |
Architectures for the disassembler |
CapstoneError | |
Error |
An error enum for this library |
Mode |
Disassembler modes |
Type Definitions
CsResult |