summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2025-06-06 16:22:48 -0600
committerRusty Wagner <rusty.wagner@gmail.com>2025-06-10 14:28:26 -0600
commit3a1a81c3ddd8340432ecd2687d3a25195cc97d40 (patch)
treecfc905bc5c8d14e2e4d344db4da04f202d47e80b /python
parentd73188d9f304b242fa53594770806cd13bbe0259 (diff)
Add UI action and API to control switch recovery in HLIL
Diffstat (limited to 'python')
-rw-r--r--python/function.py12
1 files changed, 11 insertions, 1 deletions
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):