formatting, typos, comments, details

Change-Id: Iae5f1acb653a694622e9ac2bad93efcfca588f3a
This commit is contained in:
Horst Schirmeier
2013-10-14 14:43:39 +02:00
parent 7591c9edc5
commit 4cb97a7fa5
138 changed files with 1566 additions and 1576 deletions

View File

@ -29,9 +29,9 @@ bool DatabaseCampaign::run() {
if (!cb_commandline_init()) return false; if (!cb_commandline_init()) return false;
CommandLine::option_handle VARIANT = cmd.addOption("v", "variant", Arg::Required, CommandLine::option_handle VARIANT = cmd.addOption("v", "variant", Arg::Required,
"-v/--variant \tVariant label (default: \"none\")"); "-v/--variant \tVariant label (default: \"none\"; use % and _ as wildcard characters)");
CommandLine::option_handle BENCHMARK = cmd.addOption("b", "benchmark", Arg::Required, CommandLine::option_handle BENCHMARK = cmd.addOption("b", "benchmark", Arg::Required,
"-b/--benchmark \tBenchmark label (default: \"none\")\n"); "-b/--benchmark \tBenchmark label (default: \"none\"; use % and _ as wildcard characters)\n");
CommandLine::option_handle PRUNER = cmd.addOption("p", "prune-method", Arg::Required, CommandLine::option_handle PRUNER = cmd.addOption("p", "prune-method", Arg::Required,
"-p/--prune-method \tWhich import method to use (default: basic)"); "-p/--prune-method \tWhich import method to use (default: basic)");

View File

@ -61,7 +61,7 @@ public:
virtual bool cb_commandline_init() { return true; } virtual bool cb_commandline_init() { return true; }
/** /**
* Callback to the campagin to get the result message descriptor * Callback to the campaign to get the result message descriptor
*/ */
virtual const google::protobuf::Descriptor * cb_result_message() = 0; virtual const google::protobuf::Descriptor * cb_result_message() = 0;

View File

@ -15,7 +15,9 @@ JobClient::JobClient(const std::string& server, int port)
{ {
SocketComm::init(); SocketComm::init();
m_server_ent = gethostbyname(m_server.c_str()); m_server_ent = gethostbyname(m_server.c_str());
cout << "JobServer: " << m_server.c_str() << endl; cout << "JobServer: " << m_server.c_str() << endl;
if (m_server_ent == NULL) { if (m_server_ent == NULL) {
perror("[Client@gethostbyname()]"); perror("[Client@gethostbyname()]");
// TODO: Log-level? // TODO: Log-level?
@ -109,7 +111,6 @@ bool JobClient::getParam(ExperimentData& exp)
FailControlMessage_Command JobClient::tryToGetExperimentData(ExperimentData& exp) FailControlMessage_Command JobClient::tryToGetExperimentData(ExperimentData& exp)
{ {
FailControlMessage ctrlmsg; FailControlMessage ctrlmsg;
//Are there other jobs for the experiment //Are there other jobs for the experiment
@ -187,8 +188,6 @@ FailControlMessage_Command JobClient::tryToGetExperimentData(ExperimentData& exp
} else { } else {
return ctrlmsg.command(); return ctrlmsg.command();
} }
} }
bool JobClient::sendResult(ExperimentData& result) bool JobClient::sendResult(ExperimentData& result)

View File

@ -112,5 +112,4 @@ namespace fail {
#endif #endif
} }
}; };

View File

@ -24,11 +24,8 @@ namespace fail {
}; };
bool eval(address_t opcode, MemoryInstruction & result); bool eval(address_t opcode, MemoryInstruction & result);
}; };
} //end of namespace fail } //end of namespace fail
#endif // __ARMMEMORYINSTRUCITON_HPP__ #endif // __ARMMEMORYINSTRUCITON_HPP__

View File

