about summary refs log tree commit diff stats
path: root/test/arch
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2020-08-26 14:36:46 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2020-08-31 07:50:01 +0200
commit24ce193b8bad352853a9c5589f6fdcf5177d5466 (patch)
tree2fb59bca2aada9280fb1aecd2ebdd633a23cdc4b /test/arch
parent6f5cb3bef180400001541f56f704f77da0d73429 (diff)
downloadmiasm-24ce193b8bad352853a9c5589f6fdcf5177d5466.tar.gz
miasm-24ce193b8bad352853a9c5589f6fdcf5177d5466.zip
Update api according to loc_db update
Diffstat (limited to '')
-rw-r--r--test/arch/aarch64/unit/asm_test.py4
-rwxr-xr-xtest/arch/arm/sem.py3
-rw-r--r--test/arch/mep/ir/test_ir.py5
-rw-r--r--test/arch/mips32/unit/asm_test.py4
-rwxr-xr-xtest/arch/msp430/sem.py3
-rw-r--r--test/arch/ppc32/sem.py3
-rwxr-xr-xtest/arch/x86/sem.py6
-rw-r--r--test/arch/x86/unit/asm_test.py4
-rw-r--r--test/arch/x86/unit/test_asm_x86_64.py1
9 files changed, 18 insertions, 15 deletions
diff --git a/test/arch/aarch64/unit/asm_test.py b/test/arch/aarch64/unit/asm_test.py
index d6ed5223..d9a484b7 100644
--- a/test/arch/aarch64/unit/asm_test.py
+++ b/test/arch/aarch64/unit/asm_test.py
@@ -26,11 +26,11 @@ class Asm_Test(object):
         self.check()
 
     def asm(self):
-        blocks = parse_asm.parse_txt(mn_aarch64, 'l', self.TXT, self.loc_db)
+        asmcfg = parse_asm.parse_txt(mn_aarch64, 'l', self.TXT, self.loc_db)
         # fix shellcode addr
         self.loc_db.set_location_offset(self.loc_db.get_name_location("main"), 0x0)
         s = StrPatchwork()
-        patches = asmblock.asm_resolve_final(mn_aarch64, blocks, self.loc_db)
+        patches = asmblock.asm_resolve_final(mn_aarch64, asmcfg)
         for offset, raw in viewitems(patches):
             s[offset] = raw
 
diff --git a/test/arch/arm/sem.py b/test/arch/arm/sem.py
index f38d48e9..49d46a4d 100755
--- a/test/arch/arm/sem.py
+++ b/test/arch/arm/sem.py
@@ -16,7 +16,8 @@ from miasm.core.locationdb import LocationDB
 from pdb import pm
 
 logging.getLogger('cpuhelper').setLevel(logging.ERROR)
-EXCLUDE_REGS = set([ir_arch().IRDst])
+loc_db = LocationDB()
+EXCLUDE_REGS = set([ir_arch(loc_db).IRDst])
 
 
 def M(addr):
diff --git a/test/arch/mep/ir/test_ir.py b/test/arch/mep/ir/test_ir.py
index be8e24e1..97a3ec1e 100644
--- a/test/arch/mep/ir/test_ir.py
+++ b/test/arch/mep/ir/test_ir.py
@@ -27,13 +27,14 @@ class TestMisc(object):
             mn = mn_mep.dis(decode_hex(hex_asm), "b")
             print("Dis:", mn)
 
+            loc_db = LocationDB()
+
             # Get the IR
-            im = ir_mepb()
+            im = ir_mepb(loc_db)
             iir, eiir, = im.get_ir(mn)
             print("\nInternal representation:", iir)
 
             # Symbolic execution
-            loc_db = LocationDB()
             sb = SymbolicExecutionEngine(ir_a_mepb(loc_db), regs_init)
 
             # Assign register values before symbolic evaluation
diff --git a/test/arch/mips32/unit/asm_test.py b/test/arch/mips32/unit/asm_test.py
index 164cc143..d6194b00 100644
--- a/test/arch/mips32/unit/asm_test.py
+++ b/test/arch/mips32/unit/asm_test.py
@@ -28,11 +28,11 @@ class Asm_Test(object):
         self.check()
 
     def asm(self):
-        blocks = parse_asm.parse_txt(mn_mips32, 'l', self.TXT, self.loc_db)
+        asmcfg = parse_asm.parse_txt(mn_mips32, 'l', self.TXT, self.loc_db)
         # fix shellcode addr
         self.loc_db.set_location_offset(self.loc_db.get_name_location("main"), 0x0)
         s = StrPatchwork()
