about summary refs log tree commit diff stats
path: root/miasm2/ir/ir.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2017-08-07 21:10:57 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2017-08-08 16:12:00 +0200
commite6f2b1431e0364583385a44d03a78775d9578dd9 (patch)
tree3d90eb0691e82eac184cf0160add783f0a8a68c3 /miasm2/ir/ir.py
parentbb1a8f8289cd7132f5013fbe198d59d98fc6f158 (diff)
downloadmiasm-e6f2b1431e0364583385a44d03a78775d9578dd9.tar.gz
miasm-e6f2b1431e0364583385a44d03a78775d9578dd9.zip
Symbexec: add get_block
Diffstat (limited to 'miasm2/ir/ir.py')
-rw-r--r--miasm2/ir/ir.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/miasm2/ir/ir.py b/miasm2/ir/ir.py
index 603d3fd0..afb6b382 100644
--- a/miasm2/ir/ir.py
+++ b/miasm2/ir/ir.py
@@ -469,13 +469,15 @@ class IntermediateRepresentation(object):
         if (isinstance(addr, m2_expr.ExprId) and
                 isinstance(addr.name, AsmLabel)):
             addr = addr.name
-        if isinstance(addr, m2_expr.ExprInt):
+        if isinstance(addr, AsmLabel):
+            return addr
+
+        try:
             addr = int(addr)
-        if isinstance(addr, (int, long)):
-            addr = self.symbol_pool.getby_offset_create(addr)
-        elif isinstance(addr, AsmLabel):
-            addr = self.symbol_pool.getby_name_create(addr.name)
-        return addr
+        except (ValueError, TypeError):
+            return None
+
+        return self.symbol_pool.getby_offset_create(addr)
 
     def get_block(self, addr):
         """Returns the irbloc associated to an ExprId/ExprInt/label/int