]> git.siccegge.de Git - frida/frida.git/blobdiff - src/core/Function.hxx
Move Function/BasicBlock to core and clean up includes
[frida/frida.git] / src / core / Function.hxx
diff --git a/src/core/Function.hxx b/src/core/Function.hxx
new file mode 100644 (file)
index 0000000..3c8f799
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef INCLUDE__Function_hxx
+#define INCLUDE__Function_hxx
+
+#include <map>
+#include "BasicBlock.hxx"
+
+class Function {
+public:
+       Function(const std::string& name, uint64_t start_address)
+               : name(name)
+               , start_address(start_address) {
+       }
+
+       uint64_t getStartAddress() const {
+               return start_address;
+       }
+
+       std::string getName() const {
+               return name;
+       }
+
+       void addBasicBlock(BasicBlock* block) {
+               _blocks.insert(std::make_pair(block->getStartAddress(), block));
+       }
+
+       std::map<uint64_t, BasicBlock*>& blocks() {
+               return _blocks;
+       }
+private:
+       std::string name;
+       uint64_t start_address;
+       std::map<uint64_t, BasicBlock*> _blocks;
+};
+
+#endif