summaryrefslogtreecommitdiff
path: root/python/basicblock.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/basicblock.py')
-rw-r--r--python/basicblock.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/basicblock.py b/python/basicblock.py
index 26db925d..8e64c1c1 100644
--- a/python/basicblock.py
+++ b/python/basicblock.py
@@ -35,6 +35,14 @@ class BasicBlockEdge(object):
self.target = target
self.back_edge = back_edge
+ def __eq__(self, value):
+ if not isinstance(value, BasicBlockEdge):
+ return False
+ return (self.type, self.source, self.target, self.back_edge) == (value.type, value.source, value.target, value.back_edge)
+
+ def __hash__(self):
+ return hash((self.type, self.source, self.target, self.back_edge))
+
def __repr__(self):
if self.type == BranchType.UnresolvedBranch:
return "<%s>" % BranchType(self.type).name
@@ -68,6 +76,9 @@ class BasicBlock(object):
"""Internal method used to instantiante child instances"""
return BasicBlock(view, handle)
+ def __hash__(self):
+ return hash((self.start, self.end, self.arch.name))
+
@property
def function(self):
"""Basic block function (read-only)"""