Change-Id: I8022d937477668253c613e97c3a579ae65084b1e
This commit is contained in:
Horst Schirmeier
2014-02-09 18:54:21 +01:00
parent 5df364dea2
commit 277958b31b
45 changed files with 430 additions and 444 deletions

1
.gitignore vendored
View File

@ -53,4 +53,3 @@ debuggers/openocd/src/startup.tcl
debuggers/openocd/src/startup_tcl.c
debuggers/openocd/src/target/xscale_debug.h
debuggers/openocd/stamp-h1

View File

@ -45,10 +45,9 @@ if(BUILD_PANDA)
# ensure, elf path is set for enabling openocd to read elf symbols
if(EXISTS $ENV{FAIL_ELF_PATH})
SET(PANDA_ELF_PATH $ENV{FAIL_ELF_PATH})
message(STATUS "[Fail*] PandaBoard ELF under test: ${PANDA_ELF_PATH}")
message(STATUS "[Fail*] PandaBoard ELF under test: $ENV{FAIL_ELF_PATH}")
else()
message(FATAL_ERROR "Please set the FAIL_ELF_PATH enviroment variable to the binary under test.")
message(FATAL_ERROR "Please set the FAIL_ELF_PATH environment variable to the binary under test.")
endif()

View File

@ -678,7 +678,7 @@ int main(int argc, char *argv[])
exit(-1);
}
#else
if(!getHaltingWatchpoint(&halt)) {
if (!getHaltingWatchpoint(&halt)) {
LOG << "FATAL ERROR: Can't determine memory-access address of halt cause" << endl;
exit(-1);
}
@ -1768,7 +1768,7 @@ static void merge_mem_ranges (std::vector<struct mem_range> &in_out)
std::vector<struct mem_range>::iterator it, next_it;
it = in_out.begin();
next_it = it; next_it++;
while(it != in_out.end() && next_it != in_out.end()) {
while (it != in_out.end() && next_it != in_out.end()) {
if ((it->address + it->width) >= next_it->address) {
uint32_t additive_width = (next_it->address - it->address) + next_it->width;
if (additive_width > it->width) {

View File

@ -12,7 +12,7 @@ set(PROTOS
)
## Set concrete implementation of InjectionPointMessage
# ToDo: Define seperate symbol, so it can also be used in other build types
# TODO: Define separate symbol, so it can also be used in other build types
if(CONFIG_INJECTIONPOINT_HOPS)
set(PROTOS ${PROTOS} InjectionPointHopsMessage.proto)
set(CONCRETE_INJECTION_POINT InjectionPointHopsMessage.proto)

View File

@ -6,12 +6,12 @@ message InjectionPointMessage {
// If checkpoint must be used for this hop chain, id is set properly
optional uint32 checkpoint_id = 1;
// If we need to knwo the target dynamic instruction offset,
// If we need to know the target dynamic instruction offset,
// here it is
optional uint32 target_trace_position = 4;
// Repeated groups can't be defined as notempty, so a manual
// Repeated groups can't be defined as non-empty, so a manual
// non-empty check is required at usage
// As we assume hops to always watch addresses of length 1, we

View File

@ -35,7 +35,7 @@ bool DatabaseCampaign::run() {
CommandLine::option_handle PRUNER = cmd.addOption("p", "prune-method", Arg::Required,
"-p/--prune-method \tWhich import method to use (default: basic)");
if(!cmd.parse()) {
if (!cmd.parse()) {
log_send << "Error parsing arguments." << std::endl;
exit(-1);
}
@ -82,7 +82,7 @@ bool DatabaseCampaign::run() {
std::vector<Database::Variant> variants = db->get_variants(variant, benchmark);
for (std::vector<Database::Variant>::const_iterator it = variants.begin();
it != variants.end(); ++it) {
if(!run_variant(*it)) {
if (!run_variant(*it)) {
log_send << "run_variant failed for " << it->variant << "/" << it->benchmark <<std::endl;
return false;
}
@ -136,9 +136,10 @@ bool DatabaseCampaign::run_variant(Database::Variant variant) {
log_send << "Found " << experiment_count << " unfinished experiments in database. ("
<< variant.variant << "/" << variant.benchmark << ")" << std::endl;
// abstraction of injection point
// must not be initialized in loop, because hop chain calculator would loose state after loop pass
// and so for every hop chain it would have to begin calculating at trace instruction zero
// abstraction of injection point:
// must not be initialized in loop, because hop chain calculator would lose
// state after loop pass and so for every hop chain it would have to begin
// calculating at trace instruction zero
ConcreteInjectionPoint ip;
sent_pilots = 0;

View File

@ -6,10 +6,10 @@
namespace fail {
InjectionPointHops::~InjectionPointHops() {
if (m_initialized)
if (m_initialized) {
delete m_sa;
}
}
void InjectionPointHops::init()
@ -17,11 +17,11 @@ void InjectionPointHops::init()
m_sa = new SmartHops();
char * elfpath = getenv("FAIL_TRACE_PATH");
if(elfpath == NULL){
if (elfpath == NULL) {
m_log << "FAIL_TRACE_PATH not set :(" << std::endl;
exit(-1);
}else{
m_sa->init((const char*)elfpath);
} else {
m_sa->init((const char*) elfpath);
}
m_initialized = true;
@ -93,7 +93,7 @@ void InjectionPointHops::parseFromInjectionInstr(unsigned instr1, unsigned instr
if (search == search_end) {
m_ip = *search;
} else {
for(;search != search_end; search++) {
for (;search != search_end; search++) {
if (!search->has_costs()) {
m_log << "FATAL ERROR: Costs must be delivered in order to calculate minimum costs" << std::endl;
exit(-1);

View File

@ -1,6 +1,6 @@
// Architecture.hpp: wraps architecture definition headers
#ifndef __ARCHITECTURE_HPP__
#define __ARCHITECTURE_HPP__
#define __ARCHITECTURE_HPP__
#include "config/FailConfig.hpp"

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_ARM_CPU_HPP__
#define __PANDA_ARM_CPU_HPP__
#define __PANDA_ARM_CPU_HPP__
#include "../arm/ArmArchitecture.hpp"
#include "../arm/ArmCPUState.hpp"

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_BREAKPOINTS_AH__
#define __PANDA_BREAKPOINTS_AH__
#define __PANDA_BREAKPOINTS_AH__
#include "config/FailConfig.hpp"
#include "config/VariantConfig.hpp"
@ -11,9 +11,10 @@
aspect PandaBreakpoints
{
advice "fail::BPSingleListener" : slice class
{
public:
advice "fail::BPSingleListener" : slice class
{
public:
bool onAddition()
{
// Setup Breakpoint on Pandaboard
@ -24,7 +25,7 @@ aspect PandaBreakpoints
hc.type = HALT_TYPE_BP;
}
hc.address = m_WatchInstrPtr;
hc.addr_len= 4; // Thumb? => 2
hc.addr_len = 4; // Thumb? => 2
oocdw_set_halt_condition(&hc);
return true;
}
@ -39,10 +40,11 @@ aspect PandaBreakpoints
hc.type = HALT_TYPE_BP;
}
hc.address = m_WatchInstrPtr;
hc.addr_len= 4; // Thumb? => 2
hc.addr_len = 4; // Thumb? => 2
oocdw_delete_halt_condition(&hc);
}
};
};
};
#endif // BUILD_PANDA && CONFIG_EVENT_BREAKPOINTS

View File

@ -5,13 +5,14 @@
*/
#ifndef __PANDA_CONFIG_HPP__
#define __PANDA_CONFIG_HPP__
#define __PANDA_CONFIG_HPP__
namespace fail {
typedef uint32_t host_address_t; //!< the host memory address type
typedef uint32_t guest_address_t; //!< the guest memory address type
typedef uint32_t register_data_t; //!< register data type (32 bit)
typedef int timer_t; //!< type of timer IDs
typedef uint32_t host_address_t; //!< the host memory address type
typedef uint32_t guest_address_t; //!< the guest memory address type
typedef uint32_t register_data_t; //!< register data type (32 bit)
typedef int timer_t; //!< type of timer IDs
} // end-of-namespace: fail

View File

@ -9,7 +9,7 @@
#include "openocd_wrapper.hpp"
#if defined(CONFIG_FIRE_INTERRUPTS)
#error Firing intterupts not implemented for Pandaboard
#error Firing interrupts not implemented for Pandaboard
#endif
#if defined(CONFIG_SR_REBOOT) || defined(CONFIG_SR_RESTORE) || defined(CONFIG_SR_SAVE)
@ -56,16 +56,7 @@ void PandaController::onTimerTrigger(void* thisPtr)
bool PandaController::save(const std::string& path)
{
// ToDo (PORT): Save
/*int stat;
stat = mkdir(path.c_str(), 0777);
if (!(stat == 0 || errno == EEXIST)) {
return false;
// std::cout << "[FAIL] Can not create target-directory to save!" << std::endl;
// TODO: (Non-)Verbose-Mode? Log-level? Maybe better: use return value to indicate failure?
}*/
// TODO
return true;
}
@ -73,11 +64,7 @@ bool PandaController::save(const std::string& path)
void PandaController::restore(const std::string& path)
{
clearListeners();
/*restore_bochs_request = true;
BX_CPU(0)->async_event |= 1;
sr_path = path;*/
// ToDo (PORT): Restore
// TODO
}
void PandaController::reboot()

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_CONTROLLER_HPP__
#define __PANDA_CONTROLLER_HPP__
#define __PANDA_CONTROLLER_HPP__
#include <string>
#include <cassert>

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_LISTENER_HPP__
#define __PANDA_LISTENER_HPP__
#define __PANDA_LISTENER_HPP__
namespace fail {

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_MEMORY_HPP__
#define __PANDA_MEMORY_HPP__
#define __PANDA_MEMORY_HPP__
#include "../Memory.hpp"

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_TIMER_AH__
#define __PANDA_TIMER_AH__
#define __PANDA_TIMER_AH__
#include "config/VariantConfig.hpp"
#include "config/FailConfig.hpp"
@ -10,8 +10,9 @@
#include "PandaListener.hpp"
aspect PandaTimer {
advice "fail::TimerListener" : slice class {
public:
advice "fail::TimerListener" : slice class {
public:
bool onAddition()
{
// Register the timer listener in the Bochs simulator:
@ -28,7 +29,7 @@ aspect PandaTimer {
// Unregister the time listener:
m_unregisterTimer(this);
}
private:
private:
timer_id_t m_registerTimer(TimerListener* pev)
{
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
@ -43,7 +44,8 @@ aspect PandaTimer {
oocdw_deactivate_timer(static_cast<unsigned>(pev->getId()));
return oocdw_unregisterTimer(static_cast<unsigned>(pev->getId()));
}
};
};
};
#endif // BUILD_PANDA && CONFIG_EVENT_BREAKPOINTS

View File

@ -1,5 +1,5 @@
#ifndef __PANDA_WATCHPOINTS_AH__
#define __PANDA_WATCHPOINTS_AH__
#define __PANDA_WATCHPOINTS_AH__
#include "config/FailConfig.hpp"
#include "config/VariantConfig.hpp"
@ -11,19 +11,23 @@
aspect PandaWatchpoints
{
advice "fail::MemAccessListener" : slice class
{
advice "fail::MemAccessListener" : slice class
{
int m_t32access;
public:
public:
bool onAddition()
{
// Setup Watchpoint on Pandaboard (if it cant be realized as WP, mmu will be utilzed)
// Setup Watchpoint on Pandaboard (if it can't be realized as WP, MMU will be utilized)
struct halt_condition hc;
switch(m_WatchType) {
case MemAccessEvent::MEM_READ: hc.type = HALT_TYPE_WP_READ; break;
case MemAccessEvent::MEM_WRITE: hc.type = HALT_TYPE_WP_WRITE; break;
case MemAccessEvent::MEM_READWRITE: hc.type = HALT_TYPE_WP_READWRITE; break;
switch (m_WatchType) {
case MemAccessEvent::MEM_READ:
hc.type = HALT_TYPE_WP_READ; break;
case MemAccessEvent::MEM_WRITE:
hc.type = HALT_TYPE_WP_WRITE; break;
case MemAccessEvent::MEM_READWRITE:
hc.type = HALT_TYPE_WP_READWRITE; break;
default: return false;
}
@ -37,13 +41,16 @@ aspect PandaWatchpoints
void onDeletion()
{
// Remove Watchpoint from Pandaboard (if it was realized by mmu, it will be reprogrammed)
// Remove Watchpoint from Pandaboard (if it was realized by MMU, it will be reprogrammed)
struct halt_condition hc;
switch(m_WatchType) {
case MemAccessEvent::MEM_READ: hc.type = HALT_TYPE_WP_READ; break;
case MemAccessEvent::MEM_WRITE: hc.type = HALT_TYPE_WP_WRITE; break;
case MemAccessEvent::MEM_READWRITE: hc.type = HALT_TYPE_WP_READWRITE; break;
switch (m_WatchType) {
case MemAccessEvent::MEM_READ:
hc.type = HALT_TYPE_WP_READ; break;
case MemAccessEvent::MEM_WRITE:
hc.type = HALT_TYPE_WP_WRITE; break;
case MemAccessEvent::MEM_READWRITE:
hc.type = HALT_TYPE_WP_READWRITE; break;
default: return; // ToDo: Error handling
}
@ -53,7 +60,7 @@ aspect PandaWatchpoints
// ToDo: Error handling
oocdw_delete_halt_condition(&hc);
}
};
};
};

View File

@ -78,4 +78,3 @@ option(BUILD_LLVM_DISASSEMBLER "Build the LLVM-based disassembler (LLVM 3.3 pref
if (BUILD_LLVM_DISASSEMBLER)
add_subdirectory(llvmdisassembler)
endif (BUILD_LLVM_DISASSEMBLER)

View File

@ -31,7 +31,7 @@ void SmartHops::convertToIPM(std::vector<result_tuple > &result, unsigned costs,
}
ipm.set_costs(costs);
for(;it_hop != result.end();
for (; it_hop != result.end();
it_hop++) {
InjectionPointMessage_Hops *hop = ipm.add_hops();
hop->set_address(it_hop->first.first);
@ -116,7 +116,7 @@ bool SmartHops::calculateFollowingHop(InjectionPointMessage &ip, unsigned instru
continue;
}
// Deltion of unnecessary hops
// Deletion of unnecessary hops
/*
* |----------------|

View File

@ -31,7 +31,7 @@ public:
// m_use_checkpoints to true, but there will be additional changes needed for this to fully work.
// The sal must, for example, generate CPs at the given positions
SmartHops() : m_trace_pos(0), m_costs(0), m_next_cp_id(0), m_log("SmartHops", false), m_use_watchpoints(true),
m_use_weights(true), m_use_checkpoints(false), m_cp_thresh(0), m_cost_cp(0), m_rollback_thresh(0){}
m_use_weights(true), m_use_checkpoints(false), m_cp_thresh(0), m_cost_cp(0), m_rollback_thresh(0) {}
/**
* Initializes the used TraceReader with given trace file path

View File

@ -14,11 +14,11 @@
namespace fail {
typedef enum {
ACCESS_NONE ,
ACCESS_READ ,
ACCESS_WRITE ,
ACCESS_READORWRITE , // some architectures can't distinguish read and write WPs in general (e.g. x86)
ACCESS_CHECKPOINT ,
ACCESS_NONE,
ACCESS_READ,
ACCESS_WRITE,
ACCESS_READORWRITE, // some architectures can't distinguish read and write WPs in general (e.g. x86)
ACCESS_CHECKPOINT,
} mem_access_type_e;
typedef uint32_t address_t;
@ -26,8 +26,7 @@ typedef uint32_t trace_pos_t;
typedef std::pair<address_t, mem_access_type_e> trace_event_tuple_t;
class TraceReader {
public:
public:
TraceReader() : m_current_position(1),
ps(0),
normal_stream(0),
@ -43,7 +42,7 @@ class TraceReader {
std::vector<trace_event_tuple_t >& trace_events);
bool openTraceFile(const char *filename, unsigned int num_inst = 0);
private:
private:
unsigned int m_current_position;
ProtoIStream* ps;
std::ifstream *normal_stream;

View File

@ -11,9 +11,9 @@ using namespace std;
using namespace fail;
using namespace google::protobuf;
void LraSimpleCampaign::cb_send_pilot(DatabaseCampaignMessage pilot) {
void LraSimpleCampaign::cb_send_pilot(DatabaseCampaignMessage pilot)
{
LraSimpleExperimentData *data = new LraSimpleExperimentData;
data->msg.mutable_fsppilot()->CopyFrom(pilot);
campaignmanager.addParam(data);
}

View File

@ -54,7 +54,6 @@ int32_t correct_result[100] = {
0, 0, 0, 0
};
// ToDo: Move this functionality to SimulatorController
bool LRASimplePandaExperiment::navigateToInjectionPoint(ConcreteInjectionPoint &ip) {
Logger log_nav("navigator", false);
@ -70,7 +69,6 @@ bool LRASimplePandaExperiment::navigateToInjectionPoint(ConcreteInjectionPoint &
simulator.terminate(1);
}
log_nav << "Navigating to next instruction at navigational costs of " << ipm.costs() << endl;
log_nav << "Length of hop-chain: " << ipm.hops_size() << endl;
@ -110,7 +108,6 @@ bool LRASimplePandaExperiment::navigateToInjectionPoint(ConcreteInjectionPoint &
log_nav << "FATAL ERROR: Unexpected event while navigating!" << endl;
simulator.terminate(1);
}
}
#else
// Step nav
@ -195,7 +192,7 @@ bool LRASimplePandaExperiment::run()
while (true) {
logger << "asking jobserver for parameters. Undone: "<<jobClient->getNumberOfUndoneJobs() << endl;
LraSimpleExperimentData param;
if(!jobClient->getParam(param)){
if (!jobClient->getParam(param)) {
logger << "Dying." << endl; // We were told to die.
simulator.terminate(1);
}
@ -255,7 +252,6 @@ bool LRASimplePandaExperiment::run()
// Alternatively for single-bit-flips:
// data ^= 1 << experiment_id;
logger << "Injection bitflips at address " << hex << data_address << dec << endl;
timer.startTimer();

View File

@ -1,5 +1,5 @@
#ifndef __LRA_SIMPLE_PANDA_EXPERIMENT_HPP__
#define __LRA_SIMPLE_PANDA_EXPERIMENT_HPP__
#define __LRA_SIMPLE_PANDA_EXPERIMENT_HPP__
#include "efw/ExperimentFlow.hpp"
#include "cpn/InjectionPoint.hpp"

View File

@ -20,7 +20,6 @@ message LraSimpleProtoMsg {
required uint32 experiment_number = 1 [(sql_primary_key) = true];
required ResultType resulttype = 2;
// Times for evaluation
required float time_init = 3;
required float time_nav = 4;

View File

@ -8,8 +8,9 @@
int main(int argc, char **argv)
{
fail::CommandLine &cmd = fail::CommandLine::Inst();
for (int i = 1; i < argc; ++i)
for (int i = 1; i < argc; ++i) {
cmd.add_args(argv[i]);
}
LraSimpleCampaign c;
if (fail::campaignmanager.runCampaign(&c)) {

View File

@ -5,19 +5,18 @@
class ResultCollector;
class BasicAlgorithm {
public:
public:
/**
*
* @returns boolean value for calculation success
*/
virtual bool calculateAllHops(fail::TraceReader& trace) = 0;
BasicAlgorithm(ResultCollector *rc) {m_resultCollector = rc;}
BasicAlgorithm(ResultCollector *rc) { m_resultCollector = rc; }
virtual ~BasicAlgorithm() {}
protected:
protected:
ResultCollector *m_resultCollector;
};
#endif // __BASIC_ALGORITHM__HPP

View File

@ -82,7 +82,7 @@ ResultCollector::addResult(std::vector<result_tuple >& res, unsigned int costs)
it_hop++;
}
for(;it_hop != res.end();
for (; it_hop != res.end();
it_hop++) {
InjectionPointMessage_Hops *hop = hc.add_hops();
hop->set_address(it_hop->first.first);
@ -111,7 +111,7 @@ ResultCollector::addResult(std::vector<result_tuple >& res, unsigned int costs)
}
ps->writeMessage(&hc);
} else {
for(std::vector<result_tuple >::iterator it_hop = res.begin();
for (std::vector<result_tuple >::iterator it_hop = res.begin();
it_hop != res.end();
it_hop++) {
address_t add = it_hop->first.first;

View File

@ -45,7 +45,7 @@ public:
m_checkpoint_count(1),
m_it_mean_costs(0),
m_max_costs(0),
ps(0){}
ps(0) {}
void
addResult(std::vector<result_tuple >& res, unsigned int costs);
@ -87,5 +87,3 @@ private:
};
#endif /* STATISTICSCOLLECTOR_HPP_ */

View File

@ -1,7 +1,6 @@
#ifndef SIMPLE_ALGORITHM__HPP
#define SIMPLE_ALGORITHM__HPP
//#include <vector>
#include <map>
#include "BasicAlgorithm.hpp"
@ -21,10 +20,9 @@ public:
private:
// Count occurences
//map<trace_event_tuple_t, vector<trace_pos_t> > m_occurences;
std::map<trace_event_tuple_t, unsigned long > m_occurences;
std::map<trace_event_tuple_t, unsigned long> m_occurences;
std::map<trace_event_tuple_t, unsigned long > m_occ_cp;
std::map<trace_event_tuple_t, unsigned long> m_occ_cp;
};
#endif // SIMPLE_ALGORITHM__HPP

View File

@ -71,7 +71,7 @@ bool SmartAlgorithm::calculateAllHops(TraceReader& trace)
continue;
}
// Deltion of unnecessary hops
// Deletion of unnecessary hops
/*
* |----------------|

View File

@ -37,7 +37,6 @@ Logger LOG("hop-calculator", false);
int main(int argc, char *argv[])
{
// Manually fill the command line option parser
CommandLine &cmd = CommandLine::Inst();
@ -239,7 +238,7 @@ int main(int argc, char *argv[])
if (cmd[CHECKPOINT_OUTPUT_FILE].count() > 0) {
std::string filename(cmd[CHECKPOINT_OUTPUT_FILE].first()->arg);
g_cp_ofstream.open(filename.c_str());
if(!g_cp_ofstream.is_open()) {
if (!g_cp_ofstream.is_open()) {
LOG << "Unable to open cp_out_file " << filename << std::endl;
exit(-1);
}