]> git.siccegge.de Git - frida/frida.git/blob - src/core/Function.hxx
Add support for deserializing functions
[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 {
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
32 void serialize(QXmlStreamWriter& stream);
33 static Function* deserialize(QXmlStreamReader& stream, InformationManager* manager);
34
35 private:
36 Function(uint64_t start_address, InformationManager* manager);
37
38 std::string name;
39 uint64_t start_address;
40 InformationManager * manager;
41 std::map<uint64_t, BasicBlock*> _blocks;
42
43 friend class InformationManager;
44 };
45
46 #endif