summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@gmail.com>2008-01-02 12:20:15 -0800
committerSteve Reinhardt <stever@gmail.com>2008-01-02 12:20:15 -0800
commit3952e41ab1f1dfaa2f97a6a486528e4ea0bfc5a1 (patch)
treee186dc9429d37ea5e9ca6657ce746e60447dee32 /src/sim
parent659aef3eb8ff2803601851b85347fee04c2721b8 (diff)
downloadgem5-3952e41ab1f1dfaa2f97a6a486528e4ea0bfc5a1.tar.xz
Add functional PrintReq command for memory-system debugging.
--HG-- extra : convert_revision : 73b753e57c355b7e6873f047ddc8cb371c3136b7
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/sim_object.cc16
-rw-r--r--src/sim/sim_object.hh7
2 files changed, 23 insertions, 0 deletions
diff --git a/src/sim/sim_object.cc b/src/sim/sim_object.cc
index 907f015dc..a835aee5b 100644
--- a/src/sim/sim_object.cc
+++ b/src/sim/sim_object.cc
@@ -264,3 +264,19 @@ SimObject::takeOverFrom(BaseCPU *cpu)
{
panic("Unimplemented!");
}
+
+
+SimObject *
+SimObject::find(const char *name)
+{
+ SimObjectList::const_iterator i = simObjectList.begin();
+ SimObjectList::const_iterator end = simObjectList.end();
+
+ for (; i != end; ++i) {
+ SimObject *obj = *i;
+ if (obj->name() == name)
+ return obj;
+ }
+
+ return NULL;
+}
diff --git a/src/sim/sim_object.hh b/src/sim/sim_object.hh
index b70f1d5d3..20a35a32b 100644
--- a/src/sim/sim_object.hh
+++ b/src/sim/sim_object.hh
@@ -131,6 +131,13 @@ class SimObject : public Serializable, protected StartupCallback
static void debugObjectBreak(const std::string &objs);
#endif
+ /**
+ * Find the SimObject with the given name and return a pointer to
+ * it. Priarily used for interactive debugging. Argument is
+ * char* rather than std::string to make it callable from gdb.
+ */
+ static SimObject *find(const char *name);
+
public:
void recordEvent(const std::string &stat);
};