diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/analysis/data_flow.py | 28 | ||||
| -rw-r--r-- | test/analysis/depgraph.py | 46 | ||||
| -rw-r--r-- | test/core/sembuilder.py | 8 | ||||
| -rw-r--r-- | test/expression/expression.py | 2 | ||||
| -rwxr-xr-x | test/expression/expression_helper.py | 4 | ||||
| -rw-r--r-- | test/expression/simplifications.py | 28 | ||||
| -rw-r--r-- | test/ir/ir.py | 4 | ||||
| -rwxr-xr-x | test/ir/symbexec.py | 6 |
8 files changed, 63 insertions, 63 deletions
diff --git a/test/analysis/data_flow.py b/test/analysis/data_flow.py index f2e30172..dff88470 100644 --- a/test/analysis/data_flow.py +++ b/test/analysis/data_flow.py @@ -5,20 +5,20 @@ from miasm2.analysis.data_flow import * from miasm2.ir.analysis import ira from miasm2.ir.ir import IRBlock, AssignBlock -a = ExprId("a") -b = ExprId("b") -c = ExprId("c") -d = ExprId("d") -r = ExprId("r") - -a_init = ExprId("a_init") -b_init = ExprId("b_init") -c_init = ExprId("c_init") -d_init = ExprId("d_init") -r_init = ExprId("r_init") # Return register - -pc = ExprId("pc") -sp = ExprId("sp") +a = ExprId("a", 32) +b = ExprId("b", 32) +c = ExprId("c", 32) +d = ExprId("d", 32) +r = ExprId("r", 32) + +a_init = ExprId("a_init", 32) +b_init = ExprId("b_init", 32) +c_init = ExprId("c_init", 32) +d_init = ExprId("d_init", 32) +r_init = ExprId("r_init", 32) # Return register + +pc = ExprId("pc", 32) +sp = ExprId("sp", 32) CST1 = ExprInt(0x11, 32) CST2 = ExprInt(0x12, 32) diff --git a/test/analysis/depgraph.py b/test/analysis/depgraph.py index 290547fe..9fb046d0 100644 --- a/test/analysis/depgraph.py +++ b/test/analysis/depgraph.py @@ -16,19 +16,19 @@ except ImportError: EMULATION = False STEP_COUNTER = count() -A = ExprId("a") -B = ExprId("b") -C = ExprId("c") -D = ExprId("d") -R = ExprId("r") +A = ExprId("a", 32) +B = ExprId("b", 32) +C = ExprId("c", 32) +D = ExprId("d", 32) +R = ExprId("r", 32) -A_INIT = ExprId("a_init") -B_INIT = ExprId("b_init") -C_INIT = ExprId("c_init") -D_INIT = ExprId("d_init") +A_INIT = ExprId("a_init", 32) +B_INIT = ExprId("b_init", 32) +C_INIT = ExprId("c_init", 32) +D_INIT = ExprId("d_init", 32) -PC = ExprId("pc") -SP = ExprId("sp") +PC = ExprId("pc", 32) +SP = ExprId("sp", 32) CST0 = ExprInt(0x0, 32) CST1 = ExprInt(0x1, 32) @@ -277,8 +277,8 @@ G4_IRA = IRATest() G4_IRB0 = gen_irblock(LBL0, [[ExprAff(C, CST1)]]) G4_IRB1 = gen_irblock(LBL1, [[ExprAff(C, C + CST2)], [ExprAff(G4_IRA.IRDst, - ExprCond(C, ExprId(LBL2), - ExprId(LBL1)))]]) + ExprCond(C, ExprId(LBL2, 32), + ExprId(LBL1, 32)))]]) G4_IRB2 = gen_irblock(LBL2, [[ExprAff(A, B)]]) @@ -296,8 +296,8 @@ G5_IRA = IRATest() G5_IRB0 = gen_irblock(LBL0, [[ExprAff(B, CST1)]]) G5_IRB1 = gen_irblock(LBL1, [[ExprAff(B, B + CST2)], [ExprAff(G5_IRA.IRDst, - ExprCond(B, ExprId(LBL2), - ExprId(LBL1)))]]) + ExprCond(B, ExprId(LBL2, 32), + ExprId(LBL1, 32)))]]) G5_IRB2 = gen_irblock(LBL2, [[ExprAff(A, B)]]) @@ -400,16 +400,16 @@ G13_IRA = IRATest() G13_IRB0 = gen_irblock(LBL0, [[ExprAff(A, CST1)], #[ExprAff(B, A)], [ExprAff(G13_IRA.IRDst, - ExprId(LBL1))]]) + ExprId(LBL1, 32))]]) G13_IRB1 = gen_irblock(LBL1, [[ExprAff(C, A)], #[ExprAff(A, A + CST1)], [ExprAff(G13_IRA.IRDst, - ExprCond(R, ExprId(LBL2), - ExprId(LBL1)))]]) + ExprCond(R, ExprId(LBL2, 32), + ExprId(LBL1, 32)))]]) G13_IRB2 = gen_irblock(LBL2, [[ExprAff(B, A + CST3)], [ExprAff(A, B + CST3)], [ExprAff(G13_IRA.IRDst, - ExprId(LBL1))]]) + ExprId(LBL1, 32))]]) G13_IRB3 = gen_irblock(LBL3, [[ExprAff(R, C)]]) @@ -427,18 +427,18 @@ G14_IRA = IRATest() G14_IRB0 = gen_irblock(LBL0, [[ExprAff(A, CST1)], [ExprAff(G14_IRA.IRDst, - ExprId(LBL1))] + ExprId(LBL1, 32))] ]) G14_IRB1 = gen_irblock(LBL1, [[ExprAff(B, A)], [ExprAff(G14_IRA.IRDst, - ExprCond(C, ExprId(LBL2), - ExprId(LBL3)))] + ExprCond(C, ExprId(LBL2, 32), + ExprId(LBL3, 32)))] ]) G14_IRB2 = gen_irblock(LBL2, [[ExprAff(D, A)], [ExprAff(A, D + CST1)], [ExprAff(G14_IRA.IRDst, - ExprId(LBL1))] + ExprId(LBL1, 32))] ]) G14_IRB3 = gen_irblock(LBL3, [[ExprAff(R, D + B)]]) diff --git a/test/core/sembuilder.py b/test/core/sembuilder.py index 70d6d5ec..ebf9f385 100644 --- a/test/core/sembuilder.py +++ b/test/core/sembuilder.py @@ -8,7 +8,7 @@ from miasm2.core.asmblock import AsmLabel # Test classes class IR(object): - IRDst = m2_expr.ExprId("IRDst") + IRDst = m2_expr.ExprId("IRDst", 32) def get_next_instr(self, _): return AsmLabel("NEXT") @@ -41,9 +41,9 @@ def test(Arg1, Arg2, Arg3): else: alias = {i16(4), i8(5)} -a = m2_expr.ExprId('A') -b = m2_expr.ExprId('B') -c = m2_expr.ExprId('C') +a = m2_expr.ExprId('A', 32) +b = m2_expr.ExprId('B', 32) +c = m2_expr.ExprId('C', 32) ir = IR() instr = Instr() res = test(ir, instr, a, b, c) diff --git a/test/expression/expression.py b/test/expression/expression.py index ac145a04..6bb6d94c 100644 --- a/test/expression/expression.py +++ b/test/expression/expression.py @@ -15,7 +15,7 @@ assert big_cst.size == 0x1000 # Possible values #- Common constants -A = ExprId("A") +A = ExprId("A", 32) cond1 = ExprId("cond1", 1) cond2 = ExprId("cond2", 16) cst1 = ExprInt(1, 32) diff --git a/test/expression/expression_helper.py b/test/expression/expression_helper.py index a4c221e9..35873ca4 100755 --- a/test/expression/expression_helper.py +++ b/test/expression/expression_helper.py @@ -12,8 +12,8 @@ class TestExpressionExpressionHelper(unittest.TestCase): # Build a complex expression cst = m2_expr.ExprInt(0x100, 16) - eax = m2_expr.ExprId("EAX") - ebx = m2_expr.ExprId("EBX") + eax = m2_expr.ExprId("EAX", 32) + ebx = m2_expr.ExprId("EBX", 32) ax = eax[0:16] expr = eax + ebx expr = m2_expr.ExprCompose(ax, expr[16:32]) diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py index ad420621..1e8e73ba 100644 --- a/test/expression/simplifications.py +++ b/test/expression/simplifications.py @@ -8,11 +8,11 @@ from miasm2.expression.simplifications import expr_simp, ExpressionSimplifier from miasm2.expression.simplifications_cond import ExprOp_inf_signed, ExprOp_inf_unsigned, ExprOp_equal # Define example objects -a = ExprId('a') -b = ExprId('b') -c = ExprId('c') -d = ExprId('d') -e = ExprId('e') +a = ExprId('a', 32) +b = ExprId('b', 32) +c = ExprId('c', 32) +d = ExprId('d', 32) +e = ExprId('e', 32) f = ExprId('f', size=64) m = ExprMem(a) @@ -378,17 +378,17 @@ for e, e_check in to_test[:]: -x = ExprId('x') -y = ExprId('y') -z = ExprId('z') -a = ExprId('a') -b = ExprId('b') -c = ExprId('c') +x = ExprId('x', 32) +y = ExprId('y', 32) +z = ExprId('z', 32) +a = ExprId('a', 32) +b = ExprId('b', 32) +c = ExprId('c', 32) -jra = ExprId('jra') -jrb = ExprId('jrb') -jrint1 = ExprId('jrint1') +jra = ExprId('jra', 32) +jrb = ExprId('jrb', 32) +jrint1 = ExprId('jrint1', 32) e1 = ExprMem((a & ExprInt(0xFFFFFFFC, 32)) + ExprInt(0x10, 32), 32) diff --git a/test/ir/ir.py b/test/ir/ir.py index 05936d75..3774e4e9 100644 --- a/test/ir/ir.py +++ b/test/ir/ir.py @@ -2,8 +2,8 @@ from miasm2.expression.expression import * from miasm2.ir.ir import AssignBlock from miasm2.expression.simplifications import expr_simp -id_a = ExprId("a") -id_b = ExprId("b") +id_a = ExprId("a", 32) +id_b = ExprId("b", 32) int0 = ExprInt(0, id_a.size) # Test AssignBlock diff --git a/test/ir/symbexec.py b/test/ir/symbexec.py index f8d8c7bf..492dcfec 100755 --- a/test/ir/symbexec.py +++ b/test/ir/symbexec.py @@ -30,10 +30,10 @@ class TestSymbExec(unittest.TestCase): mem40w = ExprMem(addr40, 16) mem50v = ExprMem(addr50, 8) mem50w = ExprMem(addr50, 16) - id_x = ExprId('x') + id_x = ExprId('x', 32) id_y = ExprId('y', 8) - id_a = ExprId('a') - id_eax = ExprId('eax_init') + id_a = ExprId('a', 32) + id_eax = ExprId('eax_init', 32) e = SymbolicExecutionEngine(ir_x86_32(), {mem0: id_x, mem1: id_y, mem9: id_x, |