Reoganize Function/BasicBlock creation
[frida/frida.git] / src / core / Function.hxx
1 #ifndef INCLUDE__Function_hxx
2 #define INCLUDE__Function_hxx
3
4 #include <map>
5 #include "BasicBlock.hxx"
6
7 class InformationManager;
8
9 class Function {
10 public:
11
12 uint64_t getStartAddress() const {
13 return start_address;
14 }
15
16 std::string getName() const
17 { return name; }
18 void setName(const std::string& new_name);
19
20 InformationManager* getManager() const {
21 return manager;
22 }
23
24 void addBasicBlock(BasicBlock* block) {
25 _blocks.insert(std::make_pair(block->getStartAddress(), block));
26 }
27
28 const std::map<uint64_t, BasicBlock*>& blocks() {
29 return _blocks;
30 }
31 private:
32 Function(uint64_t start_address, InformationManager* manager);
33
34 std::string name;
35 uint64_t start_address;
36 InformationManager * manager;
37 std::map<uint64_t, BasicBlock*> _blocks;
38
39 friend class InformationManager;
40 };
41
42 #endif