diff options
| author | Ajax <commial@gmail.com> | 2018-07-02 17:31:59 +0200 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2018-07-03 14:28:18 +0200 |
| commit | 68fac2e86cc61eba9adfe520fa0e04a7e8943450 (patch) | |
| tree | 2be74a21b54a3111f3c18746badfb0cf1ed41149 /example/disasm | |
| parent | 6ef8dbb2223d0847e3822b545b249511e96a1f9b (diff) | |
| download | miasm-68fac2e86cc61eba9adfe520fa0e04a7e8943450.tar.gz miasm-68fac2e86cc61eba9adfe520fa0e04a7e8943450.zip | |
symbol_pool -> loc_db
Diffstat (limited to 'example/disasm')
| -rw-r--r-- | example/disasm/callback.py | 4 | ||||
| -rw-r--r-- | example/disasm/full.py | 16 | ||||
| -rw-r--r-- | example/disasm/single_instr.py | 6 |
3 files changed, 13 insertions, 13 deletions
diff --git a/example/disasm/callback.py b/example/disasm/callback.py index a00cf5e5..85090070 100644 --- a/example/disasm/callback.py +++ b/example/disasm/callback.py @@ -3,7 +3,7 @@ from miasm2.core.asmblock import AsmConstraint from miasm2.arch.x86.disasm import dis_x86_32, cb_x86_funcs -def cb_x86_callpop(cur_bloc, symbol_pool, *args, **kwargs): +def cb_x86_callpop(cur_bloc, loc_db, *args, **kwargs): """ 1000: call 1005 1005: pop @@ -27,7 +27,7 @@ def cb_x86_callpop(cur_bloc, symbol_pool, *args, **kwargs): return loc_key = dst.loc_key - offset = symbol_pool.loc_key_to_offset(loc_key) + offset = loc_db.loc_key_to_offset(loc_key) ## The destination must be the next instruction if offset != last_instr.offset + last_instr.l: return diff --git a/example/disasm/full.py b/example/disasm/full.py index b0c34bff..1e5d2334 100644 --- a/example/disasm/full.py +++ b/example/disasm/full.py @@ -85,7 +85,7 @@ mn, dis_engine = machine.mn, machine.dis_engine ira, ir = machine.ira, machine.ir log.info('ok') -mdis = dis_engine(bs, symbol_pool=cont.symbol_pool) +mdis = dis_engine(bs, loc_db=cont.loc_db) # configure disasm engine mdis.dontdis_retcall = args.dontdis_retcall mdis.blocs_wd = args.blockwatchdog @@ -99,8 +99,8 @@ for addr in args.address: addrs.append(int(addr, 0)) except ValueError: # Second chance, try with symbol - loc_key = mdis.symbol_pool.getby_name(addr) - offset = mdis.symbol_pool.loc_key_to_offset(loc_key) + loc_key = mdis.loc_db.getby_name(addr) + offset = mdis.loc_db.loc_key_to_offset(loc_key) addrs.append(offset) if len(addrs) == 0 and default_addr is not None: @@ -140,10 +140,10 @@ while not finish and todo: instr = block.get_subcall_instr() if not instr: continue - for dest in instr.getdstflow(mdis.symbol_pool): + for dest in instr.getdstflow(mdis.loc_db): if not dest.is_loc(): continue - offset = mdis.symbol_pool.loc_key_to_offset(dest.loc_key) + offset = mdis.loc_db.loc_key_to_offset(dest.loc_key) todo.append((mdis, instr, offset)) if args.funcswatchdog is not None and args.funcswatchdog <= 0: @@ -158,7 +158,7 @@ while not finish and todo: # Generate dotty graph -all_asmcfg = AsmCFG(mdis.symbol_pool) +all_asmcfg = AsmCFG(mdis.loc_db) for blocks in all_funcs_blocks.values(): all_asmcfg += blocks @@ -189,8 +189,8 @@ log.info('total lines %s' % total_l) if args.gen_ir: log.info("generating IR and IR analysis") - ir_arch = ir(mdis.symbol_pool) - ir_arch_a = ira(mdis.symbol_pool) + ir_arch = ir(mdis.loc_db) + ir_arch_a = ira(mdis.loc_db) ir_arch.blocks = {} ir_arch_a.blocks = {} for ad, asmcfg in all_funcs_blocks.items(): diff --git a/example/disasm/single_instr.py b/example/disasm/single_instr.py index 59b81de7..d17e303f 100644 --- a/example/disasm/single_instr.py +++ b/example/disasm/single_instr.py @@ -1,9 +1,9 @@ from miasm2.arch.x86.arch import mn_x86 from miasm2.arch.x86.regs import EDX -from miasm2.core.asmblock import AsmSymbolPool +from miasm2.core.locationdb import LocationDB -symbol_pool = AsmSymbolPool() -l = mn_x86.fromstring('MOV EAX, EBX', symbol_pool, 32) +loc_db = LocationDB() +l = mn_x86.fromstring('MOV EAX, EBX', loc_db, 32) print "instruction:", l print "arg:", l.args[0] x = mn_x86.asm(l) |