]> git.siccegge.de Git - frida/frida.git/blob - src/core/Function.hxx
Restructure InformationManager
[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 class QXmlStreamWriter;
9
10 class Function {
11 public:
12 uint64_t getStartAddress() const { return start_address; }
13
14 std::string getName() const { return name; }
15 void setName(const std::string& new_name);
16
17 InformationManager* getManager() const { return manager; }
18
19 bool isDynamic() const { return dynamic; }
20
21 void addBasicBlock(BasicBlock* block) {
22 _blocks.insert(std::make_pair(block->getStartAddress(), block));
23 }
24
25 const std::map<uint64_t, BasicBlock*>& blocks() {
26 return _blocks;
27 }
28
29 void serialize(QXmlStreamWriter& stream);
30 static Function* deserialize(QXmlStreamReader& stream, InformationManager* manager);
31
32 private:
33 Function(uint64_t start_address, bool dynamic, InformationManager* manager);
34
35 std::string name;
36 uint64_t start_address;
37 bool dynamic;
38 InformationManager * manager;
39 std::map<uint64_t, BasicBlock*> _blocks;
40
41 friend class InformationManager;
42 };
43
44 #endif