-        patches = asmblock.asm_resolve_final(mn_mips32, blocks, self.loc_db)
+        patches = asmblock.asm_resolve_final(mn_mips32, asmcfg)
         for offset, raw in viewitems(patches):
             s[offset] = raw
 
diff --git a/test/arch/msp430/sem.py b/test/arch/msp430/sem.py
index cb101937..2b3c4afe 100755
--- a/test/arch/msp430/sem.py
+++ b/test/arch/msp430/sem.py
@@ -15,7 +15,8 @@ from miasm.expression.expression import *
 from miasm.core.locationdb import LocationDB
 
 logging.getLogger('cpuhelper').setLevel(logging.ERROR)
-EXCLUDE_REGS = set([res, ir_arch().IRDst])
+loc_db = LocationDB()
+EXCLUDE_REGS = set([res, ir_arch(loc_db).IRDst])
 
 
 def M(addr):
diff --git a/test/arch/ppc32/sem.py b/test/arch/ppc32/sem.py
index 95ef08c8..53c93369 100644
--- a/test/arch/ppc32/sem.py
+++ b/test/arch/ppc32/sem.py
@@ -16,7 +16,8 @@ from miasm.core.locationdb import LocationDB
 from pdb import pm
 
 logging.getLogger('cpuhelper').setLevel(logging.ERROR)
-EXCLUDE_REGS = set([ir_arch().IRDst])
+loc_db = LocationDB()
+EXCLUDE_REGS = set([ir_arch(loc_db).IRDst])
 
 
 def M(addr):
diff --git a/test/arch/x86/sem.py b/test/arch/x86/sem.py
index 3d40d44c..9c7e972b 100755
--- a/test/arch/x86/sem.py
+++ b/test/arch/x86/sem.py
@@ -21,9 +21,9 @@ from miasm.expression.simplifications import expr_simp
 from miasm.core import parse_asm, asmblock
 from miasm.core.locationdb import LocationDB
 
-
 logging.getLogger('cpuhelper').setLevel(logging.ERROR)
-EXCLUDE_REGS = set([ir_32().IRDst, ir_64().IRDst])
+loc_db = LocationDB()
+EXCLUDE_REGS = set([ir_32(loc_db).IRDst, ir_64(loc_db).IRDst])
 
 
 m32 = 32
@@ -59,7 +59,7 @@ def compute_txt(ir, mode, txt, inputstate={}, debug=False):
     loc_db = LocationDB()
     asmcfg = parse_asm.parse_txt(mn, mode, txt, loc_db)
     loc_db.set_location_offset(loc_db.get_name_location("main"), 0x0)
-    patches = asmblock.asm_resolve_final(mn, asmcfg, loc_db)
+    patches = asmblock.asm_resolve_final(mn, asmcfg)
     ir_arch = ir(loc_db)
     lbl = loc_db.get_name_location("main")
     ircfg = ir_arch.new_ircfg_from_asmcfg(asmcfg)
diff --git a/test/arch/x86/unit/asm_test.py b/test/arch/x86/unit/asm_test.py
index d3ecf660..62923310 100644
--- a/test/arch/x86/unit/asm_test.py
+++ b/test/arch/x86/unit/asm_test.py
@@ -45,11 +45,11 @@ class Asm_Test(object):
         assert(self.myjit.pc == self.ret_addr)
 
     def asm(self):
-        blocks = parse_asm.parse_txt(mn_x86, self.arch_attrib, self.TXT, self.loc_db)
+        asmcfg = parse_asm.parse_txt(mn_x86, self.arch_attrib, self.TXT, self.loc_db)
         # fix shellcode addr
         self.loc_db.set_location_offset(self.loc_db.get_name_location("main"), 0x0)
         s = StrPatchwork()
-        patches = asmblock.asm_resolve_final(mn_x86, blocks, self.loc_db)
+        patches = asmblock.asm_resolve_final(mn_x86, asmcfg)
         for offset, raw in viewitems(patches):
             s[offset] = raw
 
diff --git a/test/arch/x86/unit/test_asm_x86_64.py b/test/arch/x86/unit/test_asm_x86_64.py
index e1d99ec1..f56770dc 100644
--- a/test/arch/x86/unit/test_asm_x86_64.py
+++ b/test/arch/x86/unit/test_asm_x86_64.py
@@ -29,6 +29,5 @@ dst_interval = interval([(0x100001000, 0x100002000)])
 patches = asmblock.asm_resolve_final(
     my_mn,
     asmcfg,
-    loc_db,
     dst_interval
 )