From 3a1a81c3ddd8340432ecd2687d3a25195cc97d40 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Fri, 6 Jun 2025 16:22:48 -0600 Subject: Add UI action and API to control switch recovery 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 7d14c2bb..ccecb992 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, EarlyReturn + BuiltinType, ExprFolding, EarlyReturn, SwitchRecovery ) from . import associateddatastore # Required in the main scope due to being an argument for _FunctionAssociatedDataStore @@ -3538,6 +3538,16 @@ class Function: addr = addr.address core.BNSetEarlyReturn(self.handle, addr, value) + def get_switch_recovery(self, addr: Union[int, highlevelil.HighLevelILInstruction]) -> SwitchRecovery: + if isinstance(addr, highlevelil.HighLevelILInstruction): + addr = addr.address + return SwitchRecovery(core.BNGetSwitchRecovery(self.handle, addr)) + + def set_switch_recovery(self, addr: Union[int, highlevelil.HighLevelILInstruction], value: SwitchRecovery): + if isinstance(addr, highlevelil.HighLevelILInstruction): + addr = addr.address + core.BNSetSwitchRecovery(self.handle, addr, value) + class AdvancedFunctionAnalysisDataRequestor: def __init__(self, func: Optional['Function'] = None): -- cgit v1.3.1