]>
git.siccegge.de Git - frida/frida.git/blob - src/disassembler.old/InstructionReader.cxx
1 #include "InstructionReader.hxx"
3 InstructionReader::InstructionReader(const Target
& target
)
4 : _logger(log4cxx::Logger::getLogger("disassembler.Target"))
7 DisAsm
.reset(_target
.getTarget().createMCDisassembler(_target
.getSubTargetInfo()));
9 LOG4CXX_ERROR(_logger
, "error: no disassembler for target " << _target
.getTripleName())
14 void InstructionReader::readInstruction(std::string
& data
, size_t& offset
, Instruction
& inst
) {
16 llvm::StringRefMemoryObject
memoryObject(data
);
19 if (DisAsm
->getInstruction(instr
, size
, memoryObject
, offset
,
20 llvm::nulls(), llvm::nulls())) {
23 LOG4CXX_WARN(_logger
, "warning: invalid instruction encoding");
25 size
= 1; // skip illegible bytes