diff options
| author | Glenn Smith <glenn@vector35.com> | 2025-02-24 17:04:34 -0500 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2025-03-05 16:39:57 -0500 |
| commit | 0964368357272921723837998074043356784550 (patch) | |
| tree | ef6ff8dbc260177984ef2e5a9d10c035157d6089 /python/highlevelil.py | |
| parent | f2d653fd89262d73fa9d4f221cd45bae873a6ca9 (diff) | |
Python: Add ability to construct expressions with locations
Co-Authored-By: ltlly <a1253213025@163.com>
Diffstat (limited to 'python/highlevelil.py')
| -rw-r--r-- | python/highlevelil.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/python/highlevelil.py b/python/highlevelil.py index 154af642..c73df7f0 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -46,7 +46,7 @@ from .interaction import show_graph_report from .commonil import ( BaseILInstruction, Tailcall, Syscall, Localcall, Comparison, Signed, UnaryOperation, BinaryOperation, SSA, Phi, Loop, ControlFlow, Memory, Constant, Arithmetic, DoublePrecision, Terminal, FloatingPoint, Intrinsic, Return, - VariableInstruction, SSAVariableInstruction, SetVar + VariableInstruction, SSAVariableInstruction, SetVar, ILSourceLocation ) from . import deprecation @@ -2851,14 +2851,29 @@ class HighLevelILFunction: def expr( self, operation: Union[str, HighLevelILOperation], a: int = 0, b: int = 0, c: int = 0, d: int = 0, e: int = 0, - size: int = 0 + size: int = 0, + source_location: Optional['ILSourceLocation'] = None ) -> ExpressionIndex: if isinstance(operation, str): operation_value = HighLevelILOperation[operation] else: assert isinstance(operation, HighLevelILOperation) operation_value = operation.value - return ExpressionIndex(core.BNHighLevelILAddExpr(self.handle, operation_value, size, a, b, c, d, e)) + if source_location is not None: + return ExpressionIndex(core.BNHighLevelILAddExprWithLocation( + self.handle, + operation_value, + source_location.address, + source_location.source_operand, + size, + a, + b, + c, + d, + e + )) + else: + return ExpressionIndex(core.BNHighLevelILAddExpr(self.handle, operation_value, size, a, b, c, d, e)) def get_expr_count(self) -> int: """ |
