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 7ce43cbf0f1ce9a4a8b7a0de4f7b5b27f0c5b6ff..df8b8776610a40a83ffc7b04540ccdc400586b70 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->verbose = !!DBG_ENABLED();
        params->uninitvalue = 0;
        params->maxexecutions = 10;
+       params->nofork = false;
 }
 
 static void print_usage(const char *program_name, struct model_params *params)
 }
 
 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"
                "-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,
                " --                         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)
 {
 
 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'},
        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 'h':
                        print_usage(argv[0], params);
                        break;
+               case 'n':
+                 params->nofork = true;
+                 break;
                case 'x':
                        params->maxexecutions = atoi(optarg);
                        break;
                case 'x':
                        params->maxexecutions = atoi(optarg);
                        break;
index c190066bec52a5593f48d436989ba5febd85d39a..7f5c219205096ff3c5a6b38ceec1db2f983508c0 100644 (file)
--- a/params.h
+++ b/params.h
@@ -8,7 +8,8 @@
 struct model_params {
        unsigned int uninitvalue;
        int maxexecutions;
 struct model_params {
        unsigned int uninitvalue;
        int maxexecutions;
-
+  bool nofork;
+  
        /** @brief Verbosity (0 = quiet; 1 = noisy; 2 = noisier) */
        int verbose;
 
        /** @brief Verbosity (0 = quiet; 1 = noisy; 2 = noisier) */
        int verbose;
 
index ca54c785385bb85b0fa68ada3267c933dd9ca8f0..b4944f45527e8e93303235d6ddaa5d7f0b9f208e 100644 (file)
@@ -12,6 +12,7 @@
 #include "mymemory.h"
 #include "common.h"
 #include "context.h"
 #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.
 
 /** 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;
 
        /* 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;
        while (true) {
                pid_t forkedID;
                fork_snap->currSnapShotID = snapshotid + 1;