Add executable parameter to LiveProcess. This allows the argv[0] value to
authorSteve Reinhardt <stever@eecs.umich.edu>
Sat, 1 Oct 2005 20:02:47 +0000 (16:02 -0400)
committerSteve Reinhardt <stever@eecs.umich.edu>
Sat, 1 Oct 2005 20:02:47 +0000 (16:02 -0400)
stay fixed even if the path to the binary changes, so the simulation results
are independent of that path.

--HG--
extra : convert_revision : d1109cd284466c14eddc97289908a51e771fc5db

python/m5/objects/Process.py
sim/process.cc
sim/process.hh

index 17a66c6d92950ff783358d902686855649d1bda0..b4ccc1beca340c33077bb04b212ab12e6fef9c9e 100644 (file)
@@ -6,6 +6,7 @@ class Process(SimObject):
 
 class LiveProcess(Process):
     type = 'LiveProcess'
+    executable = Param.String('', "executable (overrides cmd[0] if set)")
     cmd = VectorParam.String("command line (executable plus arguments)")
     env = VectorParam.String('', "environment settings")
     input = Param.String('cin', "filename for stdin")
index ee5d347a189b5ed48b7aaf51c44433c25f986b75..b04582233ddbf18cf2d5aed3aafdec7242192083 100644 (file)
@@ -342,12 +342,13 @@ LiveProcess::LiveProcess(const string &nm, ObjectFile *objFile,
 LiveProcess *
 LiveProcess::create(const string &nm,
                     int stdin_fd, int stdout_fd, int stderr_fd,
+                    string executable,
                     vector<string> &argv, vector<string> &envp)
 {
     LiveProcess *process = NULL;
-    ObjectFile *objFile = createObjectFile(argv[0]);
+    ObjectFile *objFile = createObjectFile(executable);
     if (objFile == NULL) {
-        fatal("Can't load object file %s", argv[0]);
+        fatal("Can't load object file %s", executable);
     }
 
     // check object type & set up syscall emulation pointer
@@ -384,6 +385,7 @@ LiveProcess::create(const string &nm,
 BEGIN_DECLARE_SIM_OBJECT_PARAMS(LiveProcess)
 
     VectorParam<string> cmd;
+    Param<string> executable;
     Param<string> input;
     Param<string> output;
     VectorParam<string> env;
@@ -394,6 +396,7 @@ END_DECLARE_SIM_OBJECT_PARAMS(LiveProcess)
 BEGIN_INIT_SIM_OBJECT_PARAMS(LiveProcess)
 
     INIT_PARAM(cmd, "command line (executable plus arguments)"),
+    INIT_PARAM(executable, "executable (overrides cmd[0] if set)"),
     INIT_PARAM(input, "filename for stdin (dflt: use sim stdin)"),
     INIT_PARAM(output, "filename for stdout/stderr (dflt: use sim stdout)"),
     INIT_PARAM(env, "environment settings")
@@ -425,6 +428,7 @@ CREATE_SIM_OBJECT(LiveProcess)
 
     return LiveProcess::create(getInstanceName(),
                                stdin_fd, stdout_fd, stderr_fd,
+                               (string)executable == "" ? cmd[0] : executable,
                                cmd, env);
 }
 
index ef54ced787b99ce8fdc3d0f4acf7bdafdf9e2bf8..28c16a44476ee82b7a762de3e3925b0b43051803 100644 (file)
@@ -194,6 +194,7 @@ class LiveProcess : public Process
     // open and look at the object file.
     static LiveProcess *create(const std::string &nm,
                                int stdin_fd, int stdout_fd, int stderr_fd,
+                               std::string executable,
                                std::vector<std::string> &argv,
                                std::vector<std::string> &envp);
 };