diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2020-08-31 09:27:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-31 09:27:56 +0200 |
| commit | 06239dde95cd984548deb40e9945d8bd85d83425 (patch) | |
| tree | 2fb59bca2aada9280fb1aecd2ebdd633a23cdc4b /test/arch/x86/unit/asm_test.py | |
| parent | 5d8beb271d9890241a6d61dd476fab26ca37ebbf (diff) | |
| parent | 24ce193b8bad352853a9c5589f6fdcf5177d5466 (diff) | |
| download | miasm-06239dde95cd984548deb40e9945d8bd85d83425.tar.gz miasm-06239dde95cd984548deb40e9945d8bd85d83425.zip | |
Merge pull request #1274 from serpilliere/dont_gen_locationdb
Avoid generate default locationdb
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..62923310 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) + asmcfg = 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, asmcfg) 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() |