Rizin
unix-like reverse engineering framework and cli tools
test_customized_mnem Namespace Reference

Functions

def print_insn (md, code)
 
def test ()
 

Variables

string X86_CODE32 = b"\x75\x01"
 

Function Documentation

◆ print_insn()

def test_customized_mnem.print_insn (   md,
  code 
)

Definition at line 14 of file test_customized_mnem.py.

14 def print_insn(md, code):
15  print("%s\t" % to_hex(code, False), end="")
16 
17  for insn in md.disasm(code, 0x1000):
18  print("\t%s\t%s\n" % (insn.mnemonic, insn.op_str))
19 
20 
def to_hex(s, prefix_0x=True)
Definition: xprint.py:9
static void print_insn(csh handle)

References xprint.to_hex().

Referenced by test().

◆ test()

def test_customized_mnem.test ( )

Definition at line 21 of file test_customized_mnem.py.

21 def test():
22  try:
23  md = Cs(CS_ARCH_X86, CS_MODE_32)
24 
25  print("Disassemble X86 code with default instruction mnemonic")
26  print_insn(md, X86_CODE32)
27 
28  print("Now customize engine to change mnemonic from 'JNE' to 'JNZ'")
29  md.mnemonic_setup(X86_INS_JNE, "jnz")
30  print_insn(md, X86_CODE32)
31 
32  print("Reset engine to use the default mnemonic")
33  md.mnemonic_setup(X86_INS_JNE, None)
34  print_insn(md, X86_CODE32)
35  except CsError as e:
36  print("ERROR: %s" % e)
37 
38 

References print_insn().

Referenced by main(), and rz_test_run_test().

Variable Documentation

◆ X86_CODE32

string test_customized_mnem.X86_CODE32 = b"\x75\x01"

Definition at line 11 of file test_customized_mnem.py.