From c396d2cfb3682cb4c152b9dba6f866f6783e4a80 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Mon, 30 Oct 2017 17:46:49 -0400 Subject: __hash__ for three types of basic blocks --- python/mediumlevelil.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'python/mediumlevelil.py') diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 07759a47..9167212a 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -893,3 +893,6 @@ class MediumLevelILBasicBlock(basicblock.BasicBlock): def _create_instance(self, view, handle): """Internal method by super to instantiante child instances""" return MediumLevelILBasicBlock(view, handle, self.il_function) + + def __hash__(self): + return hash((self.start, self.end, self.il_function)) -- cgit v1.3.1 From 54a23d9e1ae34936427461b2807e3d5980e17486 Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Thu, 2 Nov 2017 11:30:12 -0500 Subject: Make SSAVariables unique between functions (#855) This helps a ton with inter-function analysis. --- python/mediumlevelil.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'python/mediumlevelil.py') diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 9167212a..333a6c4d 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -39,12 +39,12 @@ class SSAVariable(object): def __eq__(self, other): return ( - (self.var.identifier, self.version) == - (other.var.identifier, other.version) + (self.var.identifier, self.var.function, self.version) == + (other.var.identifier, other.var.function, other.version) ) def __hash__(self): - return hash((self.var.identifier, self.version)) + return hash((self.var.identifier, self.var.function, self.version)) class MediumLevelILLabel(object): -- cgit v1.3.1 From 704ceff1223485e9dc12947a36b0d56a3ff9d3ae Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Thu, 2 Nov 2017 11:38:11 -0500 Subject: Move the function discrimination from SSAVariable to Variable (#856) --- python/function.py | 4 ++-- python/mediumlevelil.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'python/mediumlevelil.py') diff --git a/python/function.py b/python/function.py index cbbdf9bd..f8aaae44 100644 --- a/python/function.py +++ b/python/function.py @@ -241,10 +241,10 @@ class Variable(object): return self.name def __eq__(self, other): - return self.identifier == other.identifier + return (self.identifier, self.function) == (other.identifier, other.function) def __hash__(self): - return hash(self.identifier) + return hash((self.identifier, self.function)) class ConstantReference(object): diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 333a6c4d..6f5515bb 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -39,12 +39,12 @@ class SSAVariable(object): def __eq__(self, other): return ( - (self.var.identifier, self.var.function, self.version) == - (other.var.identifier, other.var.function, other.version) + (self.var, self.version) == + (other.var, other.version) ) def __hash__(self): - return hash((self.var.identifier, self.var.function, self.version)) + return hash((self.var, self.version)) class MediumLevelILLabel(object): -- cgit v1.3.1