5 from __future__
import print_function
8 from xprint
import to_hex
11 X86_CODE32 = b
"\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x00\x91\x92"
12 RANDOM_CODE = b
"\xed\x00\x00\x00\x00\x1a\x5a\x0f\x1f\xff\xc2\x09\x80\x00\x00\x00\x07\xf7\xeb\x2a\xff\xff\x7f\x57\xe3\x01\xff\xff\x7f\x57\xeb\x00\xf0\x00\x00\x24\xb2\x4f\x00\x78"
15 (CS_ARCH_X86, CS_MODE_32, X86_CODE32,
"X86 32 (Intel syntax)",
None),
16 (CS_ARCH_ARM, CS_MODE_ARM, RANDOM_CODE,
"Arm",
None),
21 def testcb(buffer, size, offset, userdata):
28 for (arch, mode, code, comment, syntax)
in all_tests:
30 print(
"Platform: %s" %comment)
31 print(
"Code: %s" %
to_hex(code))
37 if syntax
is not None:
44 md.skipdata_setup = (
"db",
None,
None)
61 for insn
in md.disasm(code, 0x1000):
64 print(
"0x%x:\t%s\t%s" % (insn.address, insn.mnemonic, insn.op_str))
66 print(
"0x%x:" % (insn.address + insn.size))
69 print(
"ERROR: %s" % e)
72 if __name__ ==
'__main__':
def testcb(buffer, size, offset, userdata)
def to_hex(s, prefix_0x=True)