pykd
1
2import unittest3import target4import pykd5
6class CpuRegTest( unittest.TestCase ):7
8def testGetRegName(self):9self.assertNotEqual(None, pykd.getRegisterName(10))10
11def testGetRegValue(self):12for regIndex in range(pykd.getNumberRegisters()):13regName = pykd.getRegisterName(regIndex)14try:15self.assertEqual( pykd.reg(regIndex), pykd.reg(regName) )16except pykd.DbgException:17pass # pass exception unsupported register type18
19def testSetRegValue(self):20
21oldVal = pykd.reg(2)22pykd.setReg(2, 10)23self.assertEqual(pykd.reg(2), 10)24pykd.setReg( pykd.getRegisterName(2), oldVal )25self.assertEqual(pykd.reg(2), oldVal )26
27
28
29#def testCtor(self):30# currentcpu = pykd.cpu()31# cpu0 = pykd.cpu(0)32
33#def testIp(self):34# currentcpu = pykd.cpu()35# self.assertNotEqual( 0, currentcpu.ip )36# self.assertNotEqual( 0, currentcpu.sp )37# self.assertNotEqual( 0, currentcpu.fp )38
39#def testRegEnum(self):40# for r in pykd.cpu():41# pass42
43
44
45