changeset c773314f7098 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=c773314f7098
description:
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.
diffstat:
src/cpu/inorder/cpu.cc | 2 +-
src/sim/process.cc | 2 --
src/sim/process.hh | 9 ++++++---
3 files changed, 7 insertions(+), 6 deletions(-)
diffs (59 lines):
diff -r db55c4b5136e -r c773314f7098 src/cpu/inorder/cpu.cc
--- a/src/cpu/inorder/cpu.cc Mon Aug 06 16:55:28 2012 -0700
+++ b/src/cpu/inorder/cpu.cc Mon Aug 06 16:55:34 2012 -0700
@@ -290,7 +290,7 @@
} 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 -r db55c4b5136e -r c773314f7098 src/sim/process.cc
--- a/src/sim/process.cc Mon Aug 06 16:55:28 2012 -0700
+++ b/src/sim/process.cc Mon Aug 06 16:55:34 2012 -0700
@@ -571,8 +571,6 @@
__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 -r db55c4b5136e -r c773314f7098 src/sim/process.hh
--- a/src/sim/process.hh Mon Aug 06 16:55:28 2012 -0700
+++ b/src/sim/process.hh Mon Aug 06 16:55:34 2012 -0700
@@ -110,11 +110,8 @@
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 @@
// 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 @@
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)
{
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev