cleanups
Change-Id: I8022d937477668253c613e97c3a579ae65084b1e
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -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
|
||||
|
||||
|
||||
@ -31,29 +31,28 @@ if(BUILD_PANDA)
|
||||
set(srces ${openocd_src_dir}/openocd_wrapper.cc)
|
||||
|
||||
set (srces ${srces}
|
||||
${openocd_src_dir}/opcode_parser/arm-addressmode.c
|
||||
${openocd_src_dir}/opcode_parser/arm-condition.c
|
||||
${openocd_src_dir}/opcode_parser/arm-opcode-coprocessor.c
|
||||
${openocd_src_dir}/opcode_parser/arm-opcode-data.c
|
||||
${openocd_src_dir}/opcode_parser/arm-opcode-ldmstm-branch.c
|
||||
${openocd_src_dir}/opcode_parser/arm-opcode-ldrstr.c
|
||||
${openocd_src_dir}/opcode_parser/arm-opcode.c)
|
||||
${openocd_src_dir}/opcode_parser/arm-addressmode.c
|
||||
${openocd_src_dir}/opcode_parser/arm-condition.c
|
||||
${openocd_src_dir}/opcode_parser/arm-opcode-coprocessor.c
|
||||
${openocd_src_dir}/opcode_parser/arm-opcode-data.c
|
||||
${openocd_src_dir}/opcode_parser/arm-opcode-ldmstm-branch.c
|
||||
${openocd_src_dir}/opcode_parser/arm-opcode-ldrstr.c
|
||||
${openocd_src_dir}/opcode_parser/arm-opcode.c)
|
||||
|
||||
add_executable(fail-client ${srces})
|
||||
add_executable(fail-client ${srces})
|
||||
target_link_libraries(fail-client ${openocd_src_dir}/src/.libs/libopenocd.a ${openocd_src_dir}/jimtcl/libjim.a fail ${openocd_library_dependencies})
|
||||
add_dependencies(fail-client libfailopenocd_external)
|
||||
|
||||
# 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()
|
||||
|
||||
|
||||
# copy the conf-files to build directory
|
||||
# TODO: copy to install path on install!?
|
||||
# copy the conf-files to build directory
|
||||
# TODO: copy to install path on install!?
|
||||
file(COPY ${openocd_src_dir}/tcl/ DESTINATION oocd_conf/ PATTERN openocd EXCLUDE)
|
||||
get_filename_component(OOCD_CONF_FILES_PATH ${CMAKE_BINARY_DIR}/oocd_conf/ REALPATH)
|
||||
|
||||
|
||||
@ -150,21 +150,21 @@ static std::vector<struct mem_range> mmu_watch_del_waiting_list;
|
||||
static std::vector<struct mem_range> mmu_watch;
|
||||
|
||||
/*
|
||||
* Timer related structures
|
||||
* Timer related structures
|
||||
*/
|
||||
#define P_MAX_TIMERS 32
|
||||
struct timer{
|
||||
bool inUse; // Timer slot is in-use (currently registered).
|
||||
uint64_t timeToFire; // Time to fire next in microseconds
|
||||
struct timeval time_begin; // Timer value at activation of timer
|
||||
bool active; // 0=inactive, 1=active.
|
||||
p_timer_handler_t funct; // A callback function for when the
|
||||
bool inUse; // Timer slot is in-use (currently registered).
|
||||
uint64_t timeToFire; // Time to fire next in microseconds
|
||||
struct timeval time_begin; // Timer value at activation of timer
|
||||
bool active; // 0=inactive, 1=active.
|
||||
p_timer_handler_t funct; // A callback function for when the
|
||||
// timer fires.
|
||||
void *this_ptr; // The this-> pointer for C++ callbacks
|
||||
// has to be stored as well.
|
||||
bool freezed;
|
||||
void *this_ptr; // The this-> pointer for C++ callbacks
|
||||
// has to be stored as well.
|
||||
bool freezed;
|
||||
#define PMaxTimerIDLen 32
|
||||
char id[PMaxTimerIDLen]; // String ID of timer.
|
||||
char id[PMaxTimerIDLen]; // String ID of timer.
|
||||
};
|
||||
|
||||
static struct timer timers[P_MAX_TIMERS];
|
||||
@ -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);
|
||||
}
|
||||
@ -687,26 +687,26 @@ int main(int argc, char *argv[])
|
||||
// Get meta information and fire MemoryAccess event
|
||||
int iswrite;
|
||||
switch (halt.type) {
|
||||
case HALT_TYPE_WP_READ:
|
||||
iswrite = 0;
|
||||
break;
|
||||
case HALT_TYPE_WP_WRITE:
|
||||
iswrite = 1;
|
||||
break;
|
||||
case HALT_TYPE_WP_READWRITE:
|
||||
LOG << "We should not get a READWRITE as trigger of"
|
||||
"a watchpoint!" << endl;
|
||||
iswrite = 1;
|
||||
break;
|
||||
default:
|
||||
LOG << "FATAL ERROR: Can't determine memory-access type of halt cause" << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
case HALT_TYPE_WP_READ:
|
||||
iswrite = 0;
|
||||
break;
|
||||
case HALT_TYPE_WP_WRITE:
|
||||
iswrite = 1;
|
||||
break;
|
||||
case HALT_TYPE_WP_READWRITE:
|
||||
LOG << "We should not get a READWRITE as trigger of"
|
||||
"a watchpoint!" << endl;
|
||||
iswrite = 1;
|
||||
break;
|
||||
default:
|
||||
LOG << "FATAL ERROR: Can't determine memory-access type of halt cause" << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
|
||||
freeze_timers();
|
||||
LOG << "WATCHPOINT EVENT ADDR: " << hex << halt.address << dec
|
||||
<< " LENGTH: " << halt.addr_len << " TYPE: "
|
||||
<< " LENGTH: " << halt.addr_len << " TYPE: "
|
||||
<< (iswrite?'W':'R') << endl;
|
||||
fail::simulator.onMemoryAccess(NULL, halt.address, halt.addr_len, iswrite, pc);
|
||||
unfreeze_timers();
|
||||
@ -721,7 +721,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
default:
|
||||
LOG << "FATAL ERROR: Target halted in unexpected cpu state "
|
||||
<< current_dr << endl;
|
||||
<< current_dr << endl;
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
@ -731,19 +731,19 @@ int main(int argc, char *argv[])
|
||||
update_timers();
|
||||
}
|
||||
|
||||
/* === FINISHING UP === */
|
||||
unregister_all_commands(cmd_ctx, NULL);
|
||||
/* === FINISHING UP === */
|
||||
unregister_all_commands(cmd_ctx, NULL);
|
||||
|
||||
/* free commandline interface */
|
||||
command_done(cmd_ctx);
|
||||
/* free commandline interface */
|
||||
command_done(cmd_ctx);
|
||||
|
||||
adapter_quit();
|
||||
adapter_quit();
|
||||
|
||||
fclose(file);
|
||||
fclose(file);
|
||||
|
||||
LOG << "finished" << endl;
|
||||
LOG << "finished" << endl;
|
||||
|
||||
exit(oocdw_exCode);
|
||||
exit(oocdw_exCode);
|
||||
}
|
||||
|
||||
void oocdw_finish(int exCode)
|
||||
@ -758,7 +758,7 @@ void oocdw_set_halt_condition(struct halt_condition *hc)
|
||||
assert((hc != NULL) && "No halt condition defined");
|
||||
|
||||
|
||||
if (hc->type == HALT_TYPE_BP) { /* BREAKPOINT */
|
||||
if (hc->type == HALT_TYPE_BP) { /* BREAKPOINT */
|
||||
LOG << "Adding BP " << hex << hc->address << dec << ":" << hc->addr_len << endl;
|
||||
if (!free_breakpoints) {
|
||||
LOG << "FATAL ERROR: No free breakpoints left" << endl;
|
||||
@ -771,13 +771,13 @@ void oocdw_set_halt_condition(struct halt_condition *hc)
|
||||
}
|
||||
free_breakpoints--;
|
||||
|
||||
} else if (hc->type == HALT_TYPE_SINGLESTEP) { /* SINGLE STEP */
|
||||
} else if (hc->type == HALT_TYPE_SINGLESTEP) { /* SINGLE STEP */
|
||||
// Just set flag, so single step will be executed in according
|
||||
// main loop stage
|
||||
single_step_requested = true;
|
||||
} else if ((hc->type == HALT_TYPE_WP_READ) ||
|
||||
(hc->type == HALT_TYPE_WP_WRITE) ||
|
||||
(hc->type == HALT_TYPE_WP_READWRITE)) { /* WATCHPOINT */
|
||||
(hc->type == HALT_TYPE_WP_READWRITE)) { /* WATCHPOINT */
|
||||
|
||||
// Use MMU for watching ?
|
||||
if ((hc->addr_len > 4) || !free_watchpoints) {
|
||||
@ -834,17 +834,17 @@ void oocdw_delete_halt_condition(struct halt_condition *hc)
|
||||
assert((hc != NULL) && "No halt condition defined");
|
||||
|
||||
// Remove halt condition from pandaboard
|
||||
if (hc->type == HALT_TYPE_BP) { /* BREAKPOINT */
|
||||
if (hc->type == HALT_TYPE_BP) { /* BREAKPOINT */
|
||||
LOG << "Removing BP " << hex << hc->address << dec << ":"
|
||||
<< hc->addr_len << endl;
|
||||
breakpoint_remove(target_a9, hc->address);
|
||||
free_breakpoints++;
|
||||
} else if (hc->type == HALT_TYPE_SINGLESTEP) { /* SINGLE STEP */
|
||||
} else if (hc->type == HALT_TYPE_SINGLESTEP) { /* SINGLE STEP */
|
||||
// Do nothing. Single-stepping event hits one time and
|
||||
// extinguishes itself automatically
|
||||
} else if ((hc->type == HALT_TYPE_WP_READWRITE) ||
|
||||
(hc->type == HALT_TYPE_WP_READ) ||
|
||||
(hc->type == HALT_TYPE_WP_WRITE)) { /* WATCHPOINT */
|
||||
(hc->type == HALT_TYPE_WP_WRITE)) { /* WATCHPOINT */
|
||||
|
||||
struct mem_range mr;
|
||||
mr.address = hc->address;
|
||||
@ -876,7 +876,7 @@ void oocdw_delete_halt_condition(struct halt_condition *hc)
|
||||
// Remove hardware watchpoint
|
||||
watchpoint_remove(target_a9, hc->address);
|
||||
free_watchpoints++;
|
||||
LOG << hex << "Removing WP " << hc->address << ":" << hc->addr_len
|
||||
LOG << hex << "Removing WP " << hc->address << ":" << hc->addr_len
|
||||
<< ":" << ((hc->type == HALT_TYPE_WP_READ) ? "R" :
|
||||
(hc->type == HALT_TYPE_WP_WRITE) ? "W" : "R/W") << dec << endl;
|
||||
}
|
||||
@ -956,44 +956,44 @@ void oocdw_reboot()
|
||||
LOG << "Rebooting device" << endl;
|
||||
reboot_success = true;
|
||||
|
||||
// If target is not halted, reset will result in freeze
|
||||
if (target_a9->state != TARGET_HALTED) {
|
||||
if (!oocdw_halt_target(target_a9)) {
|
||||
reboot_success = false;
|
||||
if (fail_counter++ > 4) {
|
||||
// If target is not halted, reset will result in freeze
|
||||
if (target_a9->state != TARGET_HALTED) {
|
||||
if (!oocdw_halt_target(target_a9)) {
|
||||
reboot_success = false;
|
||||
if (fail_counter++ > 4) {
|
||||
LOG << "FATAL ERROR: Rebooting not possible" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
usleep(100*1000);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
usleep(100*1000);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear all halt conditions
|
||||
*/
|
||||
breakpoint_clear_target(target_a9);
|
||||
watchpoint_clear_target(target_a9);
|
||||
/*
|
||||
* Clear all halt conditions
|
||||
*/
|
||||
breakpoint_clear_target(target_a9);
|
||||
watchpoint_clear_target(target_a9);
|
||||
|
||||
/*
|
||||
* Reset state structures
|
||||
*/
|
||||
free_watchpoints = 4;
|
||||
free_breakpoints = 6;
|
||||
mmu_recovery_needed = false;
|
||||
mmu_watch.clear();
|
||||
mmu_watch_add_waiting_list.clear();
|
||||
mmu_watch_del_waiting_list.clear();
|
||||
/*
|
||||
* Reset state structures
|
||||
*/
|
||||
free_watchpoints = 4;
|
||||
free_breakpoints = 6;
|
||||
mmu_recovery_needed = false;
|
||||
mmu_watch.clear();
|
||||
mmu_watch_add_waiting_list.clear();
|
||||
mmu_watch_del_waiting_list.clear();
|
||||
|
||||
|
||||
// Standard configuration: Sections only, all mapped
|
||||
for (int i = 0; i < 4096; i++) {
|
||||
if (mmu_conf[i].type == DESCRIPTOR_PAGE) {
|
||||
delete[] mmu_conf[i].second_lvl_mapped;
|
||||
mmu_conf[i].type = DESCRIPTOR_SECTION;
|
||||
}
|
||||
mmu_conf[i].mapped = true;
|
||||
}
|
||||
// Standard configuration: Sections only, all mapped
|
||||
for (int i = 0; i < 4096; i++) {
|
||||
if (mmu_conf[i].type == DESCRIPTOR_PAGE) {
|
||||
delete[] mmu_conf[i].second_lvl_mapped;
|
||||
mmu_conf[i].type = DESCRIPTOR_SECTION;
|
||||
}
|
||||
mmu_conf[i].mapped = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* The actual reset command executed by OpenOCD jimtcl-engine
|
||||
@ -1351,7 +1351,7 @@ void oocdw_read_from_memory(uint32_t address, uint32_t chunk_size,
|
||||
uint32_t chunk_num, uint8_t *data)
|
||||
{
|
||||
if (target_read_memory(target_a9, address, chunk_size, chunk_num, data)) {
|
||||
LOG << "FATAL ERROR: Reading from memory failed. Addr: " << hex
|
||||
LOG << "FATAL ERROR: Reading from memory failed. Addr: " << hex
|
||||
<< address << dec << " chunk-size: " << chunk_size
|
||||
<< " chunk_num: " << chunk_num << endl;
|
||||
exit(-1);
|
||||
@ -1757,7 +1757,7 @@ static void force_page_alignment_mem_range (std::vector<struct mem_range> &in,
|
||||
|
||||
static bool compareByAddress(const struct mem_range &a, const struct mem_range &b)
|
||||
{
|
||||
return a.address < b.address;
|
||||
return a.address < b.address;
|
||||
}
|
||||
|
||||
static void merge_mem_ranges (std::vector<struct mem_range> &in_out)
|
||||
@ -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) {
|
||||
@ -1872,7 +1872,7 @@ static bool update_mmu_watch_add()
|
||||
first_lvl->second_lvl_mapped[i] = true;
|
||||
descr_content = (((cand_it->index - (cand_it->index % 256)) + i) << 12) | 0x32;
|
||||
buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>(
|
||||
pageTableAddress + (i * 4),
|
||||
pageTableAddress + (i * 4),
|
||||
descr_content));
|
||||
}
|
||||
first_lvl->type = DESCRIPTOR_PAGE;
|
||||
@ -1885,7 +1885,7 @@ static bool update_mmu_watch_add()
|
||||
if (first_lvl->second_lvl_mapped[cand_it->index % 256]) {
|
||||
uint32_t descr_content = (cand_it->index << 12) | 0x30;
|
||||
buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>(
|
||||
sym_addr_PageTableSecondLevel + (cand_it->index * 4),
|
||||
sym_addr_PageTableSecondLevel + (cand_it->index * 4),
|
||||
descr_content));
|
||||
first_lvl->second_lvl_mapped[cand_it->index % 256] = false;
|
||||
invalidate = true;
|
||||
@ -1908,7 +1908,7 @@ static bool update_mmu_watch_add()
|
||||
if (first_lvl->type == DESCRIPTOR_SECTION) {
|
||||
if (first_lvl->mapped) {
|
||||
uint32_t descr_content = (cand_it->index << 20) | 0xc00;
|
||||
uint32_t descr_addr = sym_addr_PageTableFirstLevel + (cand_it->index * 4);
|
||||
uint32_t descr_addr = sym_addr_PageTableFirstLevel + (cand_it->index * 4);
|
||||
|
||||
buffer_for_chunked_write.push_back(
|
||||
std::pair<uint32_t, uint32_t>(descr_addr,descr_content));
|
||||
@ -2035,7 +2035,7 @@ static bool update_mmu_watch_remove()
|
||||
uint32_t pageTableAddress = sym_addr_PageTableSecondLevel + ((cand_it->index - (cand_it->index % 256)) * 4);
|
||||
uint32_t descr_content = pageTableAddress | 0x1e9;
|
||||
uint32_t target_address = sym_addr_PageTableFirstLevel + ((cand_it->index / 256) * 4);
|
||||
LOG << "Writing to " << hex << target_address << dec << endl;
|
||||
LOG << "Writing to " << hex << target_address << dec << endl;
|
||||
oocdw_write_to_memory(target_address, 4, 1, (unsigned char*)(&descr_content), true);
|
||||
invalidate = true;
|
||||
|
||||
@ -2046,7 +2046,7 @@ static bool update_mmu_watch_remove()
|
||||
first_lvl->second_lvl_mapped[i] = false;
|
||||
descr_content = (((cand_it->index - (cand_it->index % 256)) + i) << 12) | 0x30;
|
||||
buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>(
|
||||
pageTableAddress + (i * 4),
|
||||
pageTableAddress + (i * 4),
|
||||
descr_content));
|
||||
}
|
||||
first_lvl->type = DESCRIPTOR_PAGE;
|
||||
@ -2056,7 +2056,7 @@ static bool update_mmu_watch_remove()
|
||||
if (!first_lvl->second_lvl_mapped[cand_it->index % 256]) {
|
||||
uint32_t descr_content = (cand_it->index << 12) | 0x32;
|
||||
buffer_for_chunked_write.push_back(std::pair<uint32_t, uint32_t>(
|
||||
sym_addr_PageTableSecondLevel + (cand_it->index * 4),
|
||||
sym_addr_PageTableSecondLevel + (cand_it->index * 4),
|
||||
descr_content));
|
||||
first_lvl->second_lvl_mapped[cand_it->index % 256] = true;
|
||||
}
|
||||
@ -2078,7 +2078,7 @@ static bool update_mmu_watch_remove()
|
||||
if (first_lvl->type == DESCRIPTOR_SECTION) {
|
||||
if (!first_lvl->mapped) {
|
||||
uint32_t descr_content = (cand_it->index << 20) | 0xc02;
|
||||
uint32_t descr_addr = sym_addr_PageTableFirstLevel + (cand_it->index * 4);
|
||||
uint32_t descr_addr = sym_addr_PageTableFirstLevel + (cand_it->index * 4);
|
||||
LOG << "Write to " << hex << descr_addr << dec << endl;
|
||||
oocdw_write_to_memory(descr_addr, 4, 1, (unsigned char*)(&descr_content), true);
|
||||
LOG << "Writing entry at " << hex << descr_addr << " content: " << descr_content << dec << endl;
|
||||
|
||||
@ -8,17 +8,17 @@
|
||||
#define OOCD_CONF_FILES_PATH "@OOCD_CONF_FILES_PATH@"
|
||||
|
||||
enum halt_type {
|
||||
HALT_TYPE_BP,
|
||||
HALT_TYPE_WP_READWRITE,
|
||||
HALT_TYPE_WP_READ,
|
||||
HALT_TYPE_WP_WRITE,
|
||||
HALT_TYPE_SINGLESTEP,
|
||||
HALT_TYPE_BP,
|
||||
HALT_TYPE_WP_READWRITE,
|
||||
HALT_TYPE_WP_READ,
|
||||
HALT_TYPE_WP_WRITE,
|
||||
HALT_TYPE_SINGLESTEP,
|
||||
};
|
||||
|
||||
struct halt_condition {
|
||||
enum halt_type type;
|
||||
uint32_t address;
|
||||
uint32_t addr_len;
|
||||
enum halt_type type;
|
||||
uint32_t address;
|
||||
uint32_t addr_len;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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,
|
||||
// here it is
|
||||
optional uint32 target_trace_position = 4;
|
||||
// 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
|
||||
|
||||
@ -6,9 +6,9 @@ set(SRCS
|
||||
|
||||
# only compile concrete implementation of InjectionPoint
|
||||
if(CONFIG_INJECTIONPOINT_HOPS)
|
||||
set (SRCS ${SRCS} InjectionPointHops.cc)
|
||||
set (SRCS ${SRCS} InjectionPointHops.cc)
|
||||
else(CONFIG_INJECTIONPOINT_HOPS)
|
||||
set (SRCS ${SRCS} InjectionPointSteps.cc)
|
||||
set (SRCS ${SRCS} InjectionPointSteps.cc)
|
||||
endif(CONFIG_INJECTIONPOINT_HOPS)
|
||||
|
||||
add_library(fail-cpn ${SRCS})
|
||||
@ -16,7 +16,7 @@ add_library(fail-cpn ${SRCS})
|
||||
# if hop-chains need to be calculated by the server, we
|
||||
# the smarthopping module
|
||||
if(CONFIG_INJECTIONPOINT_HOPS)
|
||||
add_dependencies(fail-cpn fail-smarthops)
|
||||
add_dependencies(fail-cpn fail-smarthops)
|
||||
endif(CONFIG_INJECTIONPOINT_HOPS)
|
||||
|
||||
add_dependencies(fail-cpn fail-comm)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
@ -74,7 +74,7 @@ void InjectionPointHops::parseFromInjectionInstr(unsigned instr1, unsigned instr
|
||||
if (!m_sa->calculateFollowingHop(m, new_curr_instr2)) {
|
||||
m_log << "FATAL ERROR: Trace does not contain enough instructions (no instruction with offset "
|
||||
<< new_curr_instr2 << ")" << std::endl;
|
||||
exit(-1);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
m_results.push_back(m);
|
||||
@ -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);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Architecture.hpp: wraps architecture definition headers
|
||||
#ifndef __ARCHITECTURE_HPP__
|
||||
#define __ARCHITECTURE_HPP__
|
||||
#define __ARCHITECTURE_HPP__
|
||||
|
||||
#include "config/FailConfig.hpp"
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ elseif(BUILD_T32)
|
||||
)
|
||||
endif(BUILD_ARM)
|
||||
elseif(BUILD_PANDA)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/debuggers/openocd)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/debuggers/openocd)
|
||||
set(SRCS
|
||||
CPU.cc
|
||||
CPUState.cc
|
||||
@ -82,28 +82,28 @@ if(BUILD_X86)
|
||||
set(SRCS ${SRCS}
|
||||
x86/X86Architecture.cc
|
||||
)
|
||||
set(ARCH_TOOL_PREFIX "" CACHE PATH "Setup prefix for binutils, e.g., arm-none-eabi- or tricore-, ..")
|
||||
set(ARCH_TOOL_PREFIX "" CACHE PATH "Setup prefix for binutils, e.g., arm-none-eabi- or tricore-, ..")
|
||||
elseif(BUILD_ARM)
|
||||
set(SRCS ${SRCS}
|
||||
arm/ArmArchitecture.cc
|
||||
)
|
||||
set(ARCH_TOOL_PREFIX "arm-none-eabi-" CACHE PATH "Setup prefix for binutils, e.g., arm-none-eabi- or tricore-, ..")
|
||||
set(ARCH_TOOL_PREFIX "arm-none-eabi-" CACHE PATH "Setup prefix for binutils, e.g., arm-none-eabi- or tricore-, ..")
|
||||
endif(BUILD_X86)
|
||||
|
||||
if(BUILD_GEM5)
|
||||
message(STATUS "[${PROJECT_NAME}] Generating SConscript in ${CMAKE_CURRENT_BINARY_DIR}/gem5")
|
||||
set(additional_libs "")
|
||||
message(STATUS "[${PROJECT_NAME}] Generating SConscript in ${CMAKE_CURRENT_BINARY_DIR}/gem5")
|
||||
set(additional_libs "")
|
||||
|
||||
foreach(exp ${EXPERIMENTS_ACTIVATED})
|
||||
set(additional_libs "${additional_libs} '-lfail-${exp}',")
|
||||
endforeach(exp)
|
||||
foreach(exp ${EXPERIMENTS_ACTIVATED})
|
||||
set(additional_libs "${additional_libs} '-lfail-${exp}',")
|
||||
endforeach(exp)
|
||||
|
||||
foreach(plug ${PLUGINS_ACTIVATED})
|
||||
set(additional_libs "${additional_libs} '-lfail-${plug}',")
|
||||
endforeach(plug)
|
||||
foreach(plug ${PLUGINS_ACTIVATED})
|
||||
set(additional_libs "${additional_libs} '-lfail-${plug}',")
|
||||
endforeach(plug)
|
||||
|
||||
set(GEM5_SAL_SRCS "'${CMAKE_CURRENT_SOURCE_DIR}/gem5/Gem5Wrapper.cc'")
|
||||
configure_file(gem5/SConscript.in ${CMAKE_CURRENT_BINARY_DIR}/gem5/SConscript)
|
||||
set(GEM5_SAL_SRCS "'${CMAKE_CURRENT_SOURCE_DIR}/gem5/Gem5Wrapper.cc'")
|
||||
configure_file(gem5/SConscript.in ${CMAKE_CURRENT_BINARY_DIR}/gem5/SConscript)
|
||||
endif(BUILD_GEM5)
|
||||
# Don't include these sources if perf-stuff is disabled
|
||||
# (reduces compiler overhead):
|
||||
|
||||
@ -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"
|
||||
@ -33,7 +33,7 @@ public:
|
||||
*/
|
||||
regdata_t getRegisterContent(const Register* reg) const;
|
||||
/**
|
||||
* Sets the register content for the \a current Pandaboard CPU.
|
||||
* Sets the register content for the \a current Pandaboard CPU.
|
||||
* @param reg the (initialized) register object whose content should be set
|
||||
* @param value the new content of the register \c reg
|
||||
*/
|
||||
|
||||
@ -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,38 +11,40 @@
|
||||
|
||||
aspect PandaBreakpoints
|
||||
{
|
||||
advice "fail::BPSingleListener" : slice class
|
||||
{
|
||||
public:
|
||||
bool onAddition()
|
||||
{
|
||||
// Setup Breakpoint on Pandaboard
|
||||
struct halt_condition hc;
|
||||
if (m_WatchInstrPtr == ANY_ADDR) {
|
||||
hc.type = HALT_TYPE_SINGLESTEP;
|
||||
} else {
|
||||
hc.type = HALT_TYPE_BP;
|
||||
}
|
||||
hc.address = m_WatchInstrPtr;
|
||||
hc.addr_len= 4; // Thumb? => 2
|
||||
oocdw_set_halt_condition(&hc);
|
||||
return true;
|
||||
}
|
||||
|
||||
void onDeletion()
|
||||
{
|
||||
// Delete Breakpoint on Pandaboard
|
||||
struct halt_condition hc;
|
||||
if (m_WatchInstrPtr == ANY_ADDR) {
|
||||
hc.type = HALT_TYPE_SINGLESTEP;
|
||||
} else {
|
||||
hc.type = HALT_TYPE_BP;
|
||||
}
|
||||
hc.address = m_WatchInstrPtr;
|
||||
hc.addr_len= 4; // Thumb? => 2
|
||||
oocdw_delete_halt_condition(&hc);
|
||||
advice "fail::BPSingleListener" : slice class
|
||||
{
|
||||
public:
|
||||
bool onAddition()
|
||||
{
|
||||
// Setup Breakpoint on Pandaboard
|
||||
struct halt_condition hc;
|
||||
if (m_WatchInstrPtr == ANY_ADDR) {
|
||||
hc.type = HALT_TYPE_SINGLESTEP;
|
||||
} else {
|
||||
hc.type = HALT_TYPE_BP;
|
||||
}
|
||||
};
|
||||
hc.address = m_WatchInstrPtr;
|
||||
hc.addr_len = 4; // Thumb? => 2
|
||||
oocdw_set_halt_condition(&hc);
|
||||
return true;
|
||||
}
|
||||
|
||||
void onDeletion()
|
||||
{
|
||||
// Delete Breakpoint on Pandaboard
|
||||
struct halt_condition hc;
|
||||
if (m_WatchInstrPtr == ANY_ADDR) {
|
||||
hc.type = HALT_TYPE_SINGLESTEP;
|
||||
} else {
|
||||
hc.type = HALT_TYPE_BP;
|
||||
}
|
||||
hc.address = m_WatchInstrPtr;
|
||||
hc.addr_len = 4; // Thumb? => 2
|
||||
oocdw_delete_halt_condition(&hc);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif // BUILD_PANDA && CONFIG_EVENT_BREAKPOINTS
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef __PANDA_CONTROLLER_HPP__
|
||||
#define __PANDA_CONTROLLER_HPP__
|
||||
#define __PANDA_CONTROLLER_HPP__
|
||||
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef __PANDA_LISTENER_HPP__
|
||||
#define __PANDA_LISTENER_HPP__
|
||||
#define __PANDA_LISTENER_HPP__
|
||||
|
||||
namespace fail {
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef __PANDA_MEMORY_HPP__
|
||||
#define __PANDA_MEMORY_HPP__
|
||||
#define __PANDA_MEMORY_HPP__
|
||||
|
||||
#include "../Memory.hpp"
|
||||
|
||||
@ -19,7 +19,7 @@ public:
|
||||
* Constructs a new MemoryManager object and initializes
|
||||
* it's attributes appropriately.
|
||||
*/
|
||||
PandaMemoryManager() : MemoryManager() { }
|
||||
PandaMemoryManager() : MemoryManager() { }
|
||||
/**
|
||||
* Retrieves the size of the available simulated memory.
|
||||
* @return the size of the memory pool in bytes
|
||||
|
||||
@ -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,40 +10,42 @@
|
||||
#include "PandaListener.hpp"
|
||||
|
||||
aspect PandaTimer {
|
||||
advice "fail::TimerListener" : slice class {
|
||||
public:
|
||||
bool onAddition()
|
||||
{
|
||||
// Register the timer listener in the Bochs simulator:
|
||||
timer_id_t id = m_registerTimer(this);
|
||||
if (id == -1) {
|
||||
setId(INVALID_TIMER);
|
||||
return false; // unable to register the timer (error in Bochs' function call)
|
||||
}
|
||||
setId(id);
|
||||
return true;
|
||||
|
||||
advice "fail::TimerListener" : slice class {
|
||||
public:
|
||||
bool onAddition()
|
||||
{
|
||||
// Register the timer listener in the Bochs simulator:
|
||||
timer_id_t id = m_registerTimer(this);
|
||||
if (id == -1) {
|
||||
setId(INVALID_TIMER);
|
||||
return false; // unable to register the timer (error in Bochs' function call)
|
||||
}
|
||||
void onDeletion()
|
||||
{
|
||||
// Unregister the time listener:
|
||||
m_unregisterTimer(this);
|
||||
}
|
||||
private:
|
||||
timer_id_t m_registerTimer(TimerListener* pev)
|
||||
{
|
||||
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
|
||||
return static_cast<timer_id_t>(
|
||||
oocdw_register_timer(pev, fail::onTimerTrigger,
|
||||
pev->getTimeout() /*timeout in microseconds*/,
|
||||
true /*start immediately*/, "Fail*: PandaController"/*name*/));
|
||||
}
|
||||
bool m_unregisterTimer(TimerListener* pev)
|
||||
{
|
||||
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
|
||||
oocdw_deactivate_timer(static_cast<unsigned>(pev->getId()));
|
||||
return oocdw_unregisterTimer(static_cast<unsigned>(pev->getId()));
|
||||
}
|
||||
};
|
||||
setId(id);
|
||||
return true;
|
||||
}
|
||||
void onDeletion()
|
||||
{
|
||||
// Unregister the time listener:
|
||||
m_unregisterTimer(this);
|
||||
}
|
||||
private:
|
||||
timer_id_t m_registerTimer(TimerListener* pev)
|
||||
{
|
||||
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
|
||||
return static_cast<timer_id_t>(
|
||||
oocdw_register_timer(pev, fail::onTimerTrigger,
|
||||
pev->getTimeout() /*timeout in microseconds*/,
|
||||
true /*start immediately*/, "Fail*: PandaController"/*name*/));
|
||||
}
|
||||
bool m_unregisterTimer(TimerListener* pev)
|
||||
{
|
||||
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
|
||||
oocdw_deactivate_timer(static_cast<unsigned>(pev->getId()));
|
||||
return oocdw_unregisterTimer(static_cast<unsigned>(pev->getId()));
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif // BUILD_PANDA && CONFIG_EVENT_BREAKPOINTS
|
||||
|
||||
@ -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,49 +11,56 @@
|
||||
|
||||
aspect PandaWatchpoints
|
||||
{
|
||||
advice "fail::MemAccessListener" : slice class
|
||||
|
||||
advice "fail::MemAccessListener" : slice class
|
||||
{
|
||||
int m_t32access;
|
||||
public:
|
||||
bool onAddition()
|
||||
{
|
||||
int m_t32access;
|
||||
public:
|
||||
bool onAddition()
|
||||
{
|
||||
// Setup Watchpoint on Pandaboard (if it cant be realized as WP, mmu will be utilzed)
|
||||
struct halt_condition hc;
|
||||
// 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;
|
||||
default: return false;
|
||||
}
|
||||
|
||||
hc.address = m_WatchAddr;
|
||||
hc.addr_len = m_WatchWidth;
|
||||
|
||||
oocdw_set_halt_condition(&hc);
|
||||
|
||||
return true;
|
||||
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;
|
||||
}
|
||||
|
||||
void onDeletion()
|
||||
{
|
||||
// Remove Watchpoint from Pandaboard (if it was realized by mmu, it will be reprogrammed)
|
||||
struct halt_condition hc;
|
||||
hc.address = m_WatchAddr;
|
||||
hc.addr_len = m_WatchWidth;
|
||||
|
||||
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
|
||||
}
|
||||
oocdw_set_halt_condition(&hc);
|
||||
|
||||
hc.address = m_WatchAddr;
|
||||
hc.addr_len = m_WatchWidth;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ToDo: Error handling
|
||||
oocdw_delete_halt_condition(&hc);
|
||||
void onDeletion()
|
||||
{
|
||||
// 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;
|
||||
default: return; // ToDo: Error handling
|
||||
}
|
||||
};
|
||||
|
||||
hc.address = m_WatchAddr;
|
||||
hc.addr_len = m_WatchWidth;
|
||||
|
||||
// ToDo: Error handling
|
||||
oocdw_delete_halt_condition(&hc);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -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,7 +44,7 @@ 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:
|
||||
|
||||
/**
|
||||
@ -55,13 +55,13 @@ private:
|
||||
* @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)) {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
@ -66,11 +65,10 @@ bool LRASimplePandaExperiment::navigateToInjectionPoint(ConcreteInjectionPoint &
|
||||
if (ipm.has_checkpoint_id()) {
|
||||
// ToDo: Load CP state!
|
||||
|
||||
log_nav << "FATAL ERROR: CPs not yet implemented!" << endl;
|
||||
log_nav << "FATAL ERROR: CPs not yet implemented!" << endl;
|
||||
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);
|
||||
}
|
||||
@ -203,17 +200,17 @@ bool LRASimplePandaExperiment::run()
|
||||
logger << "New param" << param.msg.DebugString() << endl;
|
||||
|
||||
// Get input data from Jobserver
|
||||
unsigned injection_instr = param.msg.fsppilot().injection_instr();
|
||||
unsigned injection_instr = param.msg.fsppilot().injection_instr();
|
||||
address_t data_address = param.msg.fsppilot().data_address();
|
||||
// unsigned data_width = param.msg.fsppilot().data_width();
|
||||
ConcreteInjectionPoint ip;
|
||||
ip.parseFromCampaignMessage(param.msg.fsppilot());
|
||||
|
||||
for (unsigned experiment_id = 0; experiment_id < LRASP_NUM_EXP_PER_PILOT; ++experiment_id) {
|
||||
LraSimpleProtoMsg_Result *result = param.msg.add_result();
|
||||
for (unsigned experiment_id = 0; experiment_id < LRASP_NUM_EXP_PER_PILOT; ++experiment_id) {
|
||||
LraSimpleProtoMsg_Result *result = param.msg.add_result();
|
||||
executed_jobs ++;
|
||||
|
||||
WallclockTimer timer;
|
||||
WallclockTimer timer;
|
||||
timer.startTimer();
|
||||
|
||||
/********************
|
||||
@ -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();
|
||||
@ -321,7 +317,7 @@ bool LRASimplePandaExperiment::run()
|
||||
BaseListener* ev = simulator.resume();
|
||||
|
||||
if (ev == &ev_timeout) {
|
||||
logger << "Timeout!" << endl;
|
||||
logger << "Timeout!" << endl;
|
||||
result->set_resulttype(result->ERR_TIMEOUT);
|
||||
} else if (ev == &ev_trap) {
|
||||
logger << "Trap!" << endl;
|
||||
@ -332,7 +328,7 @@ bool LRASimplePandaExperiment::run()
|
||||
ev == &ev_unauth_mem_acc_4) {
|
||||
|
||||
result->set_resulttype(result->ERR_OUTSIDE_TEXT);
|
||||
logger << hex << "Unauthorized memory access (" << ((((MemAccessListener*)ev)->getTriggerAccessType() == fail::MemAccessEvent::MEM_READ) ? "R" : "W") <<
|
||||
logger << hex << "Unauthorized memory access (" << ((((MemAccessListener*)ev)->getTriggerAccessType() == fail::MemAccessEvent::MEM_READ) ? "R" : "W") <<
|
||||
") at instruction " << ((MemAccessListener*)ev)->getTriggerInstructionPointer() << " access address: " <<
|
||||
((MemAccessListener*)ev)->getTriggerAddress() << dec << endl;
|
||||
} else if (ev == &ev_func_end) {
|
||||
@ -357,12 +353,12 @@ bool LRASimplePandaExperiment::run()
|
||||
|
||||
result->set_experiment_number(executed_jobs);
|
||||
|
||||
simulator.clearListeners();
|
||||
}
|
||||
simulator.clearListeners();
|
||||
}
|
||||
|
||||
jobClient->sendResult(param);
|
||||
logger << param.debugString();
|
||||
}
|
||||
jobClient->sendResult(param);
|
||||
logger << param.debugString();
|
||||
}
|
||||
|
||||
logger << "jobClient.getNumberOfUndoneJobs() = " << jobClient->getNumberOfUndoneJobs() << "executed_jobs = " << executed_jobs << endl;
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -7,7 +7,7 @@ message LraSimpleProtoMsg {
|
||||
enum ResultType {
|
||||
OK = 1;
|
||||
|
||||
ERR_WRONG_RESULT = 2;
|
||||
ERR_WRONG_RESULT = 2;
|
||||
|
||||
ERR_TRAP = 3;
|
||||
ERR_TIMEOUT = 4;
|
||||
@ -15,12 +15,11 @@ message LraSimpleProtoMsg {
|
||||
ERR_OUTSIDE_TEXT = 5;
|
||||
}
|
||||
|
||||
//required int32 bitoffset = 1 [(sql_primary_key) = true];
|
||||
//required int32 bitoffset = 1 [(sql_primary_key) = true];
|
||||
|
||||
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;
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -27,9 +27,9 @@ if(BUILD_CONVERT_TRACE)
|
||||
endif(BUILD_CONVERT_TRACE)
|
||||
|
||||
if(BUILD_COMPUTE_HOPS)
|
||||
add_subdirectory(compute-hops)
|
||||
add_subdirectory(compute-hops)
|
||||
endif(BUILD_COMPUTE_HOPS)
|
||||
|
||||
if(BUILD_DUMP_HOPS)
|
||||
add_subdirectory(dump-hops)
|
||||
add_subdirectory(dump-hops)
|
||||
endif(BUILD_DUMP_HOPS)
|
||||
|
||||
@ -5,19 +5,18 @@
|
||||
class ResultCollector;
|
||||
|
||||
class BasicAlgorithm {
|
||||
public:
|
||||
/**
|
||||
*
|
||||
* @returns boolean value for calculation success
|
||||
*/
|
||||
virtual bool calculateAllHops(fail::TraceReader& trace) = 0;
|
||||
public:
|
||||
/**
|
||||
*
|
||||
* @returns boolean value for calculation success
|
||||
*/
|
||||
virtual bool calculateAllHops(fail::TraceReader& trace) = 0;
|
||||
|
||||
BasicAlgorithm(ResultCollector *rc) {m_resultCollector = rc;}
|
||||
virtual ~BasicAlgorithm() {}
|
||||
BasicAlgorithm(ResultCollector *rc) { m_resultCollector = rc; }
|
||||
virtual ~BasicAlgorithm() {}
|
||||
|
||||
protected:
|
||||
ResultCollector *m_resultCollector;
|
||||
protected:
|
||||
ResultCollector *m_resultCollector;
|
||||
};
|
||||
|
||||
#endif // __BASIC_ALGORITHM__HPP
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ set(SRCS
|
||||
)
|
||||
|
||||
if(NOT CONFIG_INJECTIONPOINT_HOPS)
|
||||
message (FATAL_ERROR "For building the compute-hops tool you need to enable CONFIG_INJECTIONPOINT_HOPS")
|
||||
message (FATAL_ERROR "For building the compute-hops tool you need to enable CONFIG_INJECTIONPOINT_HOPS")
|
||||
endif()
|
||||
|
||||
add_executable(compute-hops main.cc ${SRCS})
|
||||
|
||||
@ -74,7 +74,7 @@ ResultCollector::addResult(std::vector<result_tuple >& res, unsigned int costs)
|
||||
if (ps) {
|
||||
InjectionPointMessage hc;
|
||||
hc.set_costs(costs);
|
||||
hc.set_target_trace_position(res.back().second);
|
||||
hc.set_target_trace_position(res.back().second);
|
||||
// If checkpoint at beginning of hop-chain, add its id to InjectionPointMessage
|
||||
std::vector<result_tuple >::iterator it_hop = res.begin();
|
||||
if (it_hop != res.end() && it_hop->first.second == ACCESS_CHECKPOINT) {
|
||||
@ -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;
|
||||
|
||||
@ -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_ */
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#ifndef SIMPLE_ALGORITHM__HPP
|
||||
#define SIMPLE_ALGORITHM__HPP
|
||||
|
||||
//#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "BasicAlgorithm.hpp"
|
||||
@ -16,15 +15,14 @@ public:
|
||||
SimpleAlgorithm(ResultCollector *rc) : BasicAlgorithm(rc) {}
|
||||
virtual ~SimpleAlgorithm() {}
|
||||
|
||||
bool calculateAllHops(TraceReader& trace);
|
||||
bool calculateAllHops(TraceReader& trace);
|
||||
|
||||
private:
|
||||
// Count occurences
|
||||
//map<trace_event_tuple_t, vector<trace_pos_t> > m_occurences;
|
||||
std::map<trace_event_tuple_t, unsigned long > m_occurences;
|
||||
// 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_occ_cp;
|
||||
std::map<trace_event_tuple_t, unsigned long> m_occ_cp;
|
||||
};
|
||||
|
||||
#endif // SIMPLE_ALGORITHM__HPP
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ bool SmartAlgorithm::calculateAllHops(TraceReader& trace)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Deltion of unnecessary hops
|
||||
// Deletion of unnecessary hops
|
||||
|
||||
/*
|
||||
* |----------------|
|
||||
|
||||
@ -21,19 +21,19 @@ public:
|
||||
SmartAlgorithm(ResultCollector *rc) : BasicAlgorithm(rc), m_next_cp_id(0) {}
|
||||
virtual ~SmartAlgorithm() {}
|
||||
|
||||
bool calculateAllHops(TraceReader& trace);
|
||||
bool calculateAllHops(TraceReader& trace);
|
||||
|
||||
private:
|
||||
|
||||
bool
|
||||
bool
|
||||
occurenceInPosIntervall(unsigned int intervall_low,
|
||||
unsigned int intervall_high,
|
||||
address_t add,
|
||||
mem_access_type_e acc);
|
||||
|
||||
std::map<trace_event_tuple_t, trace_pos_t> m_last_positions;
|
||||
std::vector<checkpoint_tuple_t > m_checkpoints;
|
||||
unsigned int m_next_cp_id;
|
||||
std::map<trace_event_tuple_t, trace_pos_t> m_last_positions;
|
||||
std::vector<checkpoint_tuple_t > m_checkpoints;
|
||||
unsigned int m_next_cp_id;
|
||||
};
|
||||
|
||||
#endif // SMART_ALGORITHM__HPP
|
||||
|
||||
@ -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);
|
||||
}
|
||||
@ -282,32 +281,32 @@ int main(int argc, char *argv[])
|
||||
|
||||
BasicAlgorithm *algo;
|
||||
|
||||
switch (algorithm) {
|
||||
case ALGO_SMART:
|
||||
algo = new SmartAlgorithm(&rc);
|
||||
break;
|
||||
case ALGO_SIMPLE:
|
||||
algo = new SimpleAlgorithm(&rc);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (algorithm) {
|
||||
case ALGO_SMART:
|
||||
algo = new SmartAlgorithm(&rc);
|
||||
break;
|
||||
case ALGO_SIMPLE:
|
||||
algo = new SimpleAlgorithm(&rc);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
rc.startTimer();
|
||||
algo->calculateAllHops(trace);
|
||||
rc.stopTimer();
|
||||
rc.startTimer();
|
||||
algo->calculateAllHops(trace);
|
||||
rc.stopTimer();
|
||||
|
||||
rc.finish();
|
||||
rc.finish();
|
||||
|
||||
// ToDo: close output file if not stdout
|
||||
// ToDo: close output file if not stdout
|
||||
if (outFile != &std::cout) {
|
||||
((std::ofstream*)outFile)->close();
|
||||
delete (std::ofstream*)outFile;
|
||||
}
|
||||
|
||||
if (g_use_checkpoints) {
|
||||
g_cp_ofstream.close();
|
||||
}
|
||||
if (g_use_checkpoints) {
|
||||
g_cp_ofstream.close();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user