Crate capstone_sys [] [src]

Capstone low-level binding for Rust.

See Capstone's C language documentation for more information.

Safety

Obviously unsafe.

Every handle shall be initialied first with cs_open.

Examples

TODO

Modules

arm
arm64
mips
ppc
sparc
sysz
x86
xcore

Structs

cs_detail
cs_insn

Information on a disassembled instruction

cs_opt_mem
cs_opt_skipdata

Constants

CS_ARCH_ALL

All architecture for cs_support

CS_ARCH_ARM

ARM architecture (including Thumb, Thumb-2)

CS_ARCH_ARM64

ARM-64, also called AArch64

CS_ARCH_MAX
CS_ARCH_MIPS

Mips architecture

CS_ARCH_PPC

PowerPC architecture

CS_ARCH_SPARC

Sparc architecture

CS_ARCH_SYSZ

SystemZ architecture

CS_ARCH_X86

X86 architecture (including x86 & x86-64)

CS_ARCH_XCORE

XCore architecture

CS_ERR_ARCH

Unsupported architecture: cs_open()

CS_ERR_CSH

Invalid csh argument: cs_close(), cs_errno(), cs_option()

CS_ERR_DETAIL

Information is unavailable because detail option is OFF

CS_ERR_DIET

Access irrelevant data in "diet" engine

CS_ERR_HANDLE

Invalid handle: cs_op_count(), cs_op_index()

CS_ERR_MEM

Out-Of-Memory error: cs_open(), cs_disasm(), cs_disasm_iter()

CS_ERR_MEMSETUP

Dynamic memory management uninitialized (see CS_OPT_MEM)

CS_ERR_MODE

Invalid/unsupported mode: cs_open()

CS_ERR_OK

No error: everything was fine

CS_ERR_OPTION

Invalid/unsupported option: cs_option()

CS_ERR_SKIPDATA

Access irrelevant data for "data" instruction in SKIPDATA mode

CS_ERR_VERSION

Unsupported version (bindings)

CS_ERR_X86_ATT

X86 AT&T syntax is unsupported (opt-out at compile time)

CS_ERR_X86_INTEL

X86 Intel syntax is unsupported (opt-out at compile time)

CS_GRP_CALL

all call instructions

CS_GRP_INT

all interrupt instructions (int+syscall)

CS_GRP_INVALID

uninitialized/invalid group.

CS_GRP_IRET

all interrupt return instructions

CS_GRP_JUMP

all jump instructions (conditional+direct+indirect jumps)

CS_GRP_RET

all return instructions

CS_MODE_16

16-bit mode X86

CS_MODE_32

32-bit mode X86

CS_MODE_64

64-bit mode X86

CS_MODE_ARM

32-bit ARM

CS_MODE_BIG_ENDIAN

big-endian mode

CS_MODE_LITTLE_ENDIAN

Little-endian mode (default mode)

CS_MODE_MCLASS

ARM's Cortex-M series

CS_MODE_MICRO

MicroMips mode (MIPS)

CS_MODE_MIPS3

Mips III ISA

CS_MODE_MIPS32

Mips32 ISA (Mips)

CS_MODE_MIPS32R6

Mips32r6 ISA

CS_MODE_MIPS64

Mips64 ISA (Mips)

CS_MODE_MIPSGP64

General Purpose Registers are 64-bit wide (MIPS)

CS_MODE_THUMB

ARM's Thumb mode, including Thumb-2

CS_MODE_V8

ARMv8 A32 encodings for ARM

CS_MODE_V9

SparcV9 mode (Sparc)

CS_OPT_DETAIL

Break down instruction structure into details

CS_OPT_MEM

User-defined dynamic memory related functions

CS_OPT_MODE

Change engine's mode at run-time

CS_OPT_OFF

Turn OFF an option - default option of CS_OPT_DETAIL, CS_OPT_SKIPDATA.

CS_OPT_ON

Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).

CS_OPT_SKIPDATA

Skip data when disassembling. Then engine is in SKIPDATA mode.

CS_OPT_SKIPDATA_SETUP

Setup user-defined function for SKIPDATA option

CS_OPT_SYNTAX

Assembly output syntax

CS_OPT_SYNTAX_ATT

X86 ATT asm syntax (CS_OPT_SYNTAX).

CS_OPT_SYNTAX_DEFAULT

Default asm syntax (CS_OPT_SYNTAX).

CS_OPT_SYNTAX_INTEL

X86 Intel asm syntax - default on X86 (CS_OPT_SYNTAX).

CS_OPT_SYNTAX_NOREGNAME

Prints register name with only number (CS_OPT_SYNTAX)

CS_OP_FP

Floating-Point operand.

CS_OP_IMM

Immediate operand.

CS_OP_INVALID

Uninitialized/invalid operand.

CS_OP_MEM

Memory operand.

CS_OP_REG

Register operand.

CS_SUPPORT_DIET

Support value to verify diet mode of the engine.

CS_SUPPORT_X86_REDUCE

Support value to verify X86 reduce mode of the engine.

Functions

cs_close

Close a Capstone handle (and zeroed it).

cs_disasm

Disassemble binary code in context of handle, given the code buffer of size code_size, the base address and the desired number (count) of instructions to decode and set a pointer to an array of instructions and returns the number of decoded instructions and the size of the buffers.

cs_disasm_iter

Fast API to disassemble binary code, given the code buffer, size, address and number of instructions to be decoded.

cs_errno

Report the last error number for the given Capstone handle when some API function fail. Like glibc's errno, cs_errno might not retain its old value once accessed.

cs_free

Free a Capstone allocated array of instruction.

cs_group_name
cs_insn_group
cs_insn_name
cs_malloc

Allocate a single instruction to be freed with cs_free(insn, 1).

cs_op_count
cs_op_index
cs_open

Initialize a Capstone handle (non-null pointer) for a given architecture type arch (CS_ARCH_*) and hardware mode (CS_MODE_*).

cs_option

Set option typ with given value for disassembling engine at runtime.

cs_reg_name
cs_reg_read
cs_reg_write
cs_strerror

Return a string describing given error code.

cs_support
cs_version

Return combined API version & major and minor version numbers.

Type Definitions

cs_arch

Architecture type

cs_calloc_t
cs_err

All type of errors encountered by Capstone API. These are values returned by cs_errno()

cs_free_t
cs_group_type

Common instruction groups - to be consistent across all architectures.

cs_malloc_t
cs_mode

Mode type (architecture variant, not all combination are possible)

cs_op_type

Common instruction operand types - to be consistent across all architectures.

cs_opt_type

Runtime option for the disassembled engine

cs_opt_value

Runtime option value (associated with option type above)

cs_realloc_t
cs_skipdata_cb_t
cs_vsnprintf_t
csh

Handle to a Capstone context

size_t