summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDustin Fraze <dustin.fraze@outlook.com>2020-10-13 22:28:28 -0400
committerKyleMiles <krm504@nyu.edu>2020-10-29 01:01:06 +0000
commitf6a8cb229b849fe2e946c9d92516dfbce293adf0 (patch)
tree9d089d68dbc47e49ff78564e3a04819515b3fe7b /python
parent1eb98a3d69d0fbcede2b9365dcf700fb73549f18 (diff)
Update lowlevelil.py
Add string handling to ILRegister comparison. This is especially nice with the CallingConvention API. It returns a string for things like "int_return_reg". This allows comparison without sprinkling of str(). Fix up __ne__ for ILInstruction.
Diffstat (limited to 'python')
-rw-r--r--python/lowlevelil.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index 396f3925..870b787a 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -61,12 +61,14 @@ class ILRegister(object):
return self._name
def __eq__(self, other):
- if not isinstance(other, self.__class__):
+ if isinstance(other, str) and other in self._arch.regs:
+ other = binaryninja.lowlevelil.ILRegister(self._arch, self._arch.regs[other].index)
+ elif not isinstance(other, self.__class__):
return NotImplemented
return (self._arch, self._index, self._name) == (other._arch, other._index, other._name)
def __ne__(self, other):
- if not isinstance(other, self.__class__):
+ if not isinstance(other, (self.__class__, str)):
return NotImplemented
return not (self == other)