summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2018-08-02 22:46:43 -0400
committerRusty Wagner <rusty@vector35.com>2018-08-02 22:46:43 -0400
commit7c4025df43511852ecb86d8ab608e1da476d90de (patch)
treea70c900c0fe766f2c954274be74d7e8f47dc6ace
parent657bc3ff2d000508bd4b4468e83ce37591655e17 (diff)
Add API to query if an assembly instruction is a call
-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 53e0a30d..2c467a35 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -2500,6 +2500,7 @@ namespace BinaryNinja
Confidence<size_t> GetCallStackAdjustment(Architecture* arch, uint64_t addr);
std::map<uint32_t, Confidence<int32_t>> GetCallRegisterStackAdjustment(Architecture* arch, uint64_t addr);
Confidence<int32_t> GetCallRegisterStackAdjustment(Architecture* arch, uint64_t addr, uint32_t regStack);
+ bool IsCallInstruction(Architecture* arch, uint64_t addr);
std::vector<std::vector<InstructionTextToken>> GetBlockAnnotations(Architecture* arch, uint64_t addr);
diff --git a/binaryninjacore.h b/binaryninjacore.h
index a26d1fe6..3e060c61 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -2521,6 +2521,7 @@ extern "C"
BNArchitecture* arch, uint64_t addr, size_t* count);
BINARYNINJACOREAPI BNRegisterStackAdjustment BNGetCallRegisterStackAdjustmentForRegisterStack(BNFunction* func,
BNArchitecture* arch, uint64_t addr, uint32_t regStack);
+ BINARYNINJACOREAPI bool BNIsCallInstruction(BNFunction* func, BNArchitecture* arch, uint64_t addr);
BINARYNINJACOREAPI BNInstructionTextLine* BNGetFunctionBlockAnnotations(BNFunction* func, BNArchitecture* arch,
uint64_t addr, size_t* count);
diff --git a/function.cpp b/function.cpp
index ae6d3a6b..1236cec6 100644
--- a/function.cpp
+++ b/function.cpp
@@ -1116,6 +1116,12 @@ Confidence<int32_t> Function::GetCallRegisterStackAdjustment(Architecture* arch,
}
+bool Function::IsCallInstruction(Architecture* arch, uint64_t addr)
+{
+ return BNIsCallInstruction(m_object, arch->GetObject(), addr);
+}
+
+
vector<vector<InstructionTextToken>> Function::GetBlockAnnotations(Architecture* arch, uint64_t addr)
{
size_t count;
diff --git a/python/function.py b/python/function.py
index e840dd5e..64aea87f 100644
--- a/python/function.py
+++ b/python/function.py
@@ -1586,6 +1586,11 @@ class Function(object):
result = types.RegisterStackAdjustmentWithConfidence(adjust.adjustment, confidence = adjust.confidence)
return result
+ def is_call_instruction(self, addr, arch=None):
+ if arch is None:
+ arch = self.arch
+ return core.BNIsCallInstruction(self.handle, arch.handle, addr)
+
class AdvancedFunctionAnalysisDataRequestor(object):
def __init__(self, func = None):