blob: 6e0a221d219e17099cf09c0072ed9916c992200c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#include "binaryninjaapi.h"
using namespace BinaryNinja;
using namespace std;
Function::Function(BNFunction* func): m_func(func)
{
}
Function::~Function()
{
BNFreeFunction(m_func);
}
Ref<Architecture> Function::GetArchitecture() const
{
return new CoreArchitecture(BNGetFunctionArchitecture(m_func));
}
uint64_t Function::GetStart() const
{
return BNGetFunctionStart(m_func);
}
Ref<Symbol> Function::GetSymbol() const
{
return new Symbol(BNGetFunctionSymbol(m_func));
}
vector<Ref<BasicBlock>> Function::GetBasicBlocks() const
{
size_t count;
BNBasicBlock** blocks = BNGetFunctionBasicBlockList(m_func, &count);
vector<Ref<BasicBlock>> result;
for (size_t i = 0; i < count; i++)
result.push_back(new BasicBlock(BNNewBasicBlockReference(blocks[i])));
BNFreeBasicBlockList(blocks, count);
return result;
}
void Function::MarkRecentUse()
{
BNMarkFunctionAsRecentlyUsed(m_func);
}
Ref<LowLevelILFunction> Function::GetLowLevelIL() const
{
return new LowLevelILFunction(BNGetFunctionLowLevelIL(m_func));
}
vector<Ref<BasicBlock>> Function::GetLowLevelILBasicBlocks() const
{
size_t count;
BNBasicBlock** blocks = BNGetFunctionLowLevelILBasicBlockList(m_func, &count);
vector<Ref<BasicBlock>> result;
for (size_t i = 0; i < count; i++)
result.push_back(new BasicBlock(BNNewBasicBlockReference(blocks[i])));
BNFreeBasicBlockList(blocks, count);
return result;
}
Ref<FunctionGraph> Function::CreateFunctionGraph()
{
BNFunctionGraph* graph = BNCreateFunctionGraph(m_func);
return new FunctionGraph(graph);
}
|