Moved deprecated files/folders to temp-folder, FI-stuff removed, cleaned up aspect (file-)names and code (-> coding-style).

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1320 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
adrian
2012-06-07 18:57:26 +00:00
parent b7d904140e
commit d474a5b952
119 changed files with 110 additions and 55385 deletions

View File

@ -1,36 +0,0 @@
#include <iostream>
#include "DataRetrievalExperiment.hpp"
#include "../SAL/SALInst.hpp"
#include "../controller/Event.hpp"
#include "ExperimentDataExample/FaultCoverageExperiment.pb.h"
using namespace std;
using namespace fail;
#define MEMTEST86_BREAKPOINT 0x4EDC
bool DataRetrievalExperiment::run()
{
cout << "[getExperimentDataExperiment] Experiment start." << endl;
// Breakpoint address for Memtest86:
BPSingleEvent mainbp(MEMTEST86_BREAKPOINT);
simulator.addEventAndWait(&mainbp);
cout << "[getExperimentDataExperiment] Breakpoint reached." << endl;
FaultCoverageExperimentData* test = NULL;
cout << "[getExperimentDataExperiment] Getting ExperimentData (FaultCoverageExperiment)..." << endl;
test = simulator.getExperimentData<FaultCoverageExperimentData>();
cout << "[getExperimentDataExperiment] Content of ExperimentData (FaultCoverageExperiment):" << endl;
if (test->has_data_name())
cout << "Name: "<< test->data_name() << endl;
// m_instrptr1 augeben
cout << "m_instrptr1: " << hex << test->m_instrptr1() << endl;
// m_instrptr2 augeben
cout << "m_instrptr2: " << hex << test->m_instrptr2() << endl;
simulator.clearEvents(this);
return true; // experiment successful
}

View File

@ -1,14 +0,0 @@
#ifndef __DATA_RETRIEVAL_EXPERIMENT_HPP__
#define __DATA_RETRIEVAL_EXPERIMENT_HPP__
#include "../controller/ExperimentFlow.hpp"
class DataRetrievalExperiment : public fail::ExperimentFlow
{
public:
DataRetrievalExperiment() { }
bool run();
};
#endif // __DATA_RETRIEVAL_EXPERIMENT_HPP__

View File

@ -1,19 +0,0 @@
## Setup desired protobuf descriptions HERE ##
set(MY_PROTOS
FaultCoverageExperiment.proto
)
set(SRCS
example.cc
)
#### PROTOBUFS ####
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})
include_directories(${CMAKE_CURRNET_BINARY_DIR})
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${MY_PROTOS} )
## Build library
add_library(fcexperimentmessage ${PROTO_SRCS} ${SRCS} )

View File

@ -1,7 +0,0 @@
message FaultCoverageExperimentData{
optional string data_name = 1;
required int64 m_InstrPtr1 = 2;
required int64 m_InstrPtr2 = 3;
}

View File

@ -1,3 +0,0 @@
#!/bin/bash
cd $(dirname $0)
g++ ../../controller/JobServer.cc ../../controller/ExperimentDataQueue.cc example.cc FaultCoverageExperiment.pb.cc -o ./ExperimentData_example -l protobuf -pthread

View File

@ -1,63 +0,0 @@
#include <iostream>
#include <fstream>
#include "controller/ExperimentData.hpp"
#include "controller/ExperimentDataQueue.hpp"
#include "jobserver/JobServer.hpp"
#include "FaultCoverageExperiment.pb.h"
using namespace std;
int main(int argc, char* argv[])
{
// FIXME: Translation missing.
ExperimentDataQueue exDaQu;
ExperimentData* readFromQueue;
// Daten in Struktur schreiben und in Datei speichern
ofstream fileWrite;
fileWrite.open("test.txt");
FaultCoverageExperimentData faultCovExWrite;
// Namen setzen
faultCovExWrite.set_data_name("Testfall 42");
// Instruktionpointer 1
faultCovExWrite.set_m_instrptr1(0x4711);
// Instruktionpointer 2
faultCovExWrite.set_m_instrptr2(0x1122);
// In ExperimentData verpacken
ExperimentData exDaWrite(&faultCovExWrite);
// In Queue einbinden
exDaQu.addData(&exDaWrite);
// Aus Queue holen
if (exDaQu.size() != 0)
readFromQueue = exDaQu.getData();
// Serialisierung ueber Wrapper-Methode in ExperimentData
readFromQueue->serialize(&fileWrite);
// cout << "Ausgabe: " << out << endl;
fileWrite.close();
//---------------------------------------------------------------
// Daten aus Datei lesen und in Struktur schreiben
ifstream fileRead;
fileRead.open("test.txt");
FaultCoverageExperimentData faultCovExRead;
ExperimentData exDaRead(&faultCovExRead);
exDaRead.unserialize( &fileRead);
// Wenn Name, dann ausgeben
if(faultCovExRead.has_data_name()){
cout << "Name: "<< faultCovExRead.data_name() << endl;
}
// m_instrptr1 augeben
cout << "m_instrptr1: " << faultCovExRead.m_instrptr1() << endl;
// m_instrptr2 augeben
cout << "m_instrptr2: " << faultCovExRead.m_instrptr2() << endl;
fileRead.close();
return 0;
}

