static void print_usage(const char *program_name, struct model_params *params)
{
+ ModelVector<TraceAnalysis *> * registeredanalysis=getRegisteredTraceAnalysis();
/* Reset defaults before printing */
param_defaults(params);
"-u, --uninitialized=VALUE Return VALUE any load which may read from an\n"
" uninitialized atomic.\n"
" Default: %u\n"
-"-t, --analysis=NAME Use Trace Analysis.\n"
-"-o, --options=NAME Options.\n"
+"-t, --analysis=NAME Use Analysis Plugin.\n"
+"-o, --options=NAME Option for previous analysis plugin. \n"
+" -o help for a list of options\n"
" -- Program arguments follow.\n\n",
program_name,
params->maxreads,
params->enabledcount,
params->bound,
params->uninitvalue);
+ model_print("Analysis plug ins:\n");
+ for(unsigned int i=0;i<registeredanalysis->size();i++) {
+ TraceAnalysis * analysis=(*registeredanalysis)[i];
+ model_print("%s\n", analysis->name());
+ }
exit(EXIT_SUCCESS);
}
ModelChecker::~ModelChecker()
{
delete node_stack;
- for (unsigned int i = 0; i < trace_analyses.size(); i++)
- delete trace_analyses[i];
delete scheduler;
}
badrfset(),
lastwrmap(),
threadlists(1),
- execution(NULL)
+ execution(NULL),
+ print_always(false),
+ print_buggy(true)
{
}
this->execution=execution;
}
-char * SCAnalysis::name() {
- char * name = "SC";
+const char * SCAnalysis::name() {
+ const char * name = "SC";
return name;
}
-bool SCAnalysis::option(char *) {
- return false;
+bool SCAnalysis::option(char * opt) {
+ if (strcmp(opt, "verbose")==0) {
+ print_always=true;
+ return false;
+ } else if (strcmp(opt, "buggy")==0) {
+ return false;
+ } else if (strcmp(opt, "quiet")==0) {
+ print_buggy=false;
+ return false;
+ } if (strcmp(opt, "help") != 0) {
+ model_print("Unrecognized option: %s\n", opt);
+ }
+
+ model_print("SC Analysis options\n");
+ model_print("verbose -- print all feasible executions\n");
+ model_print("buggy -- print only buggy executions (default)\n");
+ model_print("quiet -- print nothing\n");
+ model_print("\n");
+
+ return true;
}
void SCAnalysis::print_list(action_list_t *list) {
void SCAnalysis::analyze(action_list_t *actions) {
action_list_t *list = generateSC(actions);
check_rf(list);
- print_list(list);
+ if (print_always || (print_buggy && execution->have_bug_reports()))
+ print_list(list);
}
void SCAnalysis::check_rf(action_list_t *list) {
~SCAnalysis();
virtual void setExecution(ModelExecution * execution);
virtual void analyze(action_list_t *);
- virtual char * name();
+ virtual const char * name();
virtual bool option(char *);
SNAPSHOTALLOC
HashTable<void *, const ModelAction *, uintptr_t, 4 > lastwrmap;
SnapVector<action_list_t> threadlists;
ModelExecution *execution;
+ bool print_always;
+ bool print_buggy;
};
#endif
public:
virtual void setExecution(ModelExecution * execution) = 0;
virtual void analyze(action_list_t *) = 0;
- virtual char * name() = 0;
+ virtual const char * name() = 0;
virtual bool option(char *) = 0;
SNAPSHOTALLOC