summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2025-07-15 20:25:48 -0400
committerBrian Potchik <brian@vector35.com>2025-07-15 20:25:48 -0400
commit0fdf63426e186102906c1fb8b8e7107c058023ae (patch)
tree064cfc4c0f04e10ab07066c98b9d62547927cdb3
parentecf8b3f9d730bc08bf40c7ef2e5659769a77ee1e (diff)
Finish guided analysis feature and add unit tests.
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h3
-rw-r--r--function.cpp6
-rw-r--r--python/function.py3
4 files changed, 12 insertions, 1 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 595c827e..50312bbc 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -11602,6 +11602,7 @@ namespace BinaryNinja {
void RemoveGuidedSourceBlocks(const std::vector<ArchAndAddr>& addresses);
bool IsGuidedSourceBlock(Architecture* arch, uint64_t addr) const;
std::vector<ArchAndAddr> GetGuidedSourceBlocks();
+ bool HasGuidedSourceBlocks() const;
std::vector<IndirectBranchInfo> GetIndirectBranches();
std::vector<IndirectBranchInfo> GetIndirectBranchesAt(Architecture* arch, uint64_t addr);
diff --git a/binaryninjacore.h b/binaryninjacore.h
index dd1c8c56..93a15b54 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -37,7 +37,7 @@
// Current ABI version for linking to the core. This is incremented any time
// there are changes to the API that affect linking, including new functions,
// new types, or modifications to existing functions or types.
-#define BN_CURRENT_CORE_ABI_VERSION 124
+#define BN_CURRENT_CORE_ABI_VERSION 125
// Minimum ABI version that is supported for loading of plugins. Plugins that
// are linked to an ABI version less than this will not be able to load and
@@ -5170,6 +5170,7 @@ extern "C"
BINARYNINJACOREAPI void BNRemoveGuidedSourceBlocks(BNFunction* func, BNArchitectureAndAddress* addresses, size_t count);
BINARYNINJACOREAPI bool BNIsGuidedSourceBlock(BNFunction* func, BNArchitecture* arch, uint64_t addr);
BINARYNINJACOREAPI BNArchitectureAndAddress* BNGetGuidedSourceBlocks(BNFunction* func, size_t* count);
+ BINARYNINJACOREAPI bool BNHasGuidedSourceBlocks(BNFunction* func);
BINARYNINJACOREAPI void BNFreeArchitectureAndAddressList(BNArchitectureAndAddress* addresses);
BINARYNINJACOREAPI BNIndirectBranchInfo* BNGetIndirectBranches(BNFunction* func, size_t* count);
diff --git a/function.cpp b/function.cpp
index 1b2c0a46..1d35aa7d 100644
--- a/function.cpp
+++ b/function.cpp
@@ -1750,6 +1750,12 @@ std::vector<ArchAndAddr> Function::GetGuidedSourceBlocks()
}
+bool Function::HasGuidedSourceBlocks() const
+{
+ return BNHasGuidedSourceBlocks(m_object);
+}
+
+
vector<IndirectBranchInfo> Function::GetIndirectBranches()
{
size_t count;
diff --git a/python/function.py b/python/function.py
index eb80f9b0..b4343d00 100644
--- a/python/function.py
+++ b/python/function.py
@@ -2352,6 +2352,9 @@ class Function:
if addresses is not None:
core.BNFreeArchitectureAndAddressList(addresses)
+ def has_guided_source_blocks(self) -> bool:
+ return core.BNHasGuidedSourceBlocks(self.handle)
+
def get_indirect_branches_at(
self, addr: int, arch: Optional['architecture.Architecture'] = None
) -> List['variable.IndirectBranchInfo']: