summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2025-04-25 13:30:45 -0400
committerRyan Snyder <ryan@vector35.com>2025-06-23 13:44:12 -0400
commitb079d1a1e19151f5c39de84c2e1e6cc6a91abc74 (patch)
tree8cf27224630b690fcfdfd490ee43ec1cd56fc9b6 /python/binaryview.py
parent76215b86ff629da58aa94d4cf4093d2e67017412 (diff)
Perform BB analysis from Architecture C++ API
This commit moves AnalyzeBasicBlocks from the binary ninja core to the API and allows architecture plugins to optionally override AnalyzeBasicBlocks for a custom implementation Supply ABB inputs in BNBasicBlockAnalysisContext Register default analyze basic blocks callback This allows the nanomips and rust core architecture plugins to work again while using the C++ API DefaultAnalyzeBasicBlocks Use default ABB from Python plugins Fix bug in API ArchAndAddr operator overload Python APIs for basic block analysis
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index a03cb7bc..4761758a 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -4972,6 +4972,43 @@ class BinaryView:
"""
core.BNAbortAnalysis(self.handle)
+ @property
+ def analysis_is_aborted(self) -> bool:
+ """
+ ``analysis_is_aborted`` checks if the analysis has been aborted.
+
+ .. note:: This property is intended for use by architecture plugins only.
+
+ :return: True if the analysis has been aborted, False otherwise
+ :rtype: bool
+ """
+
+ return core.BNAnalysisIsAborted(self.handle)
+
+ def should_skip_target_analysis(self, source_location: '_function.ArchAndAddr', source_function: '_function.Function',
+ end: int, target_location: '_function.ArchAndAddr') -> bool:
+ """
+ ``should_skip_target_analysis`` checks if target analysis should be skipped.
+
+ .. note:: This method is intended for use by architecture plugins only.
+
+ :param _function.ArchAndAddr source_location: The source location.
+ :param _function.Function source_function: The source function.
+ :param int end: The end address of the source branch instruction.
+ :param _function.ArchAndAddr target_location: The target location.
+ :return: True if the target analysis should be skipped, False otherwise
+ :rtype: bool
+ """
+
+ bn_src_arch_and_addr = core.BNArchitectureAndAddress()
+ bn_src_arch_and_addr.arch = source_location.arch.handle
+ bn_src_arch_and_addr.address = source_location.addr
+ bn_target_arch_and_addr = core.BNArchitectureAndAddress()
+ bn_target_arch_and_addr.arch = target_location.arch.handle
+ bn_target_arch_and_addr.address = target_location.addr
+ return core.BNShouldSkipTargetAnalysis(self.handle, bn_src_arch_and_addr, source_function.handle, end,
+ bn_target_arch_and_addr)
+
def define_data_var(
self, addr: int, var_type: StringOrType, name: Optional[Union[str, '_types.CoreSymbol']] = None
) -> None: