summaryrefslogtreecommitdiff
path: root/binaryview.cpp
diff options
context:
space:
mode:
authorZichuan Li <lizic@iu.edu>2024-05-21 17:56:03 -0400
committerZichuan Li <34680029+river-li@users.noreply.github.com>2024-05-28 12:22:23 -0400
commit9537f33da6b8de883a45c4b7758f0dc5c1438ed7 (patch)
tree08e9844aab5b9e830d9b30303b59fd0f022bea5a /binaryview.cpp
parent2a6cef7eac64dc3df4a17ba3dc73fb5e1046fc29 (diff)
Solved issue #1180 by adding new APIs
1. Add two new APIs for multiple entry functions `GetAllAnalysisEntryFunctions` and `AddToEntryFunctions` 2. Add Python APIs `entry_functions` and `add_to_entry_functions`. `entry_functions` resturns a list of functions, which supports parsing functions in `init_array`, `fini_array` and TLS callbacks. 3. Modify bin-info, it now prints all entry functions
Diffstat (limited to 'binaryview.cpp')
-rw-r--r--binaryview.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/binaryview.cpp b/binaryview.cpp
index b5c34177..929d0fe9 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -1985,6 +1985,12 @@ void BinaryView::AddEntryPointForAnalysis(Platform* platform, uint64_t addr)
}
+void BinaryView::AddToEntryFunctions(Function* func)
+{
+ BNAddToEntryFunctions(m_object, func->GetObject());
+}
+
+
void BinaryView::RemoveAnalysisFunction(Function* func, bool updateRefs)
{
BNRemoveAnalysisFunction(m_object, func->GetObject(), updateRefs);
@@ -2208,6 +2214,21 @@ Ref<Function> BinaryView::GetAnalysisEntryPoint()
}
+vector<Ref<Function>> BinaryView::GetAllEntryFunctions()
+{
+ size_t count;
+ BNFunction** funcs = BNGetAllEntryFunctions(m_object, &count);
+ if (count == 0)
+ return {};
+
+ vector<Ref<Function>> result;
+ for (size_t i = 0; i < count; i++)
+ result.push_back(new Function(BNNewFunctionReference(funcs[i])));
+ BNFreeFunctionList(funcs, count);
+ return result;
+}
+
+
Ref<BasicBlock> BinaryView::GetRecentBasicBlockForAddress(uint64_t addr)
{
BNBasicBlock* block = BNGetRecentBasicBlockForAddress(m_object, addr);