Crate lde [−] [src]
Length Disassembler Engine
Supports x86
and x86_64
up to SSE4.2
.
Valid opcodes will be length disassembled correctly. Invalid opcodes may be rejected on a best-effort basis.
Examples
Get the length of the first opcode in a byte slice.
use lde::{InsnSet, x64}; assert_eq!(x64::ld(b"\x40\x55\x48\x83\xEC\xFC\x00\x80"), 2);
Iterate over the opcodes contained in a byte slice, returning the opcode and its virtual address.
use lde::{InsnSet, x64}; let mut it = x64::lde(b"\x40\x55\x48\x83\xEC*\x00\x80", 0x1000); assert_eq!(it.next(), Some(x64::code(b"\x40\x55", 0x1000))); assert_eq!(it.next(), Some(x64::code(b"\x48\x83\xEC*", 0x1002))); assert_eq!(it.next(), None);
Custom Display
and Debug
formatting including pretty printing support with #
.
use lde::{InsnSet, x64}; let it = x64::lde(b"\x40\x55\x48\x83\xEC*\x00\x80", 0); assert_eq!(format!("{:?}", it), "[4055] [4883EC2A] 0080"); assert_eq!(format!("{:#?}", it), "[40 55] [48 83 EC 2A] 00 80"); assert_eq!(format!("{:}", it), "4055\n4883EC2A\n"); assert_eq!(format!("{:#}", it), "40 55\n48 83 EC 2A\n");
Modules
ext |
Experimental extensions. |
Structs
LDE |
Length Disassembler Engine. |
OpCode |
Byte slice representing an opcode. |
x64 |
Length disassembler for the |
x86 |
Length disassembler for the |
Traits
InsnSet |
Declares the entry point for an instruction set's length disassembler. |
Int |
Defines a type which can be safely constructed from a byte array of the same size. |
VirtualAddr |