@ -7,6 +7,7 @@
namespace fail { namespace fail {
namespace T32 { namespace T32 {
//!< Breakpoint configuration //!< Breakpoint configuration
struct BP { struct BP {
enum { enum {

View File

@ -24,7 +24,8 @@ namespace fail {
} }
} }
CommandLine::option_handle CommandLine::addOption(const std::string &shortopt, CommandLine::option_handle CommandLine::addOption(
const std::string &shortopt,
const std::string &longopt, const std::string &longopt,
const option::CheckArg & check_arg, const option::CheckArg & check_arg,
const std::string &help) { const std::string &help) {
@ -65,5 +66,4 @@ namespace fail {
return !m_parser->error(); return !m_parser->error();
} }
} // end of namespace } // end of namespace

View File

@ -17,6 +17,7 @@
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
namespace fail { namespace fail {
/** /**
* @class CommandLine * @class CommandLine
* @brief Implements a command line interface, that filters the * @brief Implements a command line interface, that filters the

View File

@ -107,6 +107,5 @@ namespace fail {
} }
} }
} // end of namespace } // end of namespace

View File

@ -250,6 +250,4 @@ void ElfReader::printSections() {
} }
} }
} // end-of-namespace fail } // end-of-namespace fail

View File

@ -26,8 +26,8 @@ namespace fail {
public: public:
enum { SECTION = 1, SYMBOL = 2, UNDEF = 3, }; enum { SECTION = 1, SYMBOL = 2, UNDEF = 3, };
ElfSymbol(const std::string & name = ELF::NOTFOUND, guest_address_t addr = ADDR_INV, size_t size = -1, int type = UNDEF, ElfSymbol(const std::string & name = ELF::NOTFOUND, guest_address_t addr = ADDR_INV,
int symbol_type = 0) size_t size = -1, int type = UNDEF, int symbol_type = 0)
: name(name), address(addr), size(size), m_type(type), m_symbol_type(symbol_type) {}; : name(name), address(addr), size(size), m_type(type), m_symbol_type(symbol_type) {};
const std::string& getName() const { return name; }; const std::string& getName() const { return name; };
@ -172,4 +172,3 @@ namespace fail {
} // end-of-namespace fail } // end-of-namespace fail
#endif //__ELFREADER_HPP__ #endif //__ELFREADER_HPP__

View File

@ -22,7 +22,7 @@ using namespace fail;
void GenericTracing::parseOptions() { void GenericTracing::parseOptions() {
CommandLine &cmd = CommandLine::Inst(); CommandLine &cmd = CommandLine::Inst();
CommandLine::option_handle IGNORE = cmd.addOption("", "", Arg::None, "USAGE: fail-client -Wf,[option] -Wf,[option] ... <BochsOptions...>\n\n"); cmd.addOption("", "", Arg::None, "USAGE: fail-client -Wf,[option] -Wf,[option] ... <BochsOptions...>\n\n");
CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help \tPrint usage and exit"); CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help \tPrint usage and exit");
@ -35,16 +35,16 @@ void GenericTracing::parseOptions() {
CommandLine::option_handle SAVE_SYMBOL = cmd.addOption("S", "save-symbol", Arg::Required, CommandLine::option_handle SAVE_SYMBOL = cmd.addOption("S", "save-symbol", Arg::Required,
"-S,--save-symbol \tELF symbol to save the state of the machine (default: main)\n"); "-S,--save-symbol \tELF symbol to save the state of the machine (default: main)\n");
CommandLine::option_handle STATE_FILE = cmd.addOption("f", "state-file", Arg::Required, CommandLine::option_handle STATE_FILE = cmd.addOption("f", "state-file", Arg::Required,
"-f,--state-file \tFile/dir to save the state to (default state)"); "-f,--state-file \tFile/dir to save the state to (default: state)");
CommandLine::option_handle TRACE_FILE = cmd.addOption("t", "trace-file", Arg::Required, CommandLine::option_handle TRACE_FILE = cmd.addOption("t", "trace-file", Arg::Required,
"-t,--trace-file \tFile to save the execution trace to\n"); "-t,--trace-file \tFile to save the execution trace to (default: trace.pb)\n");
CommandLine::option_handle FULL_TRACE = cmd.addOption("", "full-trace", Arg::None, "--full-trace \tDo a full trace (more data, default: off)"); CommandLine::option_handle FULL_TRACE = cmd.addOption("", "full-trace", Arg::None, "--full-trace \tDo a full trace (more data, default: off)");
CommandLine::option_handle MEM_SYMBOL = cmd.addOption("m", "memory-symbol", Arg::Required, CommandLine::option_handle MEM_SYMBOL = cmd.addOption("m", "memory-symbol", Arg::Required,
"-m,--memory-symbol \tELF symbol(s) to trace accesses (default: all mem read/writes are traced)"); "-m,--memory-symbol \tELF symbol(s) to trace accesses (default: all mem read/writes are traced)");
CommandLine::option_handle MEM_REGION = cmd.addOption("M", "memory-region", Arg::Required, CommandLine::option_handle MEM_REGION = cmd.addOption("M", "memory-region", Arg::Required,
"-M,--memory-region \trestrict memory region which is traced" "-M,--memory-region \trestrict memory region which is traced"
" Possible formats: 0x<address>, 0x<address>:0x<address>, 0x<address>:<length>"); " (Possible formats: 0x<address>, 0x<address>:0x<address>, 0x<address>:<length>)");
if (!cmd.parse()) { if (!cmd.parse()) {
cerr << "Error parsing arguments." << endl; cerr << "Error parsing arguments." << endl;

View File

@ -43,7 +43,6 @@ private:
* Handle the memory event * Handle the memory event
*/ */
void handleEvent(fail::simtime_t simtime, uint32_t value); void handleEvent(fail::simtime_t simtime, uint32_t value);
}; };
#endif // __REALTIMELOGGER_HPP__ #endif // __REALTIMELOGGER_HPP__

View File

@ -62,4 +62,3 @@ double Sine::calculate() const
} }
return val; return val;
} }

View File

@ -31,8 +31,6 @@
* FIXME: more explicit startup/shutdown; listener-based event interface needed? * FIXME: more explicit startup/shutdown; listener-based event interface needed?
* -> should simulator.removeFlow make sure all remaining active events * -> should simulator.removeFlow make sure all remaining active events
* are delivered? * are delivered?
* FIXME: trace a sequence of pb messages, not a giant single one (pb weren't
* made for huge messages)
* FIXME: destructor -> removeFlow? * FIXME: destructor -> removeFlow?
*/ */
class TracingPlugin : public fail::ExperimentFlow class TracingPlugin : public fail::ExperimentFlow

View File

@ -88,7 +88,7 @@ bool Importer::copy_to_database(fail::ProtoIStream &ps) {
curtime += ev.time_delta(); curtime += ev.time_delta();
} }
// instruction events just get counted // instruction event?
if (!ev.has_memaddr()) { if (!ev.has_memaddr()) {
// new instruction // new instruction
// sanity check for overflow // sanity check for overflow

View File

@ -146,7 +146,7 @@ int main(int argc, char *argv[]) {
importer = new ElfImporter(); importer = new ElfImporter();
#endif #endif
} else { } else {
LOG << "Unkown import method: " << imp << endl; LOG << "Unknown import method: " << imp << endl;
exit(-1); exit(-1);
} }
LOG << "Using " << imp << endl; LOG << "Using " << imp << endl;

View File

@ -6,7 +6,7 @@
class BasicPruner : public Pruner { class BasicPruner : public Pruner {
bool use_instr1; bool use_instr1;
public: public:
BasicPruner(bool use_instr1 = false) : Pruner(), use_instr1(use_instr1) {} BasicPruner(bool use_instr1 = false) : use_instr1(use_instr1) {}
virtual std::string method_name() { return std::string("basic") + (use_instr1 ? "-left" : ""); } virtual std::string method_name() { return std::string("basic") + (use_instr1 ? "-left" : ""); }
virtual bool prune_all(); virtual bool prune_all();
}; };

View File

@ -17,8 +17,9 @@ int main(int argc, char *argv[]) {
// Manually fill the command line option parser // Manually fill the command line option parser
CommandLine &cmd = CommandLine::Inst(); CommandLine &cmd = CommandLine::Inst();
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i) {
cmd.add_args(argv[i]); cmd.add_args(argv[i]);
}
cmd.addOption("", "", Arg::None, "USAGE: import-trace [options]"); cmd.addOption("", "", Arg::None, "USAGE: import-trace [options]");
CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help \tPrint usage and exit"); CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help \tPrint usage and exit");
@ -50,17 +51,17 @@ int main(int argc, char *argv[]) {
} }
Pruner *pruner; Pruner *pruner;
if (cmd[PRUNER].count() > 0) { if (cmd[PRUNER]) {
std::string imp(cmd[PRUNER].first()->arg); std::string imp(cmd[PRUNER].first()->arg);
if (imp == "basic") { if (imp == "BasicPruner" || imp == "basic") {
LOG << "Using BasicPruner" << endl; LOG << "Using BasicPruner" << endl;
pruner = new BasicPruner(); pruner = new BasicPruner();
} else if (imp == "basic-left") { } else if (imp == "BasicPrunerLeft" || imp == "basic-left") {
LOG << "Using BasicPruner (use left border, instr1)" << endl; LOG << "Using BasicPruner (use left border, instr1)" << endl;
pruner = new BasicPruner(true); pruner = new BasicPruner(true);
} else { } else {
LOG << "Unkown import method: " << imp << endl; LOG << "Unknown pruning method: " << imp << endl;
exit(-1); exit(-1);
} }
@ -77,7 +78,7 @@ int main(int argc, char *argv[]) {
Database *db = Database::cmdline_connect(); Database *db = Database::cmdline_connect();
std::vector<std::string> variants, benchmarks, variants_exclude, benchmarks_exclude; std::vector<std::string> variants, benchmarks, variants_exclude, benchmarks_exclude;
if (cmd[VARIANT].count() > 0) { if (cmd[VARIANT]) {
for (option::Option *o = cmd[VARIANT]; o; o = o->next()) { for (option::Option *o = cmd[VARIANT]; o; o = o->next()) {
variants.push_back(std::string(o->arg)); variants.push_back(std::string(o->arg));
} }
@ -85,13 +86,13 @@ int main(int argc, char *argv[]) {
variants.push_back(std::string("none")); variants.push_back(std::string("none"));
} }
if (cmd[VARIANT_EXCLUDE].count() > 0) { if (cmd[VARIANT_EXCLUDE]) {
for (option::Option *o = cmd[VARIANT_EXCLUDE]; o; o = o->next()) { for (option::Option *o = cmd[VARIANT_EXCLUDE]; o; o = o->next()) {
variants_exclude.push_back(std::string(o->arg)); variants_exclude.push_back(std::string(o->arg));
} }
} }
if (cmd[BENCHMARK].count() > 0) { if (cmd[BENCHMARK]) {
for (option::Option *o = cmd[BENCHMARK]; o; o = o->next()) { for (option::Option *o = cmd[BENCHMARK]; o; o = o->next()) {
benchmarks.push_back(std::string(o->arg)); benchmarks.push_back(std::string(o->arg));
} }
@ -99,7 +100,7 @@ int main(int argc, char *argv[]) {
benchmarks.push_back(std::string("none")); benchmarks.push_back(std::string("none"));
} }
if (cmd[BENCHMARK_EXCLUDE].count() > 0) { if (cmd[BENCHMARK_EXCLUDE]) {
for (option::Option *o = cmd[BENCHMARK_EXCLUDE]; o; o = o->next()) { for (option::Option *o = cmd[BENCHMARK_EXCLUDE]; o; o = o->next()) {
benchmarks_exclude.push_back(std::string(o->arg)); benchmarks_exclude.push_back(std::string(o->arg));
} }
@ -118,7 +119,7 @@ int main(int argc, char *argv[]) {
exit(-1); exit(-1);
} }
if (cmd[NO_DELETE].count() == 0 && !pruner->clear_database()) { if (!cmd[NO_DELETE] && !pruner->clear_database()) {
LOG << "clear_database() failed" << endl; LOG << "clear_database() failed" << endl;
exit(-1); exit(-1);
} }