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

Functions

def print_insn_detail (insn)
 
def test_class ()
 

Variables

string SYSZ_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\xec\x18\x00\x00\xc1\x7f"
 
tuple all_tests
 

Function Documentation

◆ print_insn_detail()

def test_systemz.print_insn_detail (   insn)

Definition at line 18 of file test_systemz.py.

18 def print_insn_detail(insn):
19  # print address, mnemonic and operands
20  print("0x%x:\t%s\t%s" % (insn.address, insn.mnemonic, insn.op_str))
21 
22  # "data" instruction generated by SKIPDATA option has no detail
23  if insn.id == 0:
24  return
25 
26  if len(insn.operands) > 0:
27  print("\top_count: %u" % len(insn.operands))
28  c = 0
29  for i in insn.operands:
30  if i.type == SYSZ_OP_REG:
31  print("\t\toperands[%u].type: REG = %s" % (c, insn.reg_name(i.reg)))
32  if i.type == SYSZ_OP_ACREG:
33  print("\t\toperands[%u].type: ACREG = %u" % (c, i.reg))
34  if i.type == SYSZ_OP_IMM:
35  print("\t\toperands[%u].type: IMM = 0x%s" % (c, to_x(i.imm)))
36  if i.type == SYSZ_OP_MEM:
37  print("\t\toperands[%u].type: MEM" % c)
38  if i.mem.base != 0:
39  print("\t\t\toperands[%u].mem.base: REG = %s" \
40  % (c, insn.reg_name(i.mem.base)))
41  if i.mem.index != 0:
42  print("\t\t\toperands[%u].mem.index: REG = %s" \
43  % (c, insn.reg_name(i.mem.index)))
44  if i.mem.length != 0:
45  print("\t\t\toperands[%u].mem.length: 0x%s" \
46  % (c, to_x(i.mem.length)))
47  if i.mem.disp != 0:
48  print("\t\t\toperands[%u].mem.disp: 0x%s" \
49  % (c, to_x(i.mem.disp)))
50  c += 1
51 
52  if insn.cc:
53  print("\tConditional code: %u" % insn.cc)
54 
55 
56 # ## Test class Cs
size_t len
Definition: 6502dis.c:15
def print_insn_detail(insn)
Definition: test_systemz.py:18
def to_x(s)
Definition: xprint.py:29

References len, and xprint.to_x().

Referenced by test_class().

◆ test_class()

def test_systemz.test_class ( )

Definition at line 57 of file test_systemz.py.

57 def test_class():
58 
59  for (arch, mode, code, comment) in all_tests:
60  print("*" * 16)
61  print("Platform: %s" %comment)
62  print("Code: %s" % to_hex(code))
63  print("Disasm:")
64 
65  try:
66  md = Cs(arch, mode)
67  md.detail = True
68  for insn in md.disasm(code, 0x1000):
69  print_insn_detail(insn)
70  print ()
71  print("0x%x:\n" % (insn.address + insn.size))
72  except CsError as e:
73  print("ERROR: %s" %e)
74 
75 
def test_class()
Definition: test_systemz.py:57
def to_hex(s, prefix_0x=True)
Definition: xprint.py:9

References print_insn_detail(), and xprint.to_hex().

Variable Documentation

◆ all_tests

tuple test_systemz.all_tests
Initial value:
1 = (
2  (CS_ARCH_SYSZ, 0, SYSZ_CODE, "SystemZ"),
3 )

Definition at line 13 of file test_systemz.py.

◆ SYSZ_CODE

string test_systemz.SYSZ_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\xec\x18\x00\x00\xc1\x7f"

Definition at line 11 of file test_systemz.py.