]> git.siccegge.de Git - frida/frida.git/commitdiff
Properly create and export BasicBlock linking
authorChristoph Egger <siccegge@cs.fau.de>
Tue, 27 May 2014 14:17:13 +0000 (16:17 +0200)
committerChristoph Egger <siccegge@cs.fau.de>
Tue, 27 May 2014 14:17:13 +0000 (16:17 +0200)
src/disassembler/Disassembler.hxx
src/disassembler/llvm/LLVMDisassembler.cxx
src/disassembler/llvm/LLVMDisassembler.hxx

index 285c6738462669a59767b149c7cb06115b9ed4e6..7ad4dc02623d834134b4f38e7f53abf8a17ee595 100644 (file)
@@ -17,6 +17,7 @@ public:
        uint64_t entryAddress();
 
        virtual void forEachFunction(std::function<void (uint64_t, Function*)> callback) = 0;
+       virtual BasicBlock * getBasicBlock(uint64_t address) = 0;
 
 protected:
     virtual bool isFunctionCall(uint64_t address) = 0;
index c6146f81e2ed209c64544da23de9b28e429048f5..a8c2867f50784255a27246bb10be5db9312d2e87 100644 (file)
@@ -214,6 +214,7 @@ void LLVMDisassembler::disassemble() {
                                                                if (blocks.find(jmptarget) == blocks.end()) {
                                                                        LLVMBasicBlock * block = new LLVMBasicBlock(jmptarget);
                                                                        blocks.insert(std::make_pair(block->getStartAddress(), block));
+                                                                       current_block->setNextBlock(0, block->getStartAddress());
                                                                        remaining_blocks.push(block);
                                                                }
                                 if (MIA->isConditionalBranch(inst)) {
@@ -221,6 +222,7 @@ void LLVMDisassembler::disassemble() {
                                                                        if (blocks.find(jmptarget) == blocks.end()) {
                                                                                LLVMBasicBlock * block = new LLVMBasicBlock(jmptarget);
                                                                                blocks.insert(std::make_pair(block->getStartAddress(), block));
+                                                                               current_block->setNextBlock(1, block->getStartAddress());
                                                                                remaining_blocks.push(new LLVMBasicBlock(jmptarget));
                                                                        }
                                 }
index 682b1dfd89141d18943a2a8b43d5e357b107206c..848b20e4a7cff206c66c7ba4e78ef5f16e1be39f 100644 (file)
@@ -24,6 +24,9 @@ public:
        uint64_t entryAddress();
 
        void forEachFunction(std::function<void (uint64_t, Function*)> callback);
+       BasicBlock * getBasicBlock(uint64_t address) {
+               return blocks[address];
+       }
 
 protected:
     bool isFunctionCall(uint64_t address) {return false;}