X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=main.cc;h=502f499eff9cb2de956256bb6f24b84080e600e0;hb=refs%2Fheads%2Fmaster;hp=5a33baf996bc3d0f85f11108797b8907c89b6507;hpb=a4d3f2ae3f3a9e2a30cc36c92cee9f83bb09e9b1;p=model-checker.git diff --git a/main.cc b/main.cc index 5a33baf..502f499 100644 --- a/main.cc +++ b/main.cc @@ -31,6 +31,7 @@ static void param_defaults(struct model_params *params) params->expireslop = 4; params->verbose = !!DBG_ENABLED(); params->uninitvalue = 0; + params->maxexecutions = 0; } static void print_usage(const char *program_name, struct model_params *params) @@ -46,7 +47,7 @@ static void print_usage(const char *program_name, struct model_params *params) "\n" "Usage: %s [MODEL-CHECKER OPTIONS] -- [PROGRAM ARGS]\n" "\n" -"MODLE-CHECKER OPTIONS can be any of the model-checker options listed below. Arguments\n" +"MODEL-CHECKER OPTIONS can be any of the model-checker options listed below. Arguments\n" "provided after the `--' (the PROGRAM ARGS) are passed to the user program.\n" "\n" "Model-checker options:\n" @@ -63,7 +64,8 @@ static void print_usage(const char *program_name, struct model_params *params) " Default: %d\n" "-S, --fvslop=NUM Future value expiration sloppiness.\n" " Default: %u\n" -"-y, --yield Enable CHESS-like yield-based fairness support.\n" +"-y, --yield Enable CHESS-like yield-based fairness support\n" +" (requires thrd_yield() in test program).\n" " Default: %s\n" "-Y, --yieldblock Prohibit an execution from running a yield.\n" " Default: %s\n" @@ -75,12 +77,17 @@ static void print_usage(const char *program_name, struct model_params *params) " Default: %d\n" "-b, --bound=MAX Upper length bound.\n" " Default: %d\n" -"-v, --verbose Print verbose execution information.\n" +"-v[NUM], --verbose[=NUM] Print verbose execution information. NUM is optional:\n" +" 0 is quiet; 1 shows valid executions; 2 is noisy;\n" +" 3 is noisier.\n" +" Default: %d\n" "-u, --uninitialized=VALUE Return VALUE any load which may read from an\n" " uninitialized atomic.\n" " Default: %u\n" "-t, --analysis=NAME Use Analysis Plugin.\n" "-o, --options=NAME Option for previous analysis plugin. \n" +"-x, --maxexec=NUM Maximum number of executions.\n" +" Default: %u\n" " -o help for a list of options\n" " -- Program arguments follow.\n\n", program_name, @@ -93,8 +100,10 @@ static void print_usage(const char *program_name, struct model_params *params) params->fairwindow, params->enabledcount, params->bound, - params->uninitvalue); - model_print("Analysis plug ins:\n"); + params->verbose, + params->uninitvalue, + params->maxexecutions); + model_print("Analysis plugins:\n"); for(unsigned int i=0;isize();i++) { TraceAnalysis * analysis=(*registeredanalysis)[i]; model_print("%s\n", analysis->name()); @@ -119,7 +128,7 @@ bool install_plugin(char * name) { static void parse_options(struct model_params *params, int argc, char **argv) { - const char *shortopts = "hyYt:o:m:M:s:S:f:e:b:u:v::"; + const char *shortopts = "hyYt:o:m:M:s:S:f:e:b:u:x:v::"; const struct option longopts[] = { {"help", no_argument, NULL, 'h'}, {"liveness", required_argument, NULL, 'm'}, @@ -132,9 +141,10 @@ static void parse_options(struct model_params *params, int argc, char **argv) {"enabled", required_argument, NULL, 'e'}, {"bound", required_argument, NULL, 'b'}, {"verbose", optional_argument, NULL, 'v'}, - {"uninitialized", optional_argument, NULL, 'u'}, - {"analysis", optional_argument, NULL, 't'}, - {"options", optional_argument, NULL, 'o'}, + {"uninitialized", required_argument, NULL, 'u'}, + {"analysis", required_argument, NULL, 't'}, + {"options", required_argument, NULL, 'o'}, + {"maxexecutions", required_argument, NULL, 'x'}, {0, 0, 0, 0} /* Terminator */ }; int opt, longindex; @@ -144,6 +154,9 @@ static void parse_options(struct model_params *params, int argc, char **argv) case 'h': print_usage(argv[0], params); break; + case 'x': + params->maxexecutions = atoi(optarg); + break; case 's': params->maxfuturedelay = atoi(optarg); break; @@ -218,6 +231,8 @@ static void install_trace_analyses(ModelExecution *execution) TraceAnalysis * ta=(*installedanalysis)[i]; ta->setExecution(execution); model->add_trace_analysis(ta); + /** Call the installation event for each installed plugin */ + ta->actionAtInstallation(); } } @@ -255,6 +270,18 @@ int main(int argc, char **argv) main_argc = argc; main_argv = argv; + /* + * If this printf statement is removed, CDSChecker will fail on an + * assert on some versions of glibc. The first time printf is + * called, it allocated internal buffers. We can't easily snapshot + * libc since we also use it. + */ + + printf("CDSChecker\n" + "Copyright (c) 2013 Regents of the University of California. All rights reserved.\n" + "Distributed under the GPLv2\n" + "Written by Brian Norris and Brian Demsky\n\n"); + /* Configure output redirection for the model-checker */ redirect_output();