Add doc repo as submodule
[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 class QXmlStreamReader;
10
11 class Function {
12 public:
13 uint64_t getStartAddress() const { return start_address; }
14
15 std::string getName() const { return name; }
16 void setName(const std::string& new_name);
17
18 InformationManager* getManager() const { return manager; }
19
20 /* Dynamic functions are the ones which are imported from shared
21 * libraries and not structly part of the binary at hand
22 */
23 bool isDynamic() const { return dynamic; }
24
25 void addBasicBlock(BasicBlock* block) {
26 _blocks.insert(std::make_pair(block->getStartAddress(), block));
27 }
28
29 const std::map<uint64_t, BasicBlock*>& blocks() {
30 return _blocks;
31 }
32
33 void serialize(QXmlStreamWriter& stream);
34 static Function* deserialize(QXmlStreamReader& stream, InformationManager* manager);
35
36 private:
37 Function(uint64_t start_address, bool dynamic, InformationManager* manager);
38
39 std::string name;
40 uint64_t start_address;
41 bool dynamic;
42 InformationManager * manager;
43 std::map<uint64_t, BasicBlock*> _blocks;
44
45 friend class InformationManager;
46 };
47
48 #endif