Adds a '-v' parameter for printing verbose info on a non-DEBUG build.
This effectively creates 3 classes of runs:
- Default build, no -v: only prints info when discovering a buggy
execution
- Default build, -v: prints more verbose information, on all feasible
executions (buggy or non-buggy)
- Debug build: Built with 'make debug'. Most verbose; prints everything
for every execution, including infeasible executions. Also prints
DEBUG() prints (as usual).
params->bound = 0;
params->maxfuturevalues = 0;
params->expireslop = 10;
+ params->verbose = 0;
}
static void print_usage(struct model_params *params) {
" priority for execution. Default: %d\n"
"-e Enabled count. Default: %d\n"
"-b Upper length bound. Default: %d\n"
+"-v Print verbose execution information.\n"
"-- Program arguments follow.\n\n",
params->maxreads, params->maxfuturevalues, params->maxfuturedelay, params->expireslop, params->fairwindow, params->enabledcount, params->bound);
exit(EXIT_SUCCESS);
}
static void parse_options(struct model_params *params, int *argc, char ***argv) {
- const char *shortopts = "hm:M:s:S:f:e:b:";
+ const char *shortopts = "hm:M:s:S:f:e:b:v";
int opt;
bool error = false;
while (!error && (opt = getopt(*argc, *argv, shortopts)) != -1) {
case 'M':
params->maxfuturevalues = atoi(optarg);
break;
+ case 'v':
+ params->verbose = 1;
+ break;
default: /* '?' */
error = true;
break;
DBG();
if (isfinalfeasible() && (is_complete_execution() || have_bug_reports())) {
- model_print("Earliest divergence point since last feasible execution:\n");
- if (earliest_diverge)
- earliest_diverge->print();
- else
- model_print("(Not set)\n");
-
- earliest_diverge = NULL;
-
if (is_deadlocked())
assert_bug("Deadlock detected");
checkDataRaces();
- print_bugs();
- model_print("\n");
- print_summary();
+
+ if (DBG_ENABLED() || params.verbose || have_bug_reports()) {
+ print_program_output();
+
+ if (DBG_ENABLED() || params.verbose) {
+ model_print("Earliest divergence point since last feasible execution:\n");
+ if (earliest_diverge)
+ earliest_diverge->print();
+ else
+ model_print("(Not set)\n");
+
+ model_print("\n");
+ print_stats();
+ }
+
+ print_bugs();
+ model_print("\n");
+ print_summary();
+ } else
+ clear_program_output();
+
+ earliest_diverge = NULL;
} else if (DBG_ENABLED()) {
+ print_program_output();
model_print("\n");
+ print_stats();
print_summary();
+ } else {
+ clear_program_output();
}
record_stats();
* expiration time exceeds the existing one by more than the slop
* value */
unsigned int expireslop;
+
+ /** @brief Verbosity (0 = quiet; 1 = noisy) */
+ int verbose;
};
/** @brief Model checker execution stats */