add support for analysis with options
authorBrian Demsky <bdemsky@uci.edu>
Mon, 6 May 2013 10:05:50 +0000 (03:05 -0700)
committerBrian Demsky <bdemsky@uci.edu>
Mon, 6 May 2013 10:05:50 +0000 (03:05 -0700)
main.cc
scanalysis.cc
scanalysis.h
traceanalysis.h

diff --git a/main.cc b/main.cc
index c8417c0..d2d8d4a 100644 (file)
--- 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"
 "                              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,
 " --                         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)
 {
 
 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'},
        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'},
                {"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;
                {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;
                        if (install_plugin(optarg))
                                error = true;
                        break;
+               case 'o':
+                       {
+                               ModelVector<TraceAnalysis *> * analyses = getInstalledTraceAnalysis();
+                               if ( analyses->size() == 0 || (*analyses)[analyses->size()-1]->option(optarg))
+                                       error = true;
+                       }
+                       break;
                case 'Y':
                        params->yieldblock = true;
                        break;
                case 'Y':
                        params->yieldblock = true;
                        break;
index 265c84c..2738bb5 100644 (file)
@@ -26,6 +26,10 @@ char * SCAnalysis::name() {
        return name;
 }
 
        return name;
 }
 
+bool SCAnalysis::option(char *) {
+       return false;
+}
+
 void SCAnalysis::print_list(action_list_t *list) {
        model_print("---------------------------------------------------------------------\n");
        if (cyclic)
 void SCAnalysis::print_list(action_list_t *list) {
        model_print("---------------------------------------------------------------------\n");
        if (cyclic)
index ffa933a..286f73d 100644 (file)
@@ -10,7 +10,7 @@ class SCAnalysis : public TraceAnalysis {
        virtual void setExecution(ModelExecution * execution);
        virtual void analyze(action_list_t *);
        virtual char * name();
        virtual void setExecution(ModelExecution * execution);
        virtual void analyze(action_list_t *);
        virtual char * name();
-
+       virtual bool option(char *);
 
        SNAPSHOTALLOC
  private:
 
        SNAPSHOTALLOC
  private:
index 43c6eba..a71e8c9 100644 (file)
@@ -7,6 +7,8 @@ class TraceAnalysis {
        virtual void setExecution(ModelExecution * execution) = 0;
        virtual void analyze(action_list_t *) = 0;
        virtual char * name() = 0;
        virtual void setExecution(ModelExecution * execution) = 0;
        virtual void analyze(action_list_t *) = 0;
        virtual char * name() = 0;
+       virtual bool option(char *) = 0;
+
        SNAPSHOTALLOC
 };
 #endif
        SNAPSHOTALLOC
 };
 #endif