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")
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
BEGIN_DECLARE_SIM_OBJECT_PARAMS(LiveProcess)
VectorParam<string> cmd;
+ Param<string> executable;
Param<string> input;
Param<string> output;
VectorParam<string> env;
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")
return LiveProcess::create(getInstanceName(),
stdin_fd, stdout_fd, stderr_fd,
+ (string)executable == "" ? cmd[0] : executable,
cmd, env);
}
// 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);
};