about summary refs log tree commit diff stats
path: root/miasm2/core/asmblock.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2018-07-13 14:53:42 +0200
committerAjax <commial@gmail.com>2018-07-19 14:03:34 +0200
commit7e412335ba4df14270561e030c0991dbcca88d38 (patch)
tree2b8fb6442d19b6690205ef7848c509b077ccf7e4 /miasm2/core/asmblock.py
parented84342d3f1ad64092c7b8d75158404a416dd0f1 (diff)
downloadmiasm-7e412335ba4df14270561e030c0991dbcca88d38.tar.gz
miasm-7e412335ba4df14270561e030c0991dbcca88d38.zip
DisasmEngine: add dis_instr
Diffstat (limited to 'miasm2/core/asmblock.py')
-rw-r--r--miasm2/core/asmblock.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/miasm2/core/asmblock.py b/miasm2/core/asmblock.py
index 2f16543f..c00b4c5c 100644
--- a/miasm2/core/asmblock.py
+++ b/miasm2/core/asmblock.py
@@ -1596,3 +1596,17 @@ class disasmEngine(object):
         warnings.warn('DEPRECATION WARNING: use "dis_multiblock" instead of "dis_multibloc"')
         return self.dis_multiblock(offset, blocs)
 
+    def dis_instr(self, offset):
+        """Disassemble one instruction at offset @offset and return the
+        corresponding instruction instance
+        @offset: targeted offset to disassemble
+        """
+        old_lineswd = self.lines_wd
+        self.lines_wd = 1
+        try:
+            block = self.dis_block(offset)
+        finally:
+            self.lines_wd = old_lineswd
+
+        instr = block.lines[0]
+        return instr