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 c8417c027666219b9fdaa6da21d256ad4ebdf42c..d2d8d4ab835a5d44d35789f1075f8f7d55a09063 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"
+"-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<TraceAnalysis *> * analyses = getInstalledTraceAnalysis();
+                               if ( analyses->size() == 0 || (*analyses)[analyses->size()-1]->option(optarg))
+                                       error = true;
+                       }
+                       break;
                case 'Y':
                        params->yieldblock = true;
                        break;
index 265c84cd4fdf3e937ea48adfbc7e145b14efcb15..2738bb50a907a76f6ee6a60fb38d0f68406de7cc 100644 (file)
@@ -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)
index ffa933ad5e2b872769199ca81fbcec9d7afd8333..286f73dea6ec00f065af822f66ae4c3baee1f59c 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 bool option(char *);
 
        SNAPSHOTALLOC
  private:
index 43c6ebacfac7d9d2a94b0bbd27335e5b8c975396..a71e8c9df9b08123ca371f5bd48b8c193f75fb4d 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 bool option(char *) = 0;
+
        SNAPSHOTALLOC
 };
 #endif