You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
keystone/suite/regress/x86_lea_label_addr.py

25 lines
545 B

#!/usr/bin/python
# Ingmar Steen, 2016
# This is to test whether labels are offset by the addr provided to ks.asm.
# Github issue: #32
# Author: Ingmar Steen
from keystone import *
import regress
class TestX86LeaLabel(regress.RegressTest):
def runTest(self):
# Initialize Keystone engine
ks = Ks(KS_ARCH_X86, KS_MODE_32)
encoding, count = ks.asm(b"lea eax, [__data]\n__data:", 0x480000)
self.assertEqual(encoding, [ 0x8d, 0x05, 0x06, 0x00, 0x48, 0x00 ])
if __name__ == '__main__':
regress.main()