From: Brian Demsky Date: Mon, 6 May 2013 10:05:50 +0000 (-0700) Subject: add support for analysis with options X-Git-Tag: oopsla2013~17 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f3359dd1b9ba12e5092504e8e53e3615bdb2956a;p=model-checker.git add support for analysis with options --- diff --git a/main.cc b/main.cc index c8417c0..d2d8d4a 100644 --- a/main.cc +++ b/main.cc @@ -79,6 +79,7 @@ static void print_usage(const char *program_name, struct model_params *params) " uninitialized atomic.\n" " Default: %u\n" "-t, --analysis=NAME Use Trace Analysis.\n" +"-o, --options=NAME Options.\n" " -- Program arguments follow.\n\n", program_name, params->maxreads, @@ -111,7 +112,7 @@ bool install_plugin(char * name) { static void parse_options(struct model_params *params, int argc, char **argv) { - const char *shortopts = "hyYt:m:M:s:S:f:e:b:u:v::"; + const char *shortopts = "hyYt:o:m:M:s:S:f:e:b:u:v::"; const struct option longopts[] = { {"help", no_argument, NULL, 'h'}, {"liveness", required_argument, NULL, 'm'}, @@ -126,6 +127,7 @@ static void parse_options(struct model_params *params, int argc, char **argv) {"verbose", optional_argument, NULL, 'v'}, {"uninitialized", optional_argument, NULL, 'u'}, {"analysis", optional_argument, NULL, 't'}, + {"options", optional_argument, NULL, 'o'}, {0, 0, 0, 0} /* Terminator */ }; int opt, longindex; @@ -169,6 +171,13 @@ static void parse_options(struct model_params *params, int argc, char **argv) if (install_plugin(optarg)) error = true; break; + case 'o': + { + ModelVector * analyses = getInstalledTraceAnalysis(); + if ( analyses->size() == 0 || (*analyses)[analyses->size()-1]->option(optarg)) + error = true; + } + break; case 'Y': params->yieldblock = true; break; diff --git a/scanalysis.cc b/scanalysis.cc index 265c84c..2738bb5 100644 --- a/scanalysis.cc +++ b/scanalysis.cc @@ -26,6 +26,10 @@ char * SCAnalysis::name() { return name; } +bool SCAnalysis::option(char *) { + return false; +} + void SCAnalysis::print_list(action_list_t *list) { model_print("---------------------------------------------------------------------\n"); if (cyclic) diff --git a/scanalysis.h b/scanalysis.h index ffa933a..286f73d 100644 --- a/scanalysis.h +++ b/scanalysis.h @@ -10,7 +10,7 @@ class SCAnalysis : public TraceAnalysis { virtual void setExecution(ModelExecution * execution); virtual void analyze(action_list_t *); virtual char * name(); - + virtual bool option(char *); SNAPSHOTALLOC private: diff --git a/traceanalysis.h b/traceanalysis.h index 43c6eba..a71e8c9 100644 --- a/traceanalysis.h +++ b/traceanalysis.h @@ -7,6 +7,8 @@ class TraceAnalysis { virtual void setExecution(ModelExecution * execution) = 0; virtual void analyze(action_list_t *) = 0; virtual char * name() = 0; + virtual bool option(char *) = 0; + SNAPSHOTALLOC }; #endif