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

Functions

def to_hex (s)
 
def test_cs_disasm_quick ()
 

Variables

string CODE32 = b"\x48\x01\x05\x15"
 
int _python3 = 3
 
tuple all_tests
 

Function Documentation

◆ test_cs_disasm_quick()

def ppcbranch.test_cs_disasm_quick ( )

Definition at line 42 of file ppcbranch.py.

43  for (arch, mode, code, comment, syntax) in all_tests:
44  print("Platform: %s" % comment)
45  print("Code: %s" %(to_hex(code))),
46  print("Disasm:")
47  for (addr, size, mnemonic, op_str) in cs_disasm_lite(arch, mode, code, 0x1000):
48  print("0x%x:\t%s\t%s" % (addr, mnemonic, op_str))
49  print()
50 
51 
def cs_disasm_lite(arch, mode, code, offset, count=0)
Definition: __init__.py:489
def test_cs_disasm_quick()
Definition: ppcbranch.py:42
def to_hex(s)
Definition: ppcbranch.py:35

References capstone.cs_disasm_lite(), and to_hex().

◆ to_hex()

def ppcbranch.to_hex (   s)

Definition at line 35 of file ppcbranch.py.

35 def to_hex(s):
36  if _python3:
37  return " ".join("0x{0:02x}".format(c) for c in s) # <-- Python 3 is OK
38  else:
39  return " ".join("0x{0:02x}".format(ord(c)) for c in s)
40 
41 # ## Test cs_disasm_quick()

Referenced by test_cs_disasm_quick().

Variable Documentation

◆ _python3

int ppcbranch._python3 = 3
private

Definition at line 28 of file ppcbranch.py.

◆ all_tests

tuple ppcbranch.all_tests
Initial value:
1 = (
2  (CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, CODE32, "PPC branch instruction decoding", 0),
3 )

Definition at line 30 of file ppcbranch.py.

◆ CODE32

string ppcbranch.CODE32 = b"\x48\x01\x05\x15"

Definition at line 9 of file ppcbranch.py.