base: Cleanup debug flags API

The debug flags API has a couple of quirks that should be cleaned
up. Specifically:

 * Only CompoundFlag should expose a list of children.
 * The global enable flag is just called "active", this isn't very
   descriptive.
 * Only SimpleFlag exposed a status member. This should be in the base
   class to make the API symmetric.
 * Flag::Sync() is an implementation detail and needs to be protected.

Change-Id: I4d7fd32c80891191aa04f0bd0c334c8cf8d372f5
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34118
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Andreas Sandberg
2020-09-04 16:01:24 +01:00
parent 15a37b7dc5
commit 93ccc23b4a
5 changed files with 79 additions and 44 deletions

View File

@@ -34,24 +34,18 @@ from _m5.debug import schedBreak, setRemoteGDBPort
from m5.util import printList
def help():
sorted_flags = sorted(flags.items(), key=lambda kv: kv[0])
print("Base Flags:")
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()))
for name, flag in filter(lambda kv: not isinstance(kv[1], CompoundFlag),
sorted_flags):
print(" %s: %s" % (name, flag.desc))
print()
print("Compound Flags:")
for name in sorted(flags):
if name == 'All':
continue
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)
for name, flag in filter(lambda kv: isinstance(kv[1], CompoundFlag),
sorted_flags):
print(" %s: %s" % (name, flag.desc))
printList([ c.name for c in flag.kids() ], indent=8)
print()
class AllFlags(Mapping):