def test_cmp(self): seq = [4, 4, 8, 128, 4, 8, 4, 4, 12] pp1 = pattern.PinnedPointers(seq[1:], self.sig, self.offset + 1) pp2 = pattern.PinnedPointers(seq[1:-1], self.sig, self.offset + 1) pp3 = pattern.PinnedPointers(seq[:-1], self.sig, self.offset + 1) pp4 = pattern.PinnedPointers(seq[:], self.sig, self.offset + 1) seq = [4, 8, 4, 128, 4, 8, 4, 4, 12] pp5 = pattern.PinnedPointers(seq, self.sig, self.offset) self.assertNotEqual(pp1, self.pp) self.assertNotEqual(pp2, self.pp) self.assertNotEqual(pp3, self.pp) self.assertEqual(pp4, self.pp) self.assertNotEqual(pp5, self.pp)
def setUp(self): # PP.P...[..].PP.PPP..P self.seq = [4, 4, 8, 128, 4, 8, 4, 4, 12] self.offset = 1 # offset of the pinned pointer sequence in the sig self.name = 'test_dump_1' self.sig = makeSignature(self.seq) self.pp = pattern.PinnedPointers(self.seq, self.sig, self.offset)
def test_cmp(self): #seq = [4, 4, 8, 128, 4, 8, 4, 4, 12] pp1 = pattern.PinnedPointers(self.seq[1:], self.sig, self.offset + 1, self.word_size) pp2 = pattern.PinnedPointers(self.seq[1:-1], self.sig, self.offset + 1, self.word_size) pp3 = pattern.PinnedPointers(self.seq[:-1], self.sig, self.offset + 1, self.word_size) pp4 = pattern.PinnedPointers(self.seq[:], self.sig, self.offset + 1, self.word_size) #seq = [4, 8, 4, 128, 4, 8, 4, 4, 12] seq = [8, 16, 8, 256, 8, 16, 8, 8, 24] pp5 = pattern.PinnedPointers(seq, self.sig, self.offset, self.word_size) self.assertNotEqual(pp1, self.pp) self.assertNotEqual(pp2, self.pp) self.assertNotEqual(pp3, self.pp) self.assertEqual(pp4, self.pp) self.assertNotEqual(pp5, self.pp)
def setUp(self): # .....PP.P...[..].PP.PPP..P self.seq = [4, 4, 8, 128, 4, 8, 4, 4, 12] self.offset = 1 # we need to skip the start -> first pointer part self.name = 'struct_1' self.sig = makeSignature(self.seq) self.pp = pattern.PinnedPointers(self.seq, self.sig, self.offset) self.astruct = pattern.AnonymousStructRange(self.pp)
def setUp(self): super(TestPinnedPointers, self).setUp() # PP.P...[..].PP.PPP..P # forcing it on these unittest #self._target_platform = _target_platform.make_target_linux_32() #self.seq = [4, 4, 8, 128, 4, 8, 4, 4, 12] self.offset = 1 # offset of the pinned pointer sequence in the sig self.name = 'test_dump_1' self.sig = self._make_signature(self.seq) self.pp = pattern.PinnedPointers(self.seq, self.sig, self.offset, self.word_size)
def setUp(self): super(TestAnonymousStructRange, self).setUp() # .....PP.P...[..].PP.PPP..P # forcing it on these unittest #self._target_platform = _target_platform.make_target_linux_32() #self.seq = [4, 4, 8, 128, 4, 8, 4, 4, 12] self.offset = 1 # we need to skip the start -> first pointer part self.name = 'struct_1' self.sig = self._make_signature(self.seq) self.pp = pattern.PinnedPointers(self.seq, self.sig, self.offset, self.word_size) self.astruct = pattern.AnonymousStructRange(self.pp, self.word_size)