about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2016-11-23 09:47:41 +0100
committerGitHub <noreply@github.com>2016-11-23 09:47:41 +0100
commit50661f59da48540a6d87ab5f42c41e761a9c11d8 (patch)
tree514aaec53adb23e867f2723e5709d217a42c9c60
parentfe87a86bbd0689fc292bd27bde5c9e76daf1d653 (diff)
parent4cddfbefff0bef710a0694f856be8c5890408568 (diff)
downloadmiasm-50661f59da48540a6d87ab5f42c41e761a9c11d8.tar.gz
miasm-50661f59da48540a6d87ab5f42c41e761a9c11d8.zip
Merge pull request #455 from a-vincent/dont_dis_retcall_funcs
add dont_dis_retcall_funcs set to disasmEngine
-rw-r--r--miasm2/core/asmbloc.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/miasm2/core/asmbloc.py b/miasm2/core/asmbloc.py
index 54cd51cf..f6d6154b 100644
--- a/miasm2/core/asmbloc.py
+++ b/miasm2/core/asmbloc.py
@@ -1265,6 +1265,8 @@ class disasmEngine(object):
      - dont_dis: stop the current disassembly branch if reached
      - split_dis: force a basic block end if reached,
                   with a next constraint on its successor
+     - dont_dis_retcall_funcs: stop disassembly after a call to one
+                               of the given functions
 
     + On/Off
      - follow_call: recursively disassemble CALL destinations
@@ -1308,6 +1310,7 @@ class disasmEngine(object):
         self.blocs_wd = None
         self.dis_bloc_callback = None
         self.dont_dis_nulstart_bloc = False
+        self.dont_dis_retcall_funcs = set()
 
         # Override options if needed
         self.__dict__.update(kwargs)
@@ -1417,6 +1420,8 @@ class disasmEngine(object):
                     if isinstance(d, m2_expr.ExprId) and \
                             isinstance(d.name, asm_label):
                         dstn.append(d.name)
+                        if d.name.offset in self.dont_dis_retcall_funcs:
+                            add_next_offset = False
                 dst = dstn
                 if (not instr.is_subcall()) or self.follow_call:
                     cur_block.bto.update(