From b079d1a1e19151f5c39de84c2e1e6cc6a91abc74 Mon Sep 17 00:00:00 2001 From: Brandon Miller Date: Fri, 25 Apr 2025 13:30:45 -0400 Subject: 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 --- binaryview.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index d8477826..66ef0e10 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -2186,6 +2186,12 @@ void BinaryView::AbortAnalysis() } +bool BinaryView::AnalysisIsAborted() const +{ + return BNAnalysisIsAborted(m_object); +} + + void BinaryView::DefineDataVariable(uint64_t addr, const Confidence>& type) { BNTypeWithConfidence tc; @@ -5268,6 +5274,20 @@ void BinaryView::SetNewAutoFunctionAnalysisSuppressed(bool suppress) } +bool BinaryView::ShouldSkipTargetAnalysis(const ArchAndAddr& source, Ref sourceFunc, + uint64_t sourceEnd, const ArchAndAddr& target) +{ + BNArchitectureAndAddress sourceCopy; + sourceCopy.arch = source.arch ? source.arch->GetObject() : nullptr; + sourceCopy.address = source.address; + BNArchitectureAndAddress targetCopy; + targetCopy.address = target.address; + targetCopy.arch = target.arch ? target.arch->GetObject() : nullptr; + auto func = sourceFunc ? sourceFunc->GetObject() : nullptr; + return BNShouldSkipTargetAnalysis(m_object, &sourceCopy, func, sourceEnd, &targetCopy); +} + + set BinaryView::GetNameSpaces() const { set nameSpaces; -- cgit v1.3.1