summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2021-08-20 16:28:39 -0400
committerBrian Potchik <brian@vector35.com>2021-08-20 16:28:39 -0400
commit72d95afd2541fd8d463a853375f4f36993e7c099 (patch)
tree614bd36961a4f6d11e9e4744f1ac874eb3dcaa86
parentcc1e85a4a8b2001f9fd6cf91b93fb39abef3a0e2 (diff)
Workflows basic blocks and IL function analysis setters.
-rw-r--r--binaryninjaapi.h10
-rw-r--r--binaryninjacore.h9
-rw-r--r--workflow.cpp30
3 files changed, 43 insertions, 6 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 59e920aa..7c595b69 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -2296,8 +2296,10 @@ __attribute__ ((format (printf, 1, 2)))
NameAndType(const std::string& n, const Confidence<Ref<Type>>& t): name(n), type(t) {}
};
+ class Function;
class LowLevelILFunction;
class MediumLevelILFunction;
+ class HighLevelILFunction;
class FunctionRecognizer;
class CallingConvention;
class RelocationHandler;
@@ -3119,7 +3121,11 @@ __attribute__ ((format (printf, 1, 2)))
Ref<LowLevelILFunction> GetLowLevelILFunction();
Ref<MediumLevelILFunction> GetMediumLevelILFunction();
+ void SetBasicBlockList(std::vector<Ref<BasicBlock>> basicBlocks);
+ void SetLiftedILFunction(Ref<LowLevelILFunction> liftedIL);
void SetLowLevelILFunction(Ref<LowLevelILFunction> lowLevelIL);
+ void SetMediumLevelILFunction(Ref<MediumLevelILFunction> mediumLevelIL);
+ void SetHighLevelILFunction(Ref<HighLevelILFunction> highLevelIL);
bool Inform(const std::string& request);
@@ -3214,8 +3220,6 @@ __attribute__ ((format (printf, 1, 2)))
void SetGutterWidth(size_t width);
};
- class Function;
-
struct BasicBlockEdge
{
BNBranchType type;
@@ -3370,8 +3374,6 @@ __attribute__ ((format (printf, 1, 2)))
};
class FlowGraph;
- class MediumLevelILFunction;
- class HighLevelILFunction;
struct SSAVariable;
class Function: public CoreRefCountObject<BNFunction, BNNewFunctionReference, BNFreeFunction>
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 6eb5dfae..0a915710 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -27,7 +27,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 13
+#define BN_CURRENT_CORE_ABI_VERSION 14
// 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
@@ -3142,7 +3142,7 @@ __attribute__ ((format (printf, 1, 2)))
BINARYNINJACOREAPI void BNRegisterPlatformRecognizerForViewType(BNBinaryViewType* type, uint64_t id, BNEndianness endian,
BNPlatform* (*callback)(void* ctx, BNBinaryView* view, BNMetadata* metadata), void* ctx);
- // BinaryView* passed in here should be the parent view (not the partially constructed object!), and this function should
+ // BinaryView* passed in here should be the parent view (not the partially constructed object!), and this function should
// be called from the BNCustomBinaryView::init implementation.
//
// 'id' and 'endianness' are used to determine which registered callbacks are actually invoked to eliminate some common sources
@@ -4043,7 +4043,12 @@ __attribute__ ((format (printf, 1, 2)))
BINARYNINJACOREAPI BNFunction* BNAnalysisContextGetFunction(BNAnalysisContext* analysisContext);
BINARYNINJACOREAPI BNLowLevelILFunction* BNAnalysisContextGetLowLevelILFunction(BNAnalysisContext* analysisContext);
BINARYNINJACOREAPI BNMediumLevelILFunction* BNAnalysisContextGetMediumLevelILFunction(BNAnalysisContext* analysisContext);
+
+ BINARYNINJACOREAPI void BNSetBasicBlockList(BNAnalysisContext* analysisContext, BNBasicBlock** basicBlocks, size_t count);
+ BINARYNINJACOREAPI void BNSetLiftedILFunction(BNAnalysisContext* analysisContext, BNLowLevelILFunction* liftedIL);
BINARYNINJACOREAPI void BNSetLowLevelILFunction(BNAnalysisContext* analysisContext, BNLowLevelILFunction* lowLevelIL);
+ BINARYNINJACOREAPI void BNSetMediumLevelILFunction(BNAnalysisContext* analysisContext, BNMediumLevelILFunction* mediumLevelIL);
+ BINARYNINJACOREAPI void BNSetHighLevelILFunction(BNAnalysisContext* analysisContext, BNHighLevelILFunction* highLevelIL);
BINARYNINJACOREAPI bool BNAnalysisContextInform(BNAnalysisContext* analysisContext, const char* request);
// Activity
diff --git a/workflow.cpp b/workflow.cpp
index 63137ebc..70cd1ced 100644
--- a/workflow.cpp
+++ b/workflow.cpp
@@ -48,12 +48,42 @@ Ref<MediumLevelILFunction> AnalysisContext::GetMediumLevelILFunction()
}
+void AnalysisContext::SetBasicBlockList(vector<Ref<BasicBlock>> basicBlocks)
+{
+ BNBasicBlock** blocks = new BNBasicBlock*[basicBlocks.size()];
+ size_t i = 0;
+ for (auto& j : basicBlocks)
+ blocks[i++] = j->GetObject();
+
+ BNSetBasicBlockList(m_object, blocks, basicBlocks.size());
+ delete[] blocks;
+}
+
+
+void AnalysisContext::SetLiftedILFunction(Ref<LowLevelILFunction> liftedIL)
+{
+ BNSetLiftedILFunction(m_object, liftedIL->m_object);
+}
+
+
void AnalysisContext::SetLowLevelILFunction(Ref<LowLevelILFunction> lowLevelIL)
{
BNSetLowLevelILFunction(m_object, lowLevelIL->m_object);
}
+void AnalysisContext::SetMediumLevelILFunction(Ref<MediumLevelILFunction> mediumLevelIL)
+{
+ BNSetMediumLevelILFunction(m_object, mediumLevelIL->m_object);
+}
+
+
+void AnalysisContext::SetHighLevelILFunction(Ref<HighLevelILFunction> highLevelIL)
+{
+ BNSetHighLevelILFunction(m_object, highLevelIL->m_object);
+}
+
+
bool AnalysisContext::Inform(const string& request)
{
return BNAnalysisContextInform(m_object, request.c_str());