Add config parameter to specify the hostname or ip addr. of the campain server.
Add some documentiation to experiment.hpp
This commit is contained in:
@ -9,7 +9,7 @@ using namespace std;
|
|||||||
using namespace fail;
|
using namespace fail;
|
||||||
|
|
||||||
L4SysExperiment::L4SysExperiment()
|
L4SysExperiment::L4SysExperiment()
|
||||||
: m_jc("localhost"), log("L4Sys", false)
|
: log("L4Sys", false)
|
||||||
{
|
{
|
||||||
param = new L4SysExperimentData;
|
param = new L4SysExperimentData;
|
||||||
}
|
}
|
||||||
@ -71,6 +71,7 @@ bool L4SysExperiment::run()
|
|||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
BPSingleListener *bp = 0;
|
BPSingleListener *bp = 0;
|
||||||
|
m_jc = fail::JobClient(conf.campain_server.c_str());
|
||||||
doExperiments(bp);
|
doExperiments(bp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ totinstr=58401
|
|||||||
#default config
|
#default config
|
||||||
emul_ips=5000000
|
emul_ips=5000000
|
||||||
max_instr_bytes=15
|
max_instr_bytes=15
|
||||||
|
campain_server=localhost
|
||||||
|
|
||||||
#default files
|
#default files
|
||||||
state_folder=l4sys.state
|
state_folder=l4sys.state
|
||||||
|
|||||||
@ -82,22 +82,22 @@ private:
|
|||||||
*/
|
*/
|
||||||
void terminateWithError(std::string details, int reason, L4SysProtoMsg_Result*);
|
void terminateWithError(std::string details, int reason, L4SysProtoMsg_Result*);
|
||||||
/**
|
/**
|
||||||
* Run until L4SYS_FUNC_ENTRY and save state (experiment preparation,
|
* Run until reaching the entry point of the experiment and save
|
||||||
* phase 1)
|
* state.
|
||||||
*/
|
*/
|
||||||
void runToStart(fail::BPSingleListener *bp);
|
void runToStart(fail::BPSingleListener *bp);
|
||||||
/**
|
/**
|
||||||
* Collect list of executed instructions, considering instruction
|
* Collect list of executed instructions, considering instruction
|
||||||
* filtering if configured (experiment preparation, phase 2).
|
* filtering if configured.
|
||||||
*/
|
*/
|
||||||
void collectInstructionTrace(fail::BPSingleListener* bp);
|
void collectInstructionTrace(fail::BPSingleListener* bp);
|
||||||
/**
|
/**
|
||||||
* Perform the golden run (experiment preparation, phase 3)
|
* Perform the golden run.
|
||||||
*/
|
*/
|
||||||
void goldenRun(fail::BPSingleListener* bp);
|
void goldenRun(fail::BPSingleListener* bp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doing fault injection expiriments (experiment preparation, phase 0)
|
* Doing fault injection expiriments.
|
||||||
*/
|
*/
|
||||||
void doExperiments(fail::BPSingleListener *bp);
|
void doExperiments(fail::BPSingleListener *bp);
|
||||||
|
|
||||||
@ -141,12 +141,24 @@ private:
|
|||||||
*/
|
*/
|
||||||
void doRegisterInjection(int regDesc, int bit);
|
void doRegisterInjection(int regDesc, int bit);
|
||||||
|
|
||||||
int updateConfig(std::string parameter, std::string value);
|
|
||||||
|
|
||||||
void setupFilteredBreakpoint(fail::BPSingleListener* bp, int instOffset, std::string instr_list);
|
void setupFilteredBreakpoint(fail::BPSingleListener* bp, int instOffset, std::string instr_list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a parameter of the config file or adds a new one
|
||||||
|
* if the parameter was not specified.
|
||||||
|
*/
|
||||||
|
int updateConfig(std::string parameter, std::string value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the value of the config file to the parameter list and
|
||||||
|
* parse the parameter list. This function makes use of the
|
||||||
|
* CommandLine Parser from the fail* framework.
|
||||||
|
*/
|
||||||
void parseOptions(L4SysConfig&);
|
void parseOptions(L4SysConfig&);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration Setup.
|
||||||
|
*/
|
||||||
class L4SysConfig {
|
class L4SysConfig {
|
||||||
public:
|
public:
|
||||||
unsigned long int max_instr_bytes;
|
unsigned long int max_instr_bytes;
|
||||||
@ -167,6 +179,7 @@ private:
|
|||||||
std::string golden_run;
|
std::string golden_run;
|
||||||
std::string filter;
|
std::string filter;
|
||||||
std::string trace;
|
std::string trace;
|
||||||
|
std::string campain_server;
|
||||||
|
|
||||||
unsigned long int numinstr;
|
unsigned long int numinstr;
|
||||||
unsigned long int totinstr;
|
unsigned long int totinstr;
|
||||||
|
|||||||
@ -133,6 +133,8 @@ void L4SysExperiment::parseOptions(L4SysConfig &conf) {
|
|||||||
cmd.addOption("", "filter", Arg::Optional, "--filter \t define L4SYS_FILTER");
|
cmd.addOption("", "filter", Arg::Optional, "--filter \t define L4SYS_FILTER");
|
||||||
CommandLine::option_handle OPT_TRACE =
|
CommandLine::option_handle OPT_TRACE =
|
||||||
cmd.addOption("", "trace", Arg::Optional, "--trace \t define outputfile for trace (default trace.pb)");
|
cmd.addOption("", "trace", Arg::Optional, "--trace \t define outputfile for trace (default trace.pb)");
|
||||||
|
CommandLine::option_handle OPT_CAMPAIN_SERVER =
|
||||||
|
cmd.addOption("", "campain_server", Arg::Optional, "--campain_server \t specify the hostname of the campain server (default localhost)");
|
||||||
|
|
||||||
|
|
||||||
if (!cmd.parse()) {
|
if (!cmd.parse()) {
|
||||||
@ -153,8 +155,12 @@ void L4SysExperiment::parseOptions(L4SysConfig &conf) {
|
|||||||
if (cmd[OPT_ADDRESS_SPACE]) {
|
if (cmd[OPT_ADDRESS_SPACE]) {
|
||||||
conf.address_space = strtol(cmd[OPT_ADDRESS_SPACE].arg, NULL, 16);
|
conf.address_space = strtol(cmd[OPT_ADDRESS_SPACE].arg, NULL, 16);
|
||||||
log << "address_space: "<< hex << conf.address_space << endl;
|
log << "address_space: "<< hex << conf.address_space << endl;
|
||||||
|
|
||||||
|
//Confi address_space=0 means no address space filtering
|
||||||
|
if (conf.address_space == 0)
|
||||||
|
conf.address_space = fail::ANY_ADDR;
|
||||||
} else {
|
} else {
|
||||||
parameterMissing(log, "adress_space");
|
conf.address_space = fail::ANY_ADDR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd[OPT_ADDRESS_SPACE_TRACE]) {
|
if (cmd[OPT_ADDRESS_SPACE_TRACE]) {
|
||||||
@ -163,11 +169,14 @@ void L4SysExperiment::parseOptions(L4SysConfig &conf) {
|
|||||||
conf.address_space_trace = conf.address_space;
|
conf.address_space_trace = conf.address_space;
|
||||||
else
|
else
|
||||||
log << "address_space_trace: "<< hex << conf.address_space_trace << endl;
|
log << "address_space_trace: "<< hex << conf.address_space_trace << endl;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
conf.address_space_trace = conf.address_space;
|
conf.address_space_trace = conf.address_space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (conf.address_space_trace == 0)
|
||||||
|
conf.address_space_trace = fail::ANY_ADDR;
|
||||||
|
|
||||||
if (cmd[OPT_FUNC_ENTRY]) {
|
if (cmd[OPT_FUNC_ENTRY]) {
|
||||||
conf.func_entry = strtol(cmd[OPT_FUNC_ENTRY].arg, NULL, 16);
|
conf.func_entry = strtol(cmd[OPT_FUNC_ENTRY].arg, NULL, 16);
|
||||||
log << "func_entry: "<< hex << conf.func_entry << endl;
|
log << "func_entry: "<< hex << conf.func_entry << endl;
|
||||||
@ -273,6 +282,13 @@ void L4SysExperiment::parseOptions(L4SysConfig &conf) {
|
|||||||
conf.trace = "trace.pb";
|
conf.trace = "trace.pb";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd[OPT_CAMPAIN_SERVER]) {
|
||||||
|
conf.campain_server = std::string(cmd[OPT_CAMPAIN_SERVER].arg);
|
||||||
|
log << "campain_server: "<< conf.campain_server << endl;
|
||||||
|
} else {
|
||||||
|
conf.campain_server = "localhost";
|
||||||
|
}
|
||||||
|
|
||||||
if (cmd[STEP]) {
|
if (cmd[STEP]) {
|
||||||
if (!std::string("cr3").compare(cmd[STEP].arg) ) {
|
if (!std::string("cr3").compare(cmd[STEP].arg) ) {
|
||||||
log << "calculate cr3" << endl;
|
log << "calculate cr3" << endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user