From 9c8d4eac3dadf6273b34ba193c219de9283285b3 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 3 Jun 2025 13:42:04 -0600 Subject: Add UI action and API to control early returns in HLIL --- python/function.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'python/function.py') diff --git a/python/function.py b/python/function.py index ae3af65b..afd9d5b7 100644 --- a/python/function.py +++ b/python/function.py @@ -29,7 +29,7 @@ from . import _binaryninjacore as core from .enums import ( AnalysisSkipReason, FunctionGraphType, SymbolType, InstructionTextTokenType, HighlightStandardColor, HighlightColorStyle, DisassemblyOption, IntegerDisplayType, FunctionAnalysisSkipOverride, FunctionUpdateType, - BuiltinType, ExprFolding + BuiltinType, ExprFolding, EarlyReturn ) from . import associateddatastore # Required in the main scope due to being an argument for _FunctionAssociatedDataStore @@ -3476,6 +3476,16 @@ class Function: addr = addr.address core.BNSetConditionInverted(self.handle, addr, invert) + def get_early_return(self, addr: Union[int, highlevelil.HighLevelILInstruction]) -> EarlyReturn: + if isinstance(addr, highlevelil.HighLevelILInstruction): + addr = addr.address + return EarlyReturn(core.BNGetEarlyReturn(self.handle, addr)) + + def set_early_return(self, addr: Union[int, highlevelil.HighLevelILInstruction], value: EarlyReturn): + if isinstance(addr, highlevelil.HighLevelILInstruction): + addr = addr.address + core.BNSetEarlyReturn(self.handle, addr, value) + class AdvancedFunctionAnalysisDataRequestor: def __init__(self, func: Optional['Function'] = None): -- cgit v1.3.1