summaryrefslogtreecommitdiff
path: root/src/python/m5/debug.py
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2011-04-15 10:44:32 -0700
committerNathan Binkert <nate@binkert.org>2011-04-15 10:44:32 -0700
commiteddac53ff60c579eff28134bde84783fe36d6214 (patch)
tree9095c6b64a6fdabf4e0d00b2c8f2ca40ad495f49 /src/python/m5/debug.py
parentf946d7bcdb4d0b4327857d319dd4ecdd1c320d62 (diff)
downloadgem5-eddac53ff60c579eff28134bde84783fe36d6214.tar.xz
trace: reimplement the DTRACE function so it doesn't use a vector
At the same time, rename the trace flags to debug flags since they have broader usage than simply tracing. This means that --trace-flags is now --debug-flags and --trace-help is now --debug-help
Diffstat (limited to 'src/python/m5/debug.py')
-rw-r--r--src/python/m5/debug.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/python/m5/debug.py b/src/python/m5/debug.py
index cd40b8fa3..8231126a0 100644
--- a/src/python/m5/debug.py
+++ b/src/python/m5/debug.py
@@ -29,3 +29,65 @@
import internal
from internal.debug import schedBreakCycle, setRemoteGDBPort
+
+def help():
+ print "Base Flags:"
+ for flag in flags.basic:
+ print " %s: %s" % (flag, flags.descriptions[flag])
+ print
+ print "Compound Flags:"
+ for flag in flags.compound:
+ if flag == 'All':
+ continue
+ print " %s: %s" % (flag, flags.descriptions[flag])
+ util.printList(flags.compoundMap[flag], indent=8)
+ print
+
+class AllFlags(object):
+ def __init__(self):
+ self._version = -1
+ self._dict = {}
+
+ def _update(self):
+ current_version = internal.debug.getAllFlagsVersion()
+ if self._version == current_version:
+ return
+
+ self._dict.clear()
+ for flag in internal.debug.getAllFlags():
+ self._dict[flag.name()] = flag
+ self._version = current_version
+
+ def __contains__(self, item):
+ self._update()
+ return item in self._dict
+
+ def __getitem__(self, item):
+ self._update()
+ return self._dict[item]
+
+ def keys(self):
+ self._update()
+ return self._dict.keys()
+
+ def values(self):
+ self._update()
+ return self._dict.values()
+
+ def items(self):
+ self._update()
+ return self._dict.items()
+
+ def iterkeys(self):
+ self._update()
+ return self._dict.iterkeys()
+
+ def itervalues(self):
+ self._update()
+ return self._dict.itervalues()
+
+ def iteritems(self):
+ self._update()
+ return self._dict.iteritems()
+
+flags = AllFlags()