]> git.siccegge.de Git - frida/frida.git/commitdiff
Remove deprecated printEachInstruction function
authorChristoph Egger <christoph@anonymous.siccegge.de>
Sat, 16 May 2015 13:59:50 +0000 (15:59 +0200)
committerChristoph Egger <christoph@anonymous.siccegge.de>
Sat, 16 May 2015 13:59:50 +0000 (15:59 +0200)
replaced by getInstructions, no users left

src/disassembler/Disassembler.hxx
src/disassembler/llvm/LLVMDisassembler.cxx
src/disassembler/llvm/LLVMDisassembler.hxx

index ffcc889caee40f8118494cf9bd3583ac130ac466..7e1e3e1a2eb3574235dd1402b125858a3d14a50d 100644 (file)
@@ -20,9 +20,6 @@ public:
        virtual void getSymbols() = 0;
        virtual uint64_t entryAddress() = 0;
 
-       virtual void printEachInstruction(uint64_t start, uint64_t end,
-                                         std::function<void (uint8_t*, size_t, const std::string&,
-                                                             const std::string&)> fun) = 0;
        virtual Function * disassembleFunctionAt(uint64_t address, const std::string& name = "") = 0;
        virtual std::vector<Instruction> getInstructions(const BasicBlock* block) = 0;
 };
index 831a1a9da7a09f0e34ca055e49e8c4bb640fcc3d..049f1fc90477b82d1a30427bbd7352a9d7a98cf3 100644 (file)
@@ -694,83 +694,6 @@ std::vector<Instruction> LLVMDisassembler<ELFT>::getInstructions(const BasicBloc
        return result;
 }
 
-template <typename ELFT>
-void LLVMDisassembler<ELFT>::printEachInstruction(uint64_t start, uint64_t end,
-                                                  std::function<void (uint8_t*, size_t,
-                                                                         const std::string&,
-                                                                         const std::string&)> fun) {
-       SectionRef text_section = getTextSection();
-       uint64_t base_address;
-#if defined(LLVM_35)
-       text_section.getAddress(base_address);
-#elif defined(LLVM_36)
-       base_address = text_section.getAddress();
-#endif
-
-       uint64_t current_address = start - base_address;
-
-       StringRef bytes;
-       text_section.getContents(bytes);
-#if defined(LLVM_35)
-       StringRefMemoryObject ref(bytes);
-#elif defined(LLVM_36)
-       ArrayRef<uint8_t> bytearray(reinterpret_cast<const uint8_t *>(bytes.data()),
-                          bytes.size());
-#endif
-
-
-       while (current_address < end - base_address) {
-               uint64_t inst_size;
-               MCInst inst;
-               std::string buf;
-               llvm::raw_string_ostream s(buf);
-
-               if(llvm::MCDisassembler::Success ==
-#if defined(LLVM_35)
-                          DisAsm->getInstruction(inst, inst_size, ref, current_address, nulls(), nulls())) {
-#elif defined(LLVM_36)
-                               DisAsm->getInstruction(inst, inst_size,
-                                                      bytearray.slice(current_address),
-                                                      base_address + current_address,
-                                                      nulls(), nulls())) {
-#endif
-
-                       uint8_t bytes[inst_size+2];
-#if defined(LLVM_35)
-                       ref.readBytes(current_address, inst_size, bytes);
-#elif defined(LLVM_36)
-                       size_t bytesindex(0);
-                       for (uint8_t byte : bytearray.slice(current_address, inst_size)) {
-                               bytes[bytesindex++] = byte;
-                       }
-#endif
-
-                       uint64_t jmptarget;
-                       std::string ref("");
-                       IP->printInst(&inst, s, "");
-                       if (MIA->evaluateBranch(inst, current_address, inst_size, jmptarget)) {
-                               std::stringstream stream;
-                               if (MIA->isCall(inst))
-                                       stream << "function:";
-                               else
-                                       stream << "block:";
-
-                               stream << std::hex << (base_address + jmptarget);
-                               ref = stream.str();
-                       }
-
-
-                       fun(bytes, inst_size, s.str(), ref);
-               } else {
-                       LOG4CXX_WARN(logger, "Invalid byte at" << std::hex << current_address + base_address);
-                       fun(NULL, 0, "Invalid Byte", "");
-                       inst_size = 1;
-               }
-
-               current_address += inst_size;
-       }
-}
-
 template <typename ELFT>
 SectionRef LLVMDisassembler<ELFT>::getTextSection() {
        return sections[".text"];
index d8d4056734f458b416ae005b753c8a667ed1a35d..b9fc4530aa2c01d34642816760c97638a7b7fde4 100644 (file)
@@ -26,10 +26,6 @@ public:
        void getSymbols() {}
        uint64_t entryAddress();
 
-       void printEachInstruction(uint64_t start, uint64_t end,
-                                 std::function<void (uint8_t*, size_t, const std::string&,
-                                                     const std::string&)> fun);
-
        Function * disassembleFunctionAt(uint64_t address, const std::string& name = "");
        std::vector<Instruction> getInstructions(const BasicBlock* block);