summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Russell <sam.h.russell@gmail.com>2024-03-07 22:47:26 +0100
committerGlenn Smith <couleeapps@gmail.com>2024-03-07 21:11:49 -0500
commit72cc84aabd188e4add6e5012df86414b65d95bc8 (patch)
treed26adb52deed8645a3811512cadd5cb90607048d
parent828fff839f4e4de3e9582405dfec567531000ebc (diff)
Expose get_expr_count() on python llil and mlil
This is already exposed in the CPP interface, and is useful for workflows for enumerating all expressions in an ILFunction
-rw-r--r--python/lowlevelil.py8
-rw-r--r--python/mediumlevelil.py8
2 files changed, 16 insertions, 0 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index 590cae83..16ffbd88 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -3721,6 +3721,14 @@ class LowLevelILFunction:
assert False, "flags type unsupported"
return ExpressionIndex(core.BNLowLevelILAddExpr(self.handle, operation, size, _flags, a, b, c, d))
+ def get_expr_count(self) -> int:
+ """
+ ``get_expr_count`` gives a the total number of expressions in this IL function
+
+ You can use this to enumerate all expressions in conjunction with LowLevelILInstruction.create()
+ """
+ return core.BNGetLowLevelILExprCount(self.handle)
+
def replace_expr(self, original: InstructionOrExpression, new: InstructionOrExpression) -> None:
"""
``replace_expr`` allows modification of expressions but ONLY during lifting.
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index 53f87cdc..159299c7 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -3390,6 +3390,14 @@ class MediumLevelILFunction:
_operation = operation.value
return ExpressionIndex(core.BNMediumLevelILAddExpr(self.handle, _operation, size, a, b, c, d, e))
+ def get_expr_count(self) -> int:
+ """
+ ``get_expr_count`` gives a the total number of expressions in this IL function
+
+ You can use this to enumerate all expressions in conjunction with MediumLevelILInstruction.create()
+ """
+ return core.BNGeMediumLevelILExprCount(self.handle)
+
def replace_expr(self, original: InstructionOrExpression, new: InstructionOrExpression) -> None:
"""
``replace_expr`` allows modification of MLIL expressions