summaryrefslogtreecommitdiff
path: root/python/function.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/function.py')
-rw-r--r--python/function.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/python/function.py b/python/function.py
index c3310b6c..f0b6faee 100644
--- a/python/function.py
+++ b/python/function.py
@@ -206,6 +206,12 @@ class Variable(object):
def __str__(self):
return self.name
+ def __eq__(self, other):
+ return self.identifier == other.identifier
+
+ def __hash__(self):
+ return hash(self.identifier)
+
class ConstantReference(object):
def __init__(self, val, size, ptr, intermediate):
@@ -261,6 +267,9 @@ class Function(object):
return True
return ctypes.addressof(self.handle.contents) != ctypes.addressof(value.handle.contents)
+ def __hash__(self):
+ return hash((self.start, self.arch.name, self.platform.name))
+
@classmethod
def _unregister(cls, func):
handle = ctypes.cast(func, ctypes.c_void_p)
@@ -471,7 +480,11 @@ class Function(object):
def get_comment_at(self, addr):
return core.BNGetCommentForAddress(self.handle, addr)
+ def set_comment_at(self, addr, comment):
+ core.BNSetCommentForAddress(self.handle, addr, comment)
+
def set_comment(self, addr, comment):
+ """Deprecated"""
core.BNSetCommentForAddress(self.handle, addr, comment)
def get_low_level_il_at(self, addr, arch=None):