diff options
author | Nathan Binkert <binkertn@umich.edu> | 2004-07-30 10:47:53 -0400 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2004-07-30 10:47:53 -0400 |
commit | 3711ea7347b02b8e27f5959d453cb8c9a291a753 (patch) | |
tree | 1c03f48fd8b32020d60e34f7518f9f77e48431bf /sim/sim_object.cc | |
parent | 41988a86b56984e19e9ef45991a39c00fdb3f21e (diff) | |
download | gem5-3711ea7347b02b8e27f5959d453cb8c9a291a753.tar.xz |
Move all of the object matching code to a shared file so it can
be more easily re-used. This currently uses some cooked up matching
function that I wrote a while ago, but should probably be changed
to use regular expressions in the future.
add doDebugBreak to control breakpoints on a per SimObject basis
SConscript:
add match
base/stats/events.cc:
base/trace.cc:
Move the object matching code into a separate file so it can be
more easily shared
base/trace.hh:
the object matching code was wrapped up and moved. adapt.
sim/sim_object.cc:
add the doDebugBreak flag that can be set on a per-SimObject
basis. This will be used in the future to control whether or
not debug_break() will actually break for a given object.
provide a function interface that can be called from the debugger.
sim/sim_object.hh:
add the doDebugBreak flag that can be set on a per-SimObject
basis. This will be used in the future to control whether or
not debug_break() will actually break for a given object.
--HG--
extra : convert_revision : 6bf7924de63d41f5ba6b80d579efdf26ba265a8f
Diffstat (limited to 'sim/sim_object.cc')
-rw-r--r-- | sim/sim_object.cc | 36 |
1 files changed, 35 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) { |