Summary
I've just had my CI update to the recently released 5.0.1 and many of my tests have failed.
One of the reasons is that the operand structure for LDR in 32bit ARM, for 5.0.1 is no longer returning the same values.
Where previously the instruction LDR r1, [r2] had two operands, it now only has one. Tested on macOS and on Linux.
Additionally, the cs_version() has not changed between 5.0.0 and 5.0.1.
Test code
#!/usr/bin/env python
import sys
from capstone import *
import capstone.arm_const
code = b'\x00\x10\x92\xe5' # LDR r1,[r2]
md = Cs(CS_ARCH_ARM, CS_MODE_ARM)
md.detail = True
md.mnemonic_setup(capstone.arm_const.ARM_INS_SVC, "SWI")
# Turn off APCS register naming
md.syntax = capstone.CS_OPT_SYNTAX_NOREGNAME
optype_names = dict((getattr(capstone.arm_const, optype), optype) for optype in dir(capstone.arm_const) if optype.startswith('ARM_OP_'))
print("cs_version() = %r" % (cs_version(),))
for i in md.disasm(code, 0x1000):
print("0x%x:\t%s\t%s" %(i.address, i.mnemonic, i.op_str))
for index, operand in enumerate(i.operands):
print(" op#%i: type=%i (%s)" % (index, operand.type, optype_names.get(operand.type, 'unknown')))
Test output for 4.0.2
cs_version() = (4, 0, 1024)
0x1000: ldr r1, [r2]
op#0: type=1 (ARM_OP_REG)
op#1: type=3 (ARM_OP_MEM)
Test output for 5.0.0
cs_version() = (5, 0, 1280)
0x1000: ldr r1, [r2]
op#0: type=1 (ARM_OP_REG)
op#1: type=3 (ARM_OP_MEM)
Test output for 5.0.1
cs_version() = (5, 0, 1280)
0x1000: ldr r1, [r2]
op#0: type=1 (ARM_OP_REG)
Expected output
The expected output is like the 5.0.0 - we should have two operands described by the operands list in the decoded instruction.
Additionally, notice that the test output is showing 5, 0, 1280 as the cs_version() for both 5.0.0 and 5.0.1, which makes it hard for me to recognise and reject the library that isn't behaving correctly.
Summary
I've just had my CI update to the recently released 5.0.1 and many of my tests have failed.
One of the reasons is that the operand structure for LDR in 32bit ARM, for 5.0.1 is no longer returning the same values.
Where previously the instruction
LDR r1, [r2]had two operands, it now only has one. Tested on macOS and on Linux.Additionally, the cs_version() has not changed between 5.0.0 and 5.0.1.
Test code
Test output for 4.0.2
Test output for 5.0.0
Test output for 5.0.1
Expected output
The expected output is like the 5.0.0 - we should have two operands described by the
operandslist in the decoded instruction.Additionally, notice that the test output is showing
5, 0, 1280as the cs_version() for both 5.0.0 and 5.0.1, which makes it hard for me to recognise and reject the library that isn't behaving correctly.