about summary refs log tree commit diff stats
path: root/miasm2/ir/ir.py
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2018-07-05 16:14:23 +0200
committerGitHub <noreply@github.com>2018-07-05 16:14:23 +0200
commitf5fd096d35a9b3811097c40f553c90d3036cc035 (patch)
tree8bce7b5aaf34fac81611243688c5a6040536ec81 /miasm2/ir/ir.py
parentc0afde4d7c8ff51eaa31e4a074b9e06f080b3169 (diff)
parent1d8dc96d6cd82d40e81e8436ed2827916179cd2e (diff)
downloadmiasm-f5fd096d35a9b3811097c40f553c90d3036cc035.tar.gz
miasm-f5fd096d35a9b3811097c40f553c90d3036cc035.zip
Merge pull request #788 from serpilliere/ir_remove_default_regs_init
Ir remove default regs init
Diffstat (limited to 'miasm2/ir/ir.py')
-rw-r--r--miasm2/ir/ir.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/miasm2/ir/ir.py b/miasm2/ir/ir.py
index 8ee35ed5..73c184dd 100644
--- a/miasm2/ir/ir.py
+++ b/miasm2/ir/ir.py
@@ -539,7 +539,19 @@ class IntermediateRepresentation(object):
         except (ValueError, TypeError):
             return None
 
-        return self.loc_db.get_or_create_offset_location(addr)
+        return self.loc_db.get_offset_location(addr)
+
+
+    def get_or_create_loc_key(self, addr):
+        """Transforms an ExprId/ExprInt/loc_key/int into a loc_key
+        If the offset @addr is not in the LocationDB, create it
+        @addr: an ExprId/ExprInt/loc_key/int"""
+
+        loc_key = self.get_loc_key(addr)
+        if loc_key is not None:
+            return loc_key
+
+        return self.loc_db.add_location(offset=int(addr))
 
     def get_block(self, addr):
         """Returns the irbloc associated to an ExprId/ExprInt/loc_key/int