summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2017-02-16 19:12:43 -0500
committerRusty Wagner <rusty@vector35.com>2017-02-16 19:18:55 -0500
commit57c08987ee10af0b52d5c3fd44739a3935f9efa7 (patch)
tree248c70d5d1891855c8947d0c6bb395c00d063079 /python/binaryview.py
parent6ac3ea169e980b86c45c017892ef8a76fe5fb95d (diff)
Basic blocks have incoming and outgoing edges with basic block references, use core object identity for equality
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 9753b653..dd37be69 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -299,6 +299,16 @@ class BinaryViewType(object):
def __init__(self, handle):
self.handle = core.handle_of_type(handle, core.BNBinaryViewType)
+ def __eq__(self, value):
+ if not isinstance(value, BinaryViewType):
+ return False
+ return ctypes.addressof(self.handle.contents) == ctypes.addressof(value.handle.contents)
+
+ def __ne__(self, value):
+ if not isinstance(value, BinaryViewType):
+ return True
+ return ctypes.addressof(self.handle.contents) != ctypes.addressof(value.handle.contents)
+
@property
def name(self):
"""BinaryView name (read-only)"""
@@ -547,6 +557,16 @@ class BinaryView(object):
self.notifications = {}
self.next_address = None # Do NOT try to access view before init() is called, use placeholder
+ def __eq__(self, value):
+ if not isinstance(value, BinaryView):
+ return False
+ return ctypes.addressof(self.handle.contents) == ctypes.addressof(value.handle.contents)
+
+ def __ne__(self, value):
+ if not isinstance(value, BinaryView):
+ return True
+ return ctypes.addressof(self.handle.contents) != ctypes.addressof(value.handle.contents)
+
@classmethod
def register(cls):
startup._init_plugins()
@@ -3255,6 +3275,16 @@ class BinaryReader(object):
def __del__(self):
core.BNFreeBinaryReader(self.handle)
+ def __eq__(self, value):
+ if not isinstance(value, BinaryReader):
+ return False
+ return ctypes.addressof(self.handle.contents) == ctypes.addressof(value.handle.contents)
+
+ def __ne__(self, value):
+ if not isinstance(value, BinaryReader):
+ return True
+ return ctypes.addressof(self.handle.contents) != ctypes.addressof(value.handle.contents)
+
@property
def endianness(self):
"""
@@ -3562,6 +3592,16 @@ class BinaryWriter(object):
def __del__(self):
core.BNFreeBinaryWriter(self.handle)
+ def __eq__(self, value):
+ if not isinstance(value, BinaryWriter):
+ return False
+ return ctypes.addressof(self.handle.contents) == ctypes.addressof(value.handle.contents)
+
+ def __ne__(self, value):
+ if not isinstance(value, BinaryWriter):
+ return True
+ return ctypes.addressof(self.handle.contents) != ctypes.addressof(value.handle.contents)
+
@property
def endianness(self):
"""