diff options
| -rw-r--r-- | binaryninjacore.h | 5 | ||||
| -rw-r--r-- | python/highlevelil.py | 24 |
2 files changed, 27 insertions, 2 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h index 6a683bd5..7b09e7fa 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -3839,6 +3839,11 @@ __attribute__ ((format (printf, 1, 2))) BINARYNINJACOREAPI size_t BNGetHighLevelILExprIndexForLabel(BNHighLevelILFunction* func, uint64_t label); BINARYNINJACOREAPI size_t* BNGetHighLevelILUsesForLabel(BNHighLevelILFunction* func, uint64_t label, size_t* count); + BINARYNINJACOREAPI bool BNHighLevelILExprLessThan(BNHighLevelILFunction* leftFunc, size_t leftExpr, + BNHighLevelILFunction* rightFunc, size_t rightExpr); + BINARYNINJACOREAPI bool BNHighLevelILExprEqual(BNHighLevelILFunction* leftFunc, size_t leftExpr, + BNHighLevelILFunction* rightFunc, size_t rightExpr); + // Type Libraries BINARYNINJACOREAPI BNTypeLibrary* BNNewTypeLibrary(BNArchitecture* arch, const char* name); BINARYNINJACOREAPI BNTypeLibrary* BNNewTypeLibraryReference(BNTypeLibrary* lib); diff --git a/python/highlevelil.py b/python/highlevelil.py index 6b197fac..e815df48 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -344,12 +344,32 @@ class HighLevelILInstruction(object): def __eq__(self, other): if not isinstance(other, self.__class__): return NotImplemented - return (self._function, self._expr_index) == (other._function, other._expr_index) + return core.BNHighLevelILExprEqual(self._function.handle, self._expr_index, other._function.handle, other._expr_index) def __ne__(self, other): if not isinstance(other, self.__class__): return NotImplemented - return not (self == other) + return not core.BNHighLevelILExprEqual(self._function.handle, self._expr_index, other._function.handle, other._expr_index) + + def __lt__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + return core.BNHighLevelILExprLessThan(self._function.handle, self._expr_index, other._function.handle, other._expr_index) + + def __le__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + return not core.BNHighLevelILExprLessThan(other._function.handle, other._expr_index, self._function.handle, self._expr_index) + + def __gt__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + return core.BNHighLevelILExprLessThan(other._function.handle, other._expr_index, self._function.handle, self._expr_index) + + def __ge__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + return not core.BNHighLevelILExprLessThan(self._function.handle, self._expr_index, other._function, other._expr_index) def __hash__(self): return hash((self._function, self._expr_index)) |
