diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2019-02-12 12:14:28 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2019-02-12 14:04:35 +0100 |
| commit | 99abc78b76318b6da934bc526b664475676129c2 (patch) | |
| tree | fb357bfb5bd4ca45c2b729c922a3ac6f00a79f3d /test | |
| parent | 9ffed7e967dc0a458a1f370de6bf738592056047 (diff) | |
| download | miasm-99abc78b76318b6da934bc526b664475676129c2.tar.gz miasm-99abc78b76318b6da934bc526b664475676129c2.zip | |
Remove old api support
Diffstat (limited to 'test')
| -rwxr-xr-x | test/ir/symbexec.py | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/test/ir/symbexec.py b/test/ir/symbexec.py index 00ef7c10..4f01ac3c 100755 --- a/test/ir/symbexec.py +++ b/test/ir/symbexec.py @@ -26,28 +26,34 @@ class TestSymbExec(unittest.TestCase): id_d = ExprId('d', 32) id_e = ExprId('e', 64) - sb = SymbolicExecutionEngine(ira, - { - ExprMem(ExprInt(0x4, 32), 8): ExprInt(0x44, 8), - ExprMem(ExprInt(0x5, 32), 8): ExprInt(0x33, 8), - ExprMem(ExprInt(0x6, 32), 8): ExprInt(0x22, 8), - ExprMem(ExprInt(0x7, 32), 8): ExprInt(0x11, 8), + class CustomSymbExec(SymbolicExecutionEngine): + def mem_read(self, expr): + if expr == ExprMem(ExprInt(0x1000, 32), 32): + return id_x + return super(CustomSymbExec, self).mem_read(expr) - ExprMem(ExprInt(0x20, 32), 32): id_x, + sb = CustomSymbExec(ira, + { + ExprMem(ExprInt(0x4, 32), 8): ExprInt(0x44, 8), + ExprMem(ExprInt(0x5, 32), 8): ExprInt(0x33, 8), + ExprMem(ExprInt(0x6, 32), 8): ExprInt(0x22, 8), + ExprMem(ExprInt(0x7, 32), 8): ExprInt(0x11, 8), - ExprMem(ExprInt(0x40, 32), 32): id_x, - ExprMem(ExprInt(0x44, 32), 32): id_a, + ExprMem(ExprInt(0x20, 32), 32): id_x, - ExprMem(ExprInt(0x54, 32), 32): ExprInt(0x11223344, 32), + ExprMem(ExprInt(0x40, 32), 32): id_x, + ExprMem(ExprInt(0x44, 32), 32): id_a, - ExprMem(id_a, 32): ExprInt(0x11223344, 32), - id_a: ExprInt(0, 32), - id_b: ExprInt(0, 32), + ExprMem(ExprInt(0x54, 32), 32): ExprInt(0x11223344, 32), - ExprMem(id_c, 32): ExprMem(id_d + ExprInt(0x4, 32), 32), - ExprMem(id_c + ExprInt(0x4, 32), 32): ExprMem(id_d + ExprInt(0x8, 32), 32), + ExprMem(id_a, 32): ExprInt(0x11223344, 32), + id_a: ExprInt(0, 32), + id_b: ExprInt(0, 32), - }) + ExprMem(id_c, 32): ExprMem(id_d + ExprInt(0x4, 32), 32), + ExprMem(id_c + ExprInt(0x4, 32), 32): ExprMem(id_d + ExprInt(0x8, 32), 32), + + }) self.assertEqual(sb.eval_expr(ExprInt(1, 32)-ExprInt(1, 32)), ExprInt(0, 32)) @@ -101,14 +107,6 @@ class TestSymbExec(unittest.TestCase): self.assertEqual(sb.eval_expr(ExprMem(ExprInt(0x100, 32), 32)), ExprMem(ExprInt(0x100, 32), 32)) self.assertEqual(sb.eval_expr(ExprMem(id_c + ExprInt(0x2, 32), 32)), ExprMem(id_d + ExprInt(0x6, 32), 32)) - ## Func read - def custom_func_read(mem): - if mem == ExprMem(ExprInt(0x1000, 32), 32): - return id_x - return mem - - sb.func_read = custom_func_read - ## Unmodified read self.assertEqual(sb.eval_expr(ExprMem(ExprInt(4, 32), 8)), ExprInt(0x44, 8)) |