CapstoneImpl.customMnemonic

Defines a custom mnemonic for a specified instruction id

class CapstoneImpl(TInstructionId, TInstruction)
void
customMnemonic
(
in TInstructionId id
,
in string mnem = null
)

Examples

enum X86_CODE32 = cast(ubyte[])"\x75\x01";
auto cs = new CapstoneX86(ModeFlags(Mode.bit32));

// Customize mnemonic JNE to JNZ
cs.customMnemonic(X86InstructionId.jne, "jnz");

foreach(instr; cs.disasm(X86_CODE32, 0x1000))
    writefln("%s\t%s", instr.mnemonic, instr.opStr);

// Reset engine to use the default mnemonic of JNE
cs.customMnemonic(X86InstructionId.jne);

foreach(instr; cs.disasm(X86_CODE32, 0x1000))
    writefln("%s\t%s", instr.mnemonic, instr.opStr);

Meta