2 * @brief Entry point for the model checker.
7 #include "libthreads.h"
13 /* global "model" object */
15 #include "snapshot-interface.h"
17 static void print_usage() {
19 "Usage: <program name> [OPTIONS]\n"
22 "-h Display this help message and exit\n"
27 static void parse_options(struct model_params *params, int argc, char **argv) {
28 const char *shortopts = "h";
31 while (!error && (opt = getopt(argc, argv, shortopts)) != -1) {
48 /** The real_main function contains the main model checking loop. */
49 static void real_main() {
51 struct model_params params;
53 parse_options(¶ms, main_argc, main_argv);
55 //Initialize race detector
58 //Create the singleton SnapshotStack object
59 snapshotObject = new SnapshotStack();
61 model = new ModelChecker(params);
63 snapshotObject->snapshotStep(0);
65 /* Start user program */
66 model->add_thread(new Thread(&user_thread, (void (*)(void *)) &user_main, NULL));
68 /* Wait for all threads to complete */
69 model->finish_execution();
70 } while (model->next_execution());
78 * Main function. Just initializes snapshotting library and the
79 * snapshotting library calls the real_main function.
81 int main(int argc, char ** argv) {
85 /* Let's jump in quickly and start running stuff */
86 initSnapShotLibrary(10000, 1024, 1024, 1000, &real_main);