cleanups
Change-Id: I8022d937477668253c613e97c3a579ae65084b1e
This commit is contained in:
@ -66,8 +66,8 @@ mark_as_advanced(FAIL_OBJDUMP)
|
||||
# compile smarthops calculator if needed
|
||||
|
||||
if(CONFIG_INJECTIONPOINT_HOPS)
|
||||
add_subdirectory(smarthops)
|
||||
set(ADDITIONAL_LIBS fail-smarthops)
|
||||
add_subdirectory(smarthops)
|
||||
set(ADDITIONAL_LIBS fail-smarthops)
|
||||
endif(CONFIG_INJECTIONPOINT_HOPS)
|
||||
|
||||
add_library(fail-util ${SRCS})
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
/*
|
||||
* |----------------|
|
||||
|
||||
@ -30,8 +30,8 @@ public:
|
||||
// ToDo: If you want to use checkoints as additional hop-chain-element, you may switch
|
||||
// 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){}
|
||||
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) {}
|
||||
|
||||
/**
|
||||
* Initializes the used TraceReader with given trace file path
|
||||
@ -44,24 +44,24 @@ public:
|
||||
* @param filename Path to the trace file
|
||||
* @returns \c true if calculation succeeded and \c false if it did not
|
||||
*/
|
||||
bool calculateFollowingHop(InjectionPointMessage &ip, unsigned instruction_offset);
|
||||
bool calculateFollowingHop(InjectionPointMessage &ip, unsigned instruction_offset);
|
||||
private:
|
||||
|
||||
/**
|
||||
* Converts internal representation of a hop chain to a
|
||||
* Converts internal representation of a hop chain to a
|
||||
* InjectionPointMessage. The delivered InjectionPointMessage is
|
||||
* cleared before parsing.
|
||||
* @param result Internal representation of a hop chain
|
||||
* @param costs Costs of the hop chain (extracted from cost model)
|
||||
* @param ipm InjectionPointMessage to which the hop chain is parsed
|
||||
*/
|
||||
void convertToIPM(std::vector<result_tuple > &result, unsigned costs, InjectionPointMessage &ipm);
|
||||
void convertToIPM(std::vector<result_tuple > &result, unsigned costs, InjectionPointMessage &ipm);
|
||||
|
||||
unsigned int m_trace_pos;
|
||||
unsigned int m_costs;
|
||||
|
||||
TraceReader m_trace_reader;
|
||||
unsigned int m_next_cp_id;
|
||||
TraceReader m_trace_reader;
|
||||
unsigned int m_next_cp_id;
|
||||
Logger m_log;
|
||||
|
||||
bool m_use_watchpoints;
|
||||
@ -77,10 +77,10 @@ private:
|
||||
unsigned int m_rollback_thresh;
|
||||
|
||||
|
||||
std::map<trace_event_tuple_t, trace_pos_t> m_last_positions;
|
||||
std::vector<checkpoint_tuple_t > m_checkpoints;
|
||||
std::map<trace_event_tuple_t, trace_pos_t> m_last_positions;
|
||||
std::vector<checkpoint_tuple_t > m_checkpoints;
|
||||
|
||||
std::vector<trace_event_tuple_t > m_trace_events;
|
||||
std::vector<trace_event_tuple_t > m_trace_events;
|
||||
std::vector<result_tuple > m_result;
|
||||
};
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ bool TraceReader::openTraceFile(const char *filename, unsigned int num_inst)
|
||||
}
|
||||
|
||||
bool TraceReader::getNextTraceEvents(trace_pos_t& trace_pos,
|
||||
std::vector<trace_event_tuple_t >& trace_events)
|
||||
std::vector<trace_event_tuple_t >& trace_events)
|
||||
{
|
||||
// Stop after fixed number of instructions, if given as command line argument
|
||||
if ((m_max_num_inst > 0) && (m_current_position > m_max_num_inst)) {
|
||||
@ -86,15 +86,15 @@ bool TraceReader::getNextTraceEvents(trace_pos_t& trace_pos,
|
||||
ev_avail = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Add a trace_event for every byte in memory access.
|
||||
// This breaks down the calculations to multiple
|
||||
// memory accesses of length 1. No more complexity
|
||||
// This breaks down the calculations to multiple
|
||||
// memory accesses of length 1. No more complexity
|
||||
// is needed in hop calculations.
|
||||
if (ev.has_width()) {
|
||||
for (unsigned int i = 0; i < ev.width(); i++) {
|
||||
trace_events.push_back(
|
||||
trace_event_tuple_t(ev.memaddr() + i,
|
||||
trace_event_tuple_t(ev.memaddr() + i,
|
||||
ev.accesstype() == ev.READ ? ACCESS_READ : ACCESS_WRITE));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,33 +26,32 @@ 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),
|
||||
gz_stream(0),
|
||||
m_max_num_inst(0),
|
||||
ev_avail(false),
|
||||
m_log("TraceReader", false) {}
|
||||
|
||||
TraceReader() : m_current_position(1),
|
||||
ps(0),
|
||||
normal_stream(0),
|
||||
gz_stream(0),
|
||||
m_max_num_inst(0),
|
||||
ev_avail(false),
|
||||
m_log("TraceReader", false) {}
|
||||
~TraceReader();
|
||||
|
||||
~TraceReader();
|
||||
// Returns ACCESS_NONE in mem_access if current instruction does not access memory
|
||||
bool getNextTraceEvents(trace_pos_t& trace_pos,
|
||||
std::vector<trace_event_tuple_t >& trace_events);
|
||||
|
||||
// Returns ACCESS_NONE in mem_access if current instruction does not access memory
|
||||
bool getNextTraceEvents(trace_pos_t& trace_pos,
|
||||
std::vector<trace_event_tuple_t >& trace_events);
|
||||
bool openTraceFile(const char *filename, unsigned int num_inst = 0);
|
||||
private:
|
||||
unsigned int m_current_position;
|
||||
ProtoIStream* ps;
|
||||
std::ifstream *normal_stream;
|
||||
igzstream *gz_stream;
|
||||
unsigned int m_max_num_inst;
|
||||
Trace_Event ev;
|
||||
bool ev_avail;
|
||||
|
||||
bool openTraceFile(const char *filename, unsigned int num_inst = 0);
|
||||
private:
|
||||
unsigned int m_current_position;
|
||||
ProtoIStream* ps;
|
||||
std::ifstream *normal_stream;
|
||||
igzstream *gz_stream;
|
||||
unsigned int m_max_num_inst;
|
||||
Trace_Event ev;
|
||||
bool ev_avail;
|
||||
|
||||
Logger m_log;
|
||||
Logger m_log;
|
||||
};
|
||||
|
||||
} // end of namespace
|
||||
|
||||
Reference in New Issue
Block a user