diff options
Diffstat (limited to 'test/arch/x86/unit/asm_test.py')
| -rw-r--r-- | test/arch/x86/unit/asm_test.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/arch/x86/unit/asm_test.py b/test/arch/x86/unit/asm_test.py index 6e7c55e2..d3ecf660 100644 --- a/test/arch/x86/unit/asm_test.py +++ b/test/arch/x86/unit/asm_test.py @@ -11,15 +11,16 @@ from miasm.expression.expression import * from miasm.core import asmblock from miasm.loader.strpatchwork import StrPatchwork from miasm.analysis.machine import Machine +from miasm.core.locationdb import LocationDB from miasm.jitter.csts import * reg_and_id = dict(mn_x86.regs.all_regs_ids_byname) - class Asm_Test(object): run_addr = 0x0 def __init__(self, jitter_engine): - self.myjit = Machine(self.arch_name).jitter(jitter_engine) + self.loc_db = LocationDB() + self.myjit = Machine(self.arch_name).jitter(self.loc_db, jitter_engine) self.myjit.init_stack() def test_init(self): @@ -44,12 +45,11 @@ class Asm_Test(object): assert(self.myjit.pc == self.ret_addr) def asm(self): - blocks, loc_db = parse_asm.parse_txt(mn_x86, self.arch_attrib, self.TXT, - loc_db = self.myjit.ir_arch.loc_db) + blocks = parse_asm.parse_txt(mn_x86, self.arch_attrib, self.TXT, 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) s = StrPatchwork() - patches = asmblock.asm_resolve_final(mn_x86, blocks, loc_db) + patches = asmblock.asm_resolve_final(mn_x86, blocks, self.loc_db) for offset, raw in viewitems(patches): s[offset] = raw @@ -77,7 +77,8 @@ class Asm_Test_16(Asm_Test): ret_addr = 0x1337 def __init__(self, jitter_engine): - self.myjit = Machine(self.arch_name).jitter(jitter_engine) + self.loc_db = LocationDB() + self.myjit = Machine(self.arch_name).jitter(self.loc_db, jitter_engine) self.myjit.stack_base = 0x1000 self.myjit.stack_size = 0x1000 self.myjit.init_stack() |