]> git.siccegge.de Git - frida/frida.git/blobdiff - src/core/Function.hxx
Add doc repo as submodule
[frida/frida.git] / src / core / Function.hxx
index 39d3f51b47cc39aab43c453f0cf3edc4b598b55f..3a328f6d203c027b57acf18b034477d4ff7192cd 100644 (file)
@@ -5,40 +5,44 @@
 #include "BasicBlock.hxx"
 
 class InformationManager;
+class QXmlStreamWriter;
+class QXmlStreamReader;
 
 class Function {
 public:
-       Function(const std::string& name, uint64_t start_address,
-                InformationManager* manager)
-               : name(name)
-               , start_address(start_address)
-               ,manager(manager) {}
-
-       uint64_t getStartAddress() const {
-               return start_address;
-       }
+       uint64_t getStartAddress() const { return start_address; }
 
-       std::string getName() const
-               { return name; }
-       void setName(const std::string& new_name)
-               { name = new_name; }
+       std::string getName() const { return name; }
+       void setName(const std::string& new_name);
 
-       InformationManager* getManager() const {
-               return manager;
-       }
+       InformationManager* getManager() const { return manager; }
+
+       /* Dynamic functions are the ones which are imported from shared
+        * libraries and not structly part of the binary at hand
+        */
+       bool isDynamic() const { return dynamic; }
 
        void addBasicBlock(BasicBlock* block) {
                _blocks.insert(std::make_pair(block->getStartAddress(), block));
        }
 
-       std::map<uint64_t, BasicBlock*>& blocks() {
+       const std::map<uint64_t, BasicBlock*>& blocks() {
                return _blocks;
        }
+
+       void serialize(QXmlStreamWriter& stream);
+       static Function* deserialize(QXmlStreamReader& stream, InformationManager* manager);
+
 private:
+       Function(uint64_t start_address, bool dynamic, InformationManager* manager);
+
        std::string name;
        uint64_t start_address;
+       bool dynamic;
        InformationManager * manager;
        std::map<uint64_t, BasicBlock*> _blocks;
+
+       friend class InformationManager;
 };
 
 #endif