diff --git a/python/m5/objects/Process.py b/python/m5/objects/Process.py index 17a66c6d92..b4ccc1beca 100644 --- a/python/m5/objects/Process.py +++ b/python/m5/objects/Process.py @@ -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") diff --git a/sim/process.cc b/sim/process.cc index ee5d347a18..b04582233d 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 &argv, vector &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 cmd; + Param executable; Param input; Param output; VectorParam 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); } diff --git a/sim/process.hh b/sim/process.hh index ef54ced787..28c16a4447 100644 --- a/sim/process.hh +++ b/sim/process.hh @@ -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 &argv, std::vector &envp); };