summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2024-07-05 13:15:48 +0800
committerXusheng <xusheng@vector35.com>2024-07-09 10:24:45 +0800
commitc85a0a26c12fcef22ee0df37a54716d139c589cf (patch)
tree43017bb51600fd87ea5b49bd9ff98096ba1b35e9
parent1bab71bba6b2777ebe84313dcf22ec7d4edcd1d7 (diff)
Expose Function::UsesIncomingGlobalPointer through the API. Fix https://github.com/Vector35/binaryninja-api/issues/5686
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h1
-rw-r--r--function.cpp6
-rw-r--r--python/function.py5
4 files changed, 13 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index c37a1a3d..0a1fab7c 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -10793,6 +10793,7 @@ namespace BinaryNinja {
std::vector<DisassemblyTextLine> GetTypeTokens(DisassemblySettings* settings = nullptr);
Confidence<RegisterValue> GetGlobalPointerValue() const;
+ bool UsesIncomingGlobalPointer() const;
Confidence<RegisterValue> GetRegisterValueAtExit(uint32_t reg) const;
/*! Whether the function is too large to automatically perform analysis
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 16d86fc7..081f0d4b 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -4416,6 +4416,7 @@ extern "C"
BNFunction* func, BNDisassemblySettings* settings, size_t* count);
BINARYNINJACOREAPI BNRegisterValueWithConfidence BNGetFunctionGlobalPointerValue(BNFunction* func);
+ BINARYNINJACOREAPI bool BNFunctionUsesIncomingGlobalPointer(BNFunction* func);
BINARYNINJACOREAPI BNRegisterValueWithConfidence BNGetFunctionRegisterValueAtExit(BNFunction* func, uint32_t reg);
BINARYNINJACOREAPI BNBoolWithConfidence BNIsFunctionInlinedDuringAnalysis(BNFunction* func);
diff --git a/function.cpp b/function.cpp
index 2838f079..8497ccec 100644
--- a/function.cpp
+++ b/function.cpp
@@ -2399,6 +2399,12 @@ Confidence<RegisterValue> Function::GetGlobalPointerValue() const
}
+bool Function::UsesIncomingGlobalPointer() const
+{
+ return BNFunctionUsesIncomingGlobalPointer(m_object);
+}
+
+
Confidence<RegisterValue> Function::GetRegisterValueAtExit(uint32_t reg) const
{
BNRegisterValueWithConfidence value = BNGetFunctionRegisterValueAtExit(m_object, reg);
diff --git a/python/function.py b/python/function.py
index e43570a7..e21716ac 100644
--- a/python/function.py
+++ b/python/function.py
@@ -1822,6 +1822,11 @@ class Function:
return variable.RegisterValue.from_BNRegisterValue(result, self.arch)
@property
+ def uses_incoming_global_pointer(self) -> bool:
+ """Whether the function uses the incoming global pointer value"""
+ return core.BNFunctionUsesIncomingGlobalPointer(self.handle)
+
+ @property
def comment(self) -> str:
"""Gets the comment for the current function"""
return core.BNGetFunctionComment(self.handle)