"failstar" sounds like a name for a cruise liner from the 80s. As "*" isn't a desirable part of directory names, just name the whole thing "fail/", the core parts being stored in "fail/core/". Additionally fixing two build system dependency issues: - missing jobserver -> protomessages dependency - broken bochs -> fail dependency (add_custom_target DEPENDS only allows plain file dependencies ... cmake for the win) git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@956 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
76 lines
1.7 KiB
C++
76 lines
1.7 KiB
C++
#include <iostream>
|
|
|
|
#include "SAL/SALInst.hpp"
|
|
#include "SAL/Register.hpp"
|
|
#include "TracingPlugin.hpp"
|
|
|
|
using std::cout;
|
|
using std::endl;
|
|
|
|
using namespace fi;
|
|
using namespace sal;
|
|
|
|
bool TracingPlugin::run()
|
|
{
|
|
MemAccessEvent ev_mem(ANY_ADDR);
|
|
BPEvent ev_step(ANY_ADDR);
|
|
BaseEvent *ev;
|
|
|
|
if (m_iponly || !m_memonly) {
|
|
simulator.addEvent(&ev_step);
|
|
}
|
|
if (m_memonly || !m_iponly) {
|
|
simulator.addEvent(&ev_mem);
|
|
}
|
|
|
|
while (true) {
|
|
ev = simulator.waitAny();
|
|
|
|
if (ev == &ev_step) {
|
|
simulator.addEvent(&ev_step);
|
|
|
|
address_t ip = ev_step.getTriggerInstructionPointer();
|
|
if (m_ipMap && !m_ipMap->isMatching(ip)) {
|
|
continue;
|
|
}
|
|
|
|
if (m_os)
|
|
*m_os << "[Tracing] IP " << hex << ip << "\n";
|
|
if (m_trace) {
|
|
Trace_Event *e = m_trace->add_event();
|
|
e->set_ip(ip);
|
|
}
|
|
} else if (ev == &ev_mem) {
|
|
simulator.addEvent(&ev_mem);
|
|
|
|
address_t ip = ev_mem.getTriggerInstructionPointer();
|
|
address_t addr = ev_mem.getTriggerAddress();
|
|
size_t width = ev_mem.getTriggerWidth();
|
|
if ((m_ipMap && !m_ipMap->isMatching(ip)) ||
|
|
(m_memMap && !m_memMap->isMatching(addr, width))) {
|
|
continue;
|
|
}
|
|
|
|
if (m_os)
|
|
*m_os << hex << "[Tracing] MEM "
|
|
<< ((ev_mem.getTriggerAccessType() &
|
|
MemAccessEvent::MEM_READ) ? "R " : "W ")
|
|
<< addr << " width " << width << " IP " << ip << "\n";
|
|
if (m_trace) {
|
|
Trace_Event *e = m_trace->add_event();
|
|
e->set_ip(ip);
|
|
e->set_memaddr(addr);
|
|
e->set_width(width);
|
|
e->set_accesstype(
|
|
(ev_mem.getTriggerAccessType() & MemAccessEvent::MEM_READ) ?
|
|
e->READ : e->WRITE);
|
|
}
|
|
} else {
|
|
if (m_os)
|
|
*m_os << "[Tracing] SOMETHING IS SERIOUSLY WRONG\n";
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|