Exemplo n.º 1
0
 def setUp(self):
     self.a = AutoStoreStack(arch['bytesize'], 3, 1)
     self.var = Var(
         "testVar",
         Loc.RegisterX64('rsi'), 
         Type.Bit64
     )
Exemplo n.º 2
0
 def setUp(self):
     self.ul = Var.UpdateLocationBuilder(arch)
     tpe = Bit64
     loc = Loc.RegisterX64('rax')
     self.var = Var.Var('testVar', loc, tpe)
     self.b = Builder()
     self.ul.toStack(self.b, self.var, 3)
Exemplo n.º 3
0
 def setUp(self):
     self.a = AutoStoreReg(arch['generalPurposeRegisters'])
     self.var = Var(
         "testVar",
         Loc.RegisterX64('r14'), 
         Type.Bit64
     )
     self.a._set('r14', self.var)
Exemplo n.º 4
0
 def setUp(self):
     # arch, sizeSlots, offset
     self.a = AutoStoreX64(arch, 3, 1)
     self.var = Var(
         "testVar",
         Loc.RegisterX64('r14'), 
         Type.Bit64
     )
Exemplo n.º 5
0
 def varRegCreate(self, b, name, regName, tpe, priority):
     '''
     Create a var on a named register.
     If the register has an existing var it is moved to another 
     register or stack. The destination depends on the
     priority of the displaced var, and may cascade.
     Tracked
     '''   
     self._varRegExistingMove(b, regName)
     var = Var(
         name,
         Loc.RegisterX64(regName), 
         tpe
     )
     var.priority = priority
     self.autoReg._set(regName, var)
     return var
Exemplo n.º 6
0
 def test_init(self):
     tpe = Bit64
     loc = Loc.RegisterX64('rsi')
     var = Var.Var('testVar', loc, tpe)
     self.assertEqual(var.tpe, Bit64)
Exemplo n.º 7
0
 def test_init_fail2(self):
     tpe = 'rsi'
     loc = Loc.RegisterX64('rsi')
     with self.assertRaises(Exception):
         Var.Var('testVar', loc, tpe)
Exemplo n.º 8
0
 def test_register_fail2(self):
     with self.assertRaises(Exception):
         Loc.RegisterX64('str1')
Exemplo n.º 9
0
 def test_register(self):
     Loc.RegisterX64('rbx')
Exemplo n.º 10
0
 def test_reg(self):
     loc = Loc.RegisterX64('r12')
     b = AccessAddress(loc)
     with self.assertRaises(AssertionError):
         self.assertEqual(b.result(), 'r12')
Exemplo n.º 11
0
 def test_reg_no_register(self):
     loc = Loc.RegisterX64('r12')
     b = AccessValue(loc)
     b.addRegister('r12')
     with self.assertRaises(AssertionError):
         self.assertEqual(b.result(), '[r12]')
Exemplo n.º 12
0
 def test_reg(self):
     loc = Loc.RegisterX64('r12')
     b = AccessValue(loc)
     self.assertEqual(b.result(), 'r12')