summaryrefslogtreecommitdiff
path: root/sim/process.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2005-10-01 16:02:47 -0400
committerSteve Reinhardt <stever@eecs.umich.edu>2005-10-01 16:02:47 -0400
commit93e60de65647f3324e59b291c35ef2cf3a0fb9a0 (patch)
tree6c4f77185a157d91487c9ca46c4e77ace17a7b5a /sim/process.cc
parent30ad202a31c99198b5ecf3c30dbd6e594a464dbf (diff)
downloadgem5-93e60de65647f3324e59b291c35ef2cf3a0fb9a0.tar.xz
Add executable parameter to LiveProcess. This allows the argv[0] value to
stay fixed even if the path to the binary changes, so the simulation results are independent of that path. --HG-- extra : convert_revision : d1109cd284466c14eddc97289908a51e771fc5db
Diffstat (limited to 'sim/process.cc')
-rw-r--r--sim/process.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sim/process.cc b/sim/process.cc
index ee5d347a1..b04582233 100644
--- a/sim/process.cc
+++ b/sim/process.cc
@@ -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);
}