diff options
Diffstat (limited to 'sim')
-rw-r--r-- | sim/sim_object.cc | 36 | ||||
-rw-r--r-- | sim/sim_object.hh | 6 |
2 files changed, 41 insertions, 1 deletions
diff --git a/sim/sim_object.cc b/sim/sim_object.cc index 39219b500..818648b98 100644 --- a/sim/sim_object.cc +++ b/sim/sim_object.cc @@ -30,6 +30,7 @@ #include "base/callback.hh" #include "base/inifile.hh" +#include "base/match.hh" #include "base/misc.hh" #include "base/trace.hh" #include "base/stats/events.hh" @@ -53,13 +54,21 @@ using namespace std; // SimObject::SimObjectList SimObject::simObjectList; +namespace Stats { + extern ObjectMatch event_ignore; +} + // // SimObject constructor: used to maintain static simObjectList // SimObject::SimObject(const string &_name) : objName(_name) { - doRecordEvent = !Stats::ignoreEvent(_name); +#ifdef DEBUG + doDebugBreak = false; +#endif + + doRecordEvent = !Stats::event_ignore.match(_name); simObjectList.push_back(this); } @@ -172,6 +181,31 @@ SimObject::serializeAll(ostream &os) } } +#ifdef DEBUG +// +// static function: flag which objects should have the debugger break +// +void +SimObject::debugObjectBreak(const string &objs) +{ + SimObjectList::const_iterator i = simObjectList.begin(); + SimObjectList::const_iterator end = simObjectList.end(); + + ObjectMatch match(objs); + for (; i != end; ++i) { + SimObject *obj = *i; + obj->doDebugBreak = match.match(obj->name()); + } +} + +extern "C" +void +debugObjectBreak(const char *objs) +{ + SimObject::debugObjectBreak(string(objs)); +} +#endif + void SimObject::recordEvent(const std::string &stat) { diff --git a/sim/sim_object.hh b/sim/sim_object.hh index 770cd558e..dfd70f8ec 100644 --- a/sim/sim_object.hh +++ b/sim/sim_object.hh @@ -83,6 +83,12 @@ class SimObject : public Serializable // static: call nameOut() & serialize() on all SimObjects static void serializeAll(std::ostream &); +#ifdef DEBUG + public: + bool doDebugBreak; + static void debugObjectBreak(const std::string &objs); +#endif + public: bool doRecordEvent; void recordEvent(const std::string &stat); |