diff -r b02bca5aed04 -r a448fa7a9d53 src/base/debug.hh --- a/src/base/debug.hh Mon Apr 25 14:18:08 2011 -0700 +++ b/src/base/debug.hh Thu Apr 28 16:48:13 2011 -0700 @@ -44,6 +44,7 @@ protected: const char *_name; const char *_desc; + std::vector _kids; public: Flag(const char *name, const char *desc); @@ -51,6 +52,7 @@ std::string name() const { return _name; } std::string desc() const { return _desc; } + std::vector kids() { return _kids; } virtual void enable() = 0; virtual void disable() = 0; @@ -77,7 +79,12 @@ class CompoundFlag : public SimpleFlag { protected: - std::vector flags; + void + addFlag(Flag &f) + { + if (&f != NULL) + _kids.push_back(&f); + } public: CompoundFlag(const char *name, const char *desc, @@ -99,13 +106,6 @@ addFlag(f15); addFlag(f16); addFlag(f17); addFlag(f18); addFlag(f19); } - void - addFlag(Flag &f) - { - if (&f != NULL) - flags.push_back(&f); - } - void enable(); void disable(); }; diff -r b02bca5aed04 -r a448fa7a9d53 src/base/debug.cc --- a/src/base/debug.cc Mon Apr 25 14:18:08 2011 -0700 +++ b/src/base/debug.cc Thu Apr 28 16:48:13 2011 -0700 @@ -101,14 +101,14 @@ CompoundFlag::enable() { SimpleFlag::enable(); - for_each(flags.begin(), flags.end(), mem_fun(&Flag::enable)); + for_each(_kids.begin(), _kids.end(), mem_fun(&Flag::enable)); } void CompoundFlag::disable() { SimpleFlag::disable(); - for_each(flags.begin(), flags.end(), mem_fun(&Flag::disable)); + for_each(_kids.begin(), _kids.end(), mem_fun(&Flag::disable)); } struct AllFlags : public Flag diff -r b02bca5aed04 -r a448fa7a9d53 src/python/m5/debug.py --- a/src/python/m5/debug.py Mon Apr 25 14:18:08 2011 -0700 +++ b/src/python/m5/debug.py Thu Apr 28 16:48:13 2011 -0700 @@ -26,24 +26,36 @@ # # Authors: Nathan Binkert +from UserDict import DictMixin + import internal +from internal.debug import SimpleFlag, CompoundFlag from internal.debug import schedBreakCycle, setRemoteGDBPort +from m5.util import printList def help(): print "Base Flags:" - for flag in flags.basic: - print " %s: %s" % (flag, flags.descriptions[flag]) + for name in sorted(flags): + if name == 'All': + continue + flag = flags[name] + children = [c for c in flag.kids() ] + if not children: + print " %s: %s" % (name, flag.desc()) print print "Compound Flags:" - for flag in flags.compound: - if flag == 'All': + for name in sorted(flags): + if name == 'All': continue - print " %s: %s" % (flag, flags.descriptions[flag]) - util.printList(flags.compoundMap[flag], indent=8) - print + flag = flags[name] + children = [c for c in flag.kids() ] + if children: + print " %s: %s" % (name, flag.desc()) + printList([ c.name() for c in children ], indent=8) + print -class AllFlags(object): +class AllFlags(DictMixin): def __init__(self): self._version = -1 self._dict = {}