diff options
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | example/disasm/file.py | 4 | ||||
| -rw-r--r-- | example/ida/ctype_propagation.py | 1 | ||||
| -rw-r--r-- | miasm2/core/asmblock.py | 4 | ||||
| -rw-r--r-- | miasm2/core/cpu.py | 2 |
5 files changed, 8 insertions, 9 deletions
diff --git a/README.md b/README.md index 118051df..570bee22 100644 --- a/README.md +++ b/README.md @@ -165,8 +165,8 @@ Disassembling the shellcode at address `0`: >>> from miasm2.analysis.machine import Machine >>> machine = Machine('x86_32') >>> mdis = machine.dis_engine(c.bin_stream) ->>> blocks = mdis.dis_multiblock(0) ->>> for block in blocks: +>>> asmcfg = mdis.dis_multiblock(0) +>>> for block in asmcfg.blocks: ... print block ... loc_0000000000000000:0x00000000 @@ -269,7 +269,7 @@ Initializing the IR pool: ``` >>> ira = machine.ira() ->>> for block in blocks: +>>> for block in asmcfg.blocks: ... ira.add_block(block) ... ``` diff --git a/example/disasm/file.py b/example/disasm/file.py index 88ba6162..196e1b1a 100644 --- a/example/disasm/file.py +++ b/example/disasm/file.py @@ -13,6 +13,6 @@ cont = Container.from_stream(open(sys.argv[1])) mdis = dis_x86_32(cont.bin_stream) # Inform the engine to avoid disassembling null instructions mdis.dont_dis_nulstart_bloc = True -blocks = mdis.dis_multiblock(addr) +asmcfg = mdis.dis_multiblock(addr) -open('graph.dot', 'w').write(blocks.dot()) +open('graph.dot', 'w').write(asmcfg.dot()) diff --git a/example/ida/ctype_propagation.py b/example/ida/ctype_propagation.py index d35835dc..db324833 100644 --- a/example/ida/ctype_propagation.py +++ b/example/ida/ctype_propagation.py @@ -268,7 +268,6 @@ def analyse_function(): iraCallStackFixer = get_ira_call_fixer(ira) ir_arch = iraCallStackFixer(mdis.symbol_pool) - asmcfg = mdis.dis_multiblock(addr) # Generate IR for block in asmcfg.blocks: diff --git a/miasm2/core/asmblock.py b/miasm2/core/asmblock.py index 35b7e1db..08ff25e9 100644 --- a/miasm2/core/asmblock.py +++ b/miasm2/core/asmblock.py @@ -521,7 +521,7 @@ class AsmSymbolPool(object): return "".join("%s\n" % loc_key for loc_key in self._loc_keys) def __getitem__(self, item): - warnings.warn('DEPRECATION WARNING: use "offset_to_loc_key" or "name_to_loc_key"') + warnings.warn('DEPRECATION WARNING: use "getby_name" or "getby_offset"') if item in self._name_to_loc_key: return self._name_to_loc_key[item] if item in self._offset_to_loc_key: @@ -529,7 +529,7 @@ class AsmSymbolPool(object): raise KeyError('unknown symbol %r' % item) def __contains__(self, item): - warnings.warn('DEPRECATION WARNING: use "offset_to_loc_key" or "name_to_loc_key"') + warnings.warn('DEPRECATION WARNING: use "getby_name" or "getby_offset"') return item in self._name_to_loc_key or item in self._offset_to_loc_key def merge(self, symbol_pool): diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py index a142ab77..80f81aff 100644 --- a/miasm2/core/cpu.py +++ b/miasm2/core/cpu.py @@ -1030,7 +1030,7 @@ class instruction(object): if name == '_': fixed_expr[exprloc] = self.get_asm_next_offset(exprloc) continue - if not name in symbols: + if symbols.getby_name(name) is None: raise ValueError('Unresolved symbol: %r' % exprloc) offset = symbols.loc_key_to_offset(loc_key) |