diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2012-08-06 16:55:34 -0700 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2012-08-06 16:55:34 -0700 |
commit | 73ef8bd168795855cd23e56dd6739dfa23a77eb8 (patch) | |
tree | dfe826d6863ba57fbb5b05beba8e1db210f48efc | |
parent | e232152db6d9cd511a75c41f47b00befe9b7719e (diff) | |
download | gem5-73ef8bd168795855cd23e56dd6739dfa23a77eb8.tar.xz |
process: add progName() virtual function
This replaces a (potentially uninitialized) string
field with a virtual function so that we can have
a safe interface without requiring changes to the
eio code.
-rw-r--r-- | src/cpu/inorder/cpu.cc | 2 | ||||
-rw-r--r-- | src/sim/process.cc | 2 | ||||
-rw-r--r-- | src/sim/process.hh | 9 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc index f67691d0a..4aff0c579 100644 --- a/src/cpu/inorder/cpu.cc +++ b/src/cpu/inorder/cpu.cc @@ -290,7 +290,7 @@ InOrderCPU::InOrderCPU(Params *params) } else { if (tid < (ThreadID)params->workload.size()) { DPRINTF(InOrderCPU, "Workload[%i] process is %#x\n", - tid, params->workload[tid]->prog_fname); + tid, params->workload[tid]->progName()); thread[tid] = new Thread(this, tid, params->workload[tid]); } else { diff --git a/src/sim/process.cc b/src/sim/process.cc index 72b808a1d..f92fb91e2 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -571,8 +571,6 @@ LiveProcess::LiveProcess(LiveProcessParams * params, ObjectFile *_objFile) __pid = params->pid; __ppid = params->ppid; - prog_fname = params->cmd[0]; - // load up symbols, if any... these may be used for debugging or // profiling. if (!debugSymbolTable) { diff --git a/src/sim/process.hh b/src/sim/process.hh index cddd060fd..be4c53dd9 100644 --- a/src/sim/process.hh +++ b/src/sim/process.hh @@ -110,11 +110,8 @@ class Process : public SimObject Addr nxm_start; Addr nxm_end; - std::string prog_fname; // file name - Stats::Scalar num_syscalls; // number of syscalls executed - protected: // constructor Process(ProcessParams *params); @@ -177,6 +174,9 @@ class Process : public SimObject // Find a free context to use ThreadContext *findFreeContext(); + // provide program name for debug messages + virtual const char *progName() const { return "<unknown>"; } + // map simulator fd sim_fd to target fd tgt_fd void dup_fd(int sim_fd, int tgt_fd); @@ -292,6 +292,9 @@ class LiveProcess : public Process inline uint64_t pid() {return __pid;} inline uint64_t ppid() {return __ppid;} + // provide program name for debug messages + virtual const char *progName() const { return argv[0].c_str(); } + std::string fullPath(const std::string &filename) { |