Capstone

Encapsulates an instance of the Capstone dissassembly engine

This class encapsulates the core functionality of the Capstone disassembly engine, providing access to runtime options for

  • changing the Mode of interpretation
  • changing the Syntax of the disassembly
  • choosing whether Instruction's should be disassembled in detail, i.e. filling Instruction.detail
  • defining manual handling of broken instructions through the SKIPDATA mode of operation (optionally via a Callback)

Note that, since the architecture is chosen at runtime, this base class only provides access to the architecture-indepentent aspects, e.g. disasm returns Instructions instead of X86Instructions. However, if necessary, it can be casted to the architecture-specific variant, such as CapstoneX86.

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

Handle
alias Handle = size_t
Undocumented in source.

Functions

disasm
const(Instruction)[] disasm(ubyte[] code, ulong address, size_t count)

Disassemble binary code, given the code buffer, start address and number of instructions to be decoded

disasmIter
InstructionRange disasmIter(ubyte[] code, ulong address)

Provides a range to iteratively disassemble binary code - one instruction at a time

setupSkipdata
void setupSkipdata(string mnemonic, Callback callback)

Customises behaviour in SKIPDATA mode of operation

Properties

detail
auto detail [@property getter]

Indicates whether instructions will be disassembled in detail

detail
bool detail [@property setter]

Sets whether instructions will be disassembled in detail

mode
auto mode [@property getter]

Gets the mode of interpretation

mode
ModeFlags mode [@property setter]

Sets the mode of interpretation

skipData
auto skipData [@property getter]

Indicates whether SKIPDATA mode of operation is in use

skipData
bool skipData [@property setter]

Sets whether to use SKIPDATA mode of operation

syntax
auto syntax [@property getter]

Gets the disassembly syntax variant

syntax
Syntax syntax [@property setter]

Sets the disassembly syntax variant

Variables

_detail
bool _detail;
Undocumented in source.
_mode
ModeFlags _mode;
Undocumented in source.
_skipData
bool _skipData;
Undocumented in source.
_syntax
Syntax _syntax;
Undocumented in source.
arch
Arch arch;

The architecture this Capstone instance is set up for

callback
Callback callback;
Undocumented in source.
customMnemonics
string[int] customMnemonics;
Undocumented in source.
handle
Handle handle;
Undocumented in source.
mnemonic
string mnemonic;
Undocumented in source.

Meta