Files
fail/core/experiments/hscsimple/experiment.cc
hsc b70b6fb43a another directory rename: failstar -> fail
"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
2012-03-08 19:43:02 +00:00

50 lines
1.3 KiB
C++

#include <iostream>
#include <unistd.h>
#include "experiment.hpp"
#include "SAL/SALInst.hpp"
#include "SAL/bochs/BochsRegister.hpp"
#include "controller/Event.hpp"
using std::cout;
using std::endl;
bool hscsimpleExperiment::run()
{
cout << "[HSC] experiment start" << endl;
// do funny things here...
#if 0
fi::BPEvent mainbp(0x00003c34);
sal::simulator.addEventAndWait(&mainbp);
cout << "[HSC] breakpoint reached, saving" << endl;
sal::simulator.save("hello.main");
#elif 1
cout << "[HSC] restoring ..." << endl;
sal::simulator.restore("hello.main");
cout << "[HSC] restored!" << endl;
cout << "[HSC] waiting for last square() instruction" << endl;
fi::BPEvent breakpoint(0x3c9e); // square(x) ret instruction
sal::simulator.addEventAndWait(&breakpoint);
cout << "[HSC] injecting hellish fault" << endl;
#if BX_SUPPORT_X86_64
int reg = sal::RID_RAX;
#else
int reg = sal::RID_EAX;
#endif
sal::simulator.getRegisterManager().getSetOfType(sal::RT_GP).getRegister(reg)->setData(666);
cout << "[HSC] waiting for last main() instruction" << endl;
breakpoint.setWatchInstructionPointer(0x3c92);
sal::simulator.addEventAndWait(&breakpoint);
cout << "[HSC] reached" << endl;
// FIXME this shouldn't fail:
sal::simulator.addEventAndWait(&breakpoint);
#endif
return true;
}