View File

@ -1,76 +0,0 @@
#ifndef __JUMP_AND_RUN_EXPERIMENT_HPP__
#define __JUMP_AND_RUN_EXPERIMENT_HPP__
#include <iostream>
#include "../controller/ExperimentFlow.hpp"
#include "../SAL/SALInst.hpp"
#include "../SAL/bochs/BochsRegister.hpp"
#include "config/FailConfig.hpp"
// Check if aspect dependencies are satisfied:
#if !defined(CONFIG_EVENT_CPULOOP) || !defined(CONFIG_EVENT_JUMP)
#error Breakpoint- and jump-events needed! Enable aspects first (see FailConfig.hpp)!
#endif
using namespace std;
using namespace fail;
class JumpAndRunExperiment : public fail::ExperimentFlow {
public:
bool run()
{
/************************************
* Description of experiment flow. *
************************************/
// Wait for function entry adresss:
cout << "[JumpAndRunExperiment] Setting up experiment. Allowing to "
<< "start now." << endl;
BPEvent mainFuncEntry(0x3c1f);
simulator.addEvent(&mainFuncEntry);
if (&mainFuncEntry != simulator.waitAny()) {
cerr << "[JumpAndRunExperiment] Now, we are completely lost! "
<< "It's time to cry! :-(" << endl;
simulator.clearEvents(this);
return false;
}
else
cout << "[JumpAndRunExperiment] Entry of main function reached! "
<< " Let's see who's jumping around here..." << endl;
const unsigned COUNTER = 20000;
unsigned i = 0;
BxFlagsReg* pFlags = dynamic_cast<BxFlagsReg*>(simulator.
getRegisterManager().getSetOfType(RT_ST).snatch());
assert(pFlags != NULL && "FATAL ERROR: NULL ptr not expected!");
JumpEvent ev;
// Catch the next "counter" jumps:
while (++i <= COUNTER) {
ev.setWatchInstructionPointer(ANY_INSTR);
simulator.addEvent(&ev);
if (simulator.waitAny() != &ev) {
cerr << "[JumpAndRunExperiment] Damn! Something went "
<< "terribly wrong! Who added that event?! :-(" << endl;
simulator.clearEvents(this);
return false;
}
else
cout << "[JumpAndRunExperiment] Jump detected. Instruction: "
<< "0x" hex << ev.getTriggerInstructionPointer()
<< " -- FLAGS [CF, ZF, OF, PF, SF] = ["
<< pFlags->getCarryFlag() << ", "
<< pFlags->getZeroFlag() << ", "
<< pFlags->getOverflowFlag() << ", "
<< pFlags->getParityFlag() << ", "
<< pFlags->getSignFlag() << "]." << endl;
}
cout << "[JumpAndRunExperiment] " << dec << counter
<< " jump(s) detected -- enough for today...exiting! :-)"
<< endl;
simulator.clearEvents(this);
return true;
}
};
#endif // __JUMP_AND_RUN_EXPERIMENT_HPP__

View File

@ -1,71 +0,0 @@
#ifndef __MEM_WRITE_EXPERIMENT_HPP__
#define __MEM_WRITE_EXPERIMENT_HPP__
#include <iostream>
#include "../controller/ExperimentFlow.hpp"
#include "../SAL/SALInst.hpp"
#include "config/FailConfig.hpp"
// Check aspect dependencies:
#if !defined(CONFIG_EVENT_CPULOOP) || !defined(CONFIG_EVENT_MEMACCESS) || !defined(CONFIG_SR_SAVE) || !defined(CONFIG_FI_MEM_ACCESS_BITFLIP)
#error Event dependecies not satisfied! Enabled needed aspects in FailConfig.hpp!
#endif
using namespace std;
using namespace fail;
class MemWriteExperiment : public fail::ExperimentFlow {
public:
bool run() // Example experiment (defines "what we wanna do")
{
/************************************
* Description of experiment flow. *
************************************/
// 1. Add some events (set up the experiment):
cout << "[MemWriteExperiment] Setting up experiment. Allowing to"
<< " start now." << endl;
MemWriteEvent mem1(0x000904F0), mem2(0x02ff0916), mem3(0x0050C8E8);
BPEvent breakpt(0x4ae6);
simulator.addEvent(&mem1);
simulator.addEvent(&mem2);
simulator.addEvent(&mem3);
simulator.addEvent(&breakpt);
// 2. Wait for event condition "(id1 && id2) || id3" to become true:
cout << "[MemWriteExperiment] Waiting for condition (1) (\"(id1 &&"
<< " id2) || id3\") to become true..." << endl;
bool f1 = false, f2 = false, f3 = false, f4 = false;
while (!(f1 || f2 || f3 || f4)) {
BPEvent* pev = simulator.waitAny();
cout << "[MemWriteExperiment] Received event id=" << id
<< "." << endl;
if(pev == &mem4)
f4 = true;
if(pev == &mem3)
f3 = true;
if(pev == &mem2)
f2 = true;
if(pev == &mem1)
f1 = true;
}
cout << "[MemWriteExperiment] Condition (1) satisfied! Ready to "
<< "add next event..." << endl;
// 3. Add a new event now:
cout << "[MemWriteExperiment] Adding new Event..."; cout.flush();
simulator.clearEvents(); // remove residual events in the buffer
// (we're just interested in the new event)
simulator.save("./bochs_save_point");
cout << "done!" << endl;
// 4. Continue simulation (waitAny) and inject bitflip:
// ...
simulator.clearEvents(this);
return true;
}
};
#endif // __MEM_WRITE_EXPERIMENT_HPP__

View File

@ -1,60 +0,0 @@
#ifndef __MY_EXPERIMENT_HPP__
#define __MY_EXPERIMENT_HPP__
#include <iostream>
#include "../controller/ExperimentFlow.hpp"
#include "../SAL/SALInst.hpp"
using namespace std;
using namespace fail;
class MyExperiment : public fail::ExperimentFlow {
public:
bool run() // Example experiment (defines "what we wanna do")
{
/************************************
* Description of experiment flow. *
************************************/
// 1. Add some events (set up the experiment):
cout << "[MyExperiment] Setting up experiment. Allowing to start"
<< " now." << endl;
BPEvent ev1(0x8048A00), ev2(0x8048F01), ev3(0x3c1f);
simulator.addEvent(&ev1);
simulator.addEvent(&ev2);
simulator.addEvent(&ev3);
// 2. Wait for event condition "(id1 && id2) || id3" to become true:
BPEvent* pev;
cout << "[MyExperiment] Waiting for condition (1) (\"(id1 && id2)"
<< " || id3\") to become true..." << endl;
bool f1 = false, f2 = false, f3 = false;
while (!((f1 && f2) || f3)) {
pev = simulator.waitAny();
cout << "[MyExperiment] Received event id=" << pev->getId()
<< "." << endl;
if(pev == &ev3)
f3 = true;
if(pev == &ev2)
f2 = true;
if(pev == &ev1)
f1 = true;
}
cout << "[MyExperiment] Condition (1) satisfied! Ready..." << endl;
// Remove residual (for all active experiments!)
// events in the buffer:
simulator.clearEvents();
BPEvent foobar(ANY_ADDR);
foobar.setCounter(400);
cout << "[MyExperiment] Adding breakpoint-event, firing after the"
<< " next 400 instructions..."; cout.flush();
simulator.addEventAndWait(&foobar);
cout << "cought! Exiting now." << endl;
simulator.clearEvents(this);
return true;
}
};
#endif // __MY_EXPERIMENT_HPP__

View File

@ -1,60 +0,0 @@
#ifndef __SINGLE_STEPPING_EXPERIMENT_HPP__
#define __SINGLE_STEPPING_EXPERIMENT_HPP__
#include <iostream>
#include "../controller/ExperimentFlow.hpp"
#include "../SAL/SALInst.hpp"
#include "config/FailConfig.hpp"
#include "../SAL/bochs/BochsRegister.hpp"
// Check if aspect dependency is satisfied:
#ifndef CONFIG_EVENT_CPULOOP
#error Breakpoint-events needed! Enable aspect first (see FailConfig.hpp)!
#endif
using namespace std;
using namespace fail;
#define FUNCTION_ENTRY_ADDRESS 0x3c1f
class SingleSteppingExperiment : public fail::ExperimentFlow {
public:
bool run()
{
/************************************
* Description of experiment flow. *
************************************/
// Wait for function entry adresss:
cout << "[SingleSteppingExperiment] Setting up experiment. Allowing"
<< " to start now." << endl;
BPEvent mainFuncEntry(FUNCTION_ENTRY_ADDRESS);
simulator.addEvent(&mainFuncEntry);
if (&mainFuncEntry != simulator.waitAny()) {
cerr << "[SingleSteppingExperiment] Now, we are completely lost!"
<< " It's time to cry! :-(" << endl;
simulator.clearEvents(this);
return false;
}
cout << "[SingleSteppingExperiment] Entry of main function reached!"
<< " Beginning single-stepping..." << endl;
char action;
while (true) {
BPEvent bp(ANY_ADDR);
simulator.addEvent(&bp);
simulator.waitAny();
cout << "0x" << hex
<< simulator.getRegisterManager().getInstructionPointer()
<< endl;
cout << "Continue (y/n)? ";
cin >> action; cin.sync(); cin.clear();
if (action != 'y')
break;
}
simulator.clearEvents(this);
return true;
}
};
#endif // __SINGLE_STEPPING_EXPERIMENT_HPP__

View File

@ -1,16 +0,0 @@
#ifndef __INSTANTIATE_EXPERIMENT_AH__
#define __INSTANTIATE_EXPERIMENT_AH__
// copy this file to a .ah file and instantiate the experiment(s) you need
#include "hscsimple.hpp"
#include "../SAL/SALInst.hpp"
aspect hscsimple {
hscsimpleExperiment experiment;
advice execution ("void fail::SimulatorController::initExperiments()") : after () {
fail::simulator.addFlow(&experiment);
}
};
#endif // __INSTANTIATE_EXPERIMENT_AH__