diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2016-10-14 13:38:22 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2016-11-04 16:45:46 +0100 |
| commit | 89795337461e2a2eeae42324e023582b93067996 (patch) | |
| tree | 411b05b9fd04c0aac269701c85745d4039de1a97 | |
| parent | ca9edfa2223a48550d53e62ab4e4856647428cca (diff) | |
| download | miasm-89795337461e2a2eeae42324e023582b93067996.tar.gz miasm-89795337461e2a2eeae42324e023582b93067996.zip | |
Symbexec: new api for emul_ir_*
Replacement: emul_ir_bloc(self, myir, addr, step=False) by: emul_ir_block(self, addr, step=False) and: emul_ir_blocs(self, myir, addr, lbl_stop=None, step=False) by: emul_ir_blocks(self, addr, lbl_stop=None, step=False) The 'myir' was already given in the symbolexec creation.
| -rw-r--r-- | example/ida/symbol_exec.py | 2 | ||||
| -rw-r--r-- | example/symbol_exec/single_instr.py | 4 | ||||
| -rw-r--r-- | miasm2/ir/symbexec.py | 14 | ||||
| -rw-r--r-- | test/arch/arm/sem.py | 2 | ||||
| -rw-r--r-- | test/arch/msp430/sem.py | 2 | ||||
| -rw-r--r-- | test/arch/x86/sem.py | 2 |
6 files changed, 18 insertions, 8 deletions
diff --git a/example/ida/symbol_exec.py b/example/ida/symbol_exec.py index 41c5c3bf..751f9a58 100644 --- a/example/ida/symbol_exec.py +++ b/example/ida/symbol_exec.py @@ -94,7 +94,7 @@ def symbolic_exec(): print "Run symbolic execution..." sb = symbexec(ira, machine.mn.regs.regs_init) - sb.emul_ir_blocs(ira, start) + sb.emul_ir_blocks(start) modified = {} for ident in sb.symbols.symbols_id: diff --git a/example/symbol_exec/single_instr.py b/example/symbol_exec/single_instr.py index e4dcdba6..365a17ec 100644 --- a/example/symbol_exec/single_instr.py +++ b/example/symbol_exec/single_instr.py @@ -26,8 +26,8 @@ symbols_init = ira.arch.regs.regs_init symb = symbexec(ira, symbols_init) # Emulate one IR basic block -## Emulation of several basic blocks can be done through .emul_ir_blocs -cur_addr = symb.emul_ir_bloc(ira, START_ADDR) +## Emulation of several basic blocks can be done through .emul_ir_blocks +cur_addr = symb.emul_ir_block(START_ADDR) # Modified elements print 'Modified registers:' diff --git a/miasm2/ir/symbexec.py b/miasm2/ir/symbexec.py index d3c56f70..2a0b19ca 100644 --- a/miasm2/ir/symbexec.py +++ b/miasm2/ir/symbexec.py @@ -4,6 +4,8 @@ from miasm2.expression.simplifications import expr_simp from miasm2.core import asmbloc from miasm2.ir.ir import AssignBlock from miasm2.core.interval import interval +from miasm2.core.utils import get_caller_name +import warnings import logging @@ -434,14 +436,22 @@ class symbexec(object): return self.eval_expr(self.ir_arch.IRDst) def emul_ir_bloc(self, myir, addr, step=False): - irblock = myir.get_bloc(addr) + warnings.warn('DEPRECATION WARNING: use "emul_ir_block(self, addr, step=False)" instead of emul_ir_bloc') + return self.emul_ir_block(addr, step) + + def emul_ir_block(self, addr, step=False): + irblock = self.ir_arch.get_bloc(addr) if irblock is not None: addr = self.emulbloc(irblock, step=step) return addr def emul_ir_blocs(self, myir, addr, lbl_stop=None, step=False): + warnings.warn('DEPRECATION WARNING: use "emul_ir_blocks(self, addr, lbl_stop=None, step=False):" instead of emul_ir_blocs') + return self.emul_ir_blocks(addr, lbl_stop, step) + + def emul_ir_blocks(self, addr, lbl_stop=None, step=False): while True: - irblock = myir.get_bloc(addr) + irblock = self.ir_arch.get_bloc(addr) if irblock is None: break if irblock.label == lbl_stop: diff --git a/test/arch/arm/sem.py b/test/arch/arm/sem.py index feef7372..cefbe76a 100644 --- a/test/arch/arm/sem.py +++ b/test/arch/arm/sem.py @@ -29,7 +29,7 @@ def compute(asm, inputstate={}, debug=False): instr = mn.dis(code, "l") instr.offset = inputstate.get(PC, 0) interm.add_instr(instr) - symexec.emul_ir_blocs(interm, instr.offset) + symexec.emul_ir_blocks(instr.offset) if debug: for k, v in symexec.symbols.items(): if regs_init.get(k, None) != v: diff --git a/test/arch/msp430/sem.py b/test/arch/msp430/sem.py index 2488d633..515b4c53 100644 --- a/test/arch/msp430/sem.py +++ b/test/arch/msp430/sem.py @@ -27,7 +27,7 @@ def compute(asm, inputstate={}, debug=False): instr = mn.dis(code, mode) instr.offset = inputstate.get(PC, 0) interm.add_instr(instr) - symexec.emul_ir_blocs(interm, instr.offset) + symexec.emul_ir_blocks(instr.offset) if debug: for k, v in symexec.symbols.items(): if regs_init.get(k, None) != v: diff --git a/test/arch/x86/sem.py b/test/arch/x86/sem.py index 617b929b..7cf81828 100644 --- a/test/arch/x86/sem.py +++ b/test/arch/x86/sem.py @@ -26,7 +26,7 @@ def symb_exec(interm, inputstate, debug): sympool = dict(regs_init) sympool.update(inputstate) symexec = symbexec(interm, sympool) - symexec.emul_ir_blocs(interm, 0) + symexec.emul_ir_blocks(0) if debug: for k, v in symexec.symbols.items(): if regs_init.get(k, None) != v: |