about summary refs log tree commit diff stats
path: root/test/analysis
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2020-08-22 12:47:01 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2020-08-31 07:50:01 +0200
commit80e40a3d2ca735db955807ad0605b43ca22e4e35 (patch)
tree4d41d7b53565f833444d3520eb22eed3e8bf26f1 /test/analysis
parent5d8beb271d9890241a6d61dd476fab26ca37ebbf (diff)
downloadfocaccia-miasm-80e40a3d2ca735db955807ad0605b43ca22e4e35.tar.gz
focaccia-miasm-80e40a3d2ca735db955807ad0605b43ca22e4e35.zip
Avoid generate default locationdb
Diffstat (limited to 'test/analysis')
-rw-r--r--test/analysis/dse.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/analysis/dse.py b/test/analysis/dse.py
index 7d5998f1..cd813d2c 100644
--- a/test/analysis/dse.py
+++ b/test/analysis/dse.py
@@ -10,6 +10,7 @@ from miasm.core.asmblock import asm_resolve_final
 from miasm.analysis.machine import Machine
 from miasm.jitter.csts import PAGE_READ, PAGE_WRITE
 from miasm.analysis.dse import DSEEngine
+from miasm.core.locationdb import LocationDB
 
 
 class DSETest(object):
@@ -31,9 +32,10 @@ class DSETest(object):
     run_addr = 0x0
 
     def __init__(self, jitter_engine):
+        self.loc_db = LocationDB()
         self.machine = Machine(self.arch_name)
         jitter = self.machine.jitter
-        self.myjit = jitter(jitter_engine)
+        self.myjit = jitter(self.loc_db, jitter_engine)
         self.myjit.init_stack()
 
         self.myjit.set_trace_log()
@@ -52,7 +54,7 @@ class DSETest(object):
         self.myjit.cpu.ECX = 4
         self.myjit.cpu.EDX = 5
 
-        self.dse = DSEEngine(self.machine)
+        self.dse = DSEEngine(self.machine, self.loc_db)
         self.dse.attach(self.myjit)
 
     def __call__(self):
@@ -71,17 +73,17 @@ class DSETest(object):
 
     def asm(self):
         mn_x86 = self.machine.mn
-        blocks, loc_db = parse_asm.parse_txt(
+        blocks = parse_asm.parse_txt(
             mn_x86,
             self.arch_attrib,
             self.TXT,
-            loc_db=self.myjit.ir_arch.loc_db
+            self.loc_db
         )
 
         # fix shellcode addr
-        loc_db.set_location_offset(loc_db.get_name_location("main"), 0x0)
+        self.loc_db.set_location_offset(self.loc_db.get_name_location("main"), 0x0)
         output = StrPatchwork()
-        patches = asm_resolve_final(mn_x86, blocks, loc_db)
+        patches = asm_resolve_final(mn_x86, blocks, self.loc_db)
         for offset, raw in viewitems(patches):
             output[offset] = raw
 
@@ -120,7 +122,7 @@ class DSEAttachInBreakpoint(DSETest):
 
     def bp_attach(self, jitter):
         """Attach a DSE in the current jitter"""
-        self.dse = DSEEngine(self.machine)
+        self.dse = DSEEngine(self.machine, self.loc_db)
         self.dse.attach(self.myjit)
         self.dse.update_state_from_concrete()
         self.dse.update_state({