edits
authorbdemsky <bdemsky@uci.edu>
Fri, 21 Jun 2019 15:37:29 +0000 (08:37 -0700)
committerbdemsky <bdemsky@uci.edu>
Fri, 21 Jun 2019 15:37:29 +0000 (08:37 -0700)
main.cc
params.h
snapshot.cc

diff --git a/main.cc b/main.cc
index 7ce43cb..df8b877 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -22,6 +22,7 @@ static void param_defaults(struct model_params *params)
        params->verbose = !!DBG_ENABLED();
        params->uninitvalue = 0;
        params->maxexecutions = 10;
+       params->nofork = false;
 }
 
 static void print_usage(const char *program_name, struct model_params *params)
@@ -54,6 +55,7 @@ static void print_usage(const char *program_name, struct model_params *params)
                "-x, --maxexec=NUM           Maximum number of executions.\n"
                "                            Default: %u\n"
                "                            -o help for a list of options\n"
+               "-n                          No fork\n"
                " --                         Program arguments follow.\n\n",
                program_name,
                params->verbose,
@@ -84,7 +86,7 @@ bool install_plugin(char * name) {
 
 static void parse_options(struct model_params *params, int argc, char **argv)
 {
-       const char *shortopts = "ht:o:u:x:v::";
+       const char *shortopts = "hnt:o:u:x:v::";
        const struct option longopts[] = {
                {"help", no_argument, NULL, 'h'},
                {"verbose", optional_argument, NULL, 'v'},
@@ -101,6 +103,9 @@ static void parse_options(struct model_params *params, int argc, char **argv)
                case 'h':
                        print_usage(argv[0], params);
                        break;
+               case 'n':
+                 params->nofork = true;
+                 break;
                case 'x':
                        params->maxexecutions = atoi(optarg);
                        break;
index c190066..7f5c219 100644 (file)
--- a/params.h
+++ b/params.h
@@ -8,7 +8,8 @@
 struct model_params {
        unsigned int uninitvalue;
        int maxexecutions;
-
+  bool nofork;
+  
        /** @brief Verbosity (0 = quiet; 1 = noisy; 2 = noisier) */
        int verbose;
 
index ca54c78..b4944f4 100644 (file)
@@ -12,6 +12,7 @@
 #include "mymemory.h"
 #include "common.h"
 #include "context.h"
+#include "model.h"
 
 /** PageAlignedAdressUpdate return a page aligned address for the
  * address being added as a side effect the numBytes are also changed.
@@ -383,7 +384,11 @@ static void fork_snapshot_init(unsigned int numbackingpages,
 
        /* switch back here when takesnapshot is called */
        snapshotid = fork_snap->currSnapShotID;
-
+       if (model->params.nofork) {
+         setcontext(&fork_snap->shared_ctxt);
+         exit(EXIT_SUCCESS);
+       }
+       
        while (true) {
                pid_t forkedID;
                fork_snap->currSnapShotID = snapshotid + 1;