Skip to content
Snippets Groups Projects
Commit 84edd02b authored by Horst Schirmeier's avatar Horst Schirmeier
Browse files

import-trace: emit warning for malformed traces

The Fail* tools expect trace events to be ordered in a specific way:
memory-access events are supposed to come *after* the instruction
event for the instruction that caused them.  Using a different order
may cause subtle problems with both fault-space pruning and fast
forwarding.  This change introduces a warning message when such a
malformed trace is detected (i.e., when the instruction pointer of a
memory-access event does not match the preceding instruction event).

Change-Id: I8ae7420fd8ff26e2574590748bdcc5a63db76490
parent 5ac108ea
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,8 @@ bool Importer::copy_to_database(fail::ProtoIStream &ps) {
instruction_count_t instr = 0;
// instruction counter new memory access events belong to
instruction_count_t instr_memaccess = 0;
// absolute instruction address of the latest IP event
guest_address_t instr_memaccess_absolute = 0;
// the currently processed event
Trace_Event ev;
......@@ -104,8 +106,15 @@ bool Importer::copy_to_database(fail::ProtoIStream &ps) {
// all subsequent mem access events belong to this dynamic instr
instr_memaccess = instr;
instr_memaccess_absolute = ev.ip();
instr++;
} else {
if (ev.ip() != instr_memaccess_absolute) {
LOG << "warning: mem-access IP 0x" << std::hex << ev.ip()
<< " differs from previous instruction IP 0x" << instr_memaccess_absolute
<< " at instr=" << std::dec << instr_memaccess
<< " (mem accesses must follow *after* their corresponding IP events in the trace!)" << std::endl;
}
if (!handle_mem_event(curtime, instr_memaccess, ev)) {
LOG << "error: handle_mem_event() failed at instr=" << instr_memaccess << std::endl;
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment