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:
Horst Schirmeier
2014-06-25 23:10:57 +02:00
parent e73ac88d1b
commit 7394a2cd53

View File

@ -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;
}
// 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();
if (instr_map.find(ev.ip()) == instr_map.end()) {
LOG << "Could not find instruction for IP: " << std::hex << ev.ip() << std::endl;
return false;
LOG << "Could not find instruction for IP " << std::hex << ev.ip()
<< ", skipping" << std::endl;
return true;
}
const LLVMDisassembler::Instr &opcode = instr_map.at(ev.ip());
//const MCRegisterInfo &reg_info = disas->getRegisterInfo();
@ -197,13 +206,5 @@ bool RegisterImporter::handle_ip_event(fail::simtime_t curtime, instruction_coun
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;
}