});
}
-void LLVMDisassembler::printEachInstruction(uint64_t start, uint64_t end, std::function<void (const std::string&)> fun) {
+void LLVMDisassembler::printEachInstruction(uint64_t start, uint64_t end,
+ std::function<void (uint8_t*, size_t, const std::string&)> fun) {
SectionRef text_section = sections[".text"];
uint64_t base_address;
text_section.getAddress(base_address);
uint8_t bytes[inst_size+2];
ref.readBytes(current_address, inst_size, bytes);
- for(uint8_t* cur = bytes; cur < bytes + inst_size; ++cur) {
- s.write_hex(*cur);
- s << ' ';
- }
- s << '\t';
IP->printInst(&inst, s, "");
- fun(s.str());
+ fun(bytes, inst_size, s.str());
} else {
- fun("Invalid Byte");
+ fun(NULL, 0, "Invalid Byte");
inst_size = 1;
}