()
| 24 | |
| 25 | # ## Test class Cs |
| 26 | def test_class(): |
| 27 | for (arch, mode, code, comment, syntax) in all_tests: |
| 28 | print('*' * 16) |
| 29 | print("Platform: %s" %comment) |
| 30 | print("Code: %s" % code.hex(' ')) |
| 31 | print("Disasm:") |
| 32 | |
| 33 | try: |
| 34 | md = Cs(arch, mode) |
| 35 | |
| 36 | if syntax is not None: |
| 37 | md.syntax = syntax |
| 38 | |
| 39 | md.skipdata = True |
| 40 | |
| 41 | # Default "data" instruction's name is ".byte". To rename it to "db", just use |
| 42 | # the code below. |
| 43 | md.skipdata_setup = ("db", None, None) |
| 44 | |
| 45 | # NOTE: This example ignores SKIPDATA's callback (first None) & user_data (second None) |
| 46 | # Can also use dedicated setter |
| 47 | #md.skipdata_mnem = 'db' |
| 48 | |
| 49 | # To customize the SKIPDATA callback, use the line below. |
| 50 | #md.skipdata_setup = (".db", testcb, None) |
| 51 | |
| 52 | # Or use dedicated setter with custom parameter |
| 53 | #md.skipdata_callback = (testcb, 42) |
| 54 | |
| 55 | # Or provide just a function |
| 56 | #md.skipdata_callback = testcb |
| 57 | # Note that reading this property will always return a tuple |
| 58 | #assert md.skipdata_callback == (testcb, None) |
| 59 | |
| 60 | for insn in md.disasm(code, 0x1000): |
| 61 | #bytes = binascii.hexlify(insn.bytes) |
| 62 | #print("0x%x:\t%s\t%s\t// hex-code: %s" %(insn.address, insn.mnemonic, insn.op_str, bytes)) |
| 63 | print("0x%x:\t%s\t%s" % (insn.address, insn.mnemonic, insn.op_str)) |
| 64 | |
| 65 | print("0x%x:" % (insn.address + insn.size)) |
| 66 | |
| 67 | except CsError as e: |
| 68 | print("ERROR: %s" % e) |
| 69 | |
| 70 | |
| 71 | if __name__ == '__main__': |
no test coverage detected
searching dependent graphs…