import-trace: let RegisterImporter ignore unknown IP
This change makes the RegisterImporter continue importing if it encounters an instruction pointer that is not part of the disassembled ELF binary (and, thus, cannot be disassembled). This is OK if we don't want to inject into registers used by these instructions. Change-Id: Ia9b5e7f789367f8386d63f235451dae5d399610d
This commit is contained in:
@ -148,10 +148,19 @@ bool RegisterImporter::handle_ip_event(fail::simtime_t curtime, instruction_coun
|
|||||||
LOG << "instructions disassembled: " << instr_map.size() << " Triple: " << disas->GetTriple() << std::endl;
|
LOG << "instructions disassembled: " << instr_map.size() << " Triple: " << disas->GetTriple() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// instruction pointer is read + written at each instruction
|
||||||
|
const LLVMtoFailTranslator::reginfo_t info_pc(m_ip_register_id);
|
||||||
|
if (do_ip &&
|
||||||
|
(!addRegisterTrace(curtime, instr, ev, info_pc, 'R') ||
|
||||||
|
!addRegisterTrace(curtime, instr, ev, info_pc, 'W'))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const LLVMDisassembler::InstrMap &instr_map = disas->getInstrMap();
|
const LLVMDisassembler::InstrMap &instr_map = disas->getInstrMap();
|
||||||
if (instr_map.find(ev.ip()) == instr_map.end()) {
|
if (instr_map.find(ev.ip()) == instr_map.end()) {
|
||||||
LOG << "Could not find instruction for IP: " << std::hex << ev.ip() << std::endl;
|
LOG << "Could not find instruction for IP " << std::hex << ev.ip()
|
||||||
return false;
|
<< ", skipping" << std::endl;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
const LLVMDisassembler::Instr &opcode = instr_map.at(ev.ip());
|
const LLVMDisassembler::Instr &opcode = instr_map.at(ev.ip());
|
||||||
//const MCRegisterInfo ®_info = disas->getRegisterInfo();
|
//const MCRegisterInfo ®_info = disas->getRegisterInfo();
|
||||||
@ -197,13 +206,5 @@ bool RegisterImporter::handle_ip_event(fail::simtime_t curtime, instruction_coun
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LLVMtoFailTranslator::reginfo_t info_pc(m_ip_register_id);
|
|
||||||
if (do_ip) {
|
|
||||||
if (!addRegisterTrace(curtime, instr, ev, info_pc, 'R'))
|
|
||||||
return false;
|
|
||||||
if (!addRegisterTrace(curtime, instr, ev, info_pc, 'W'))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user