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

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 ARM Limited
* Copyright (c) 2017, 2020 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -94,16 +94,16 @@ pybind_init_debug(py::module &m_native)
py::class_<Debug::Flag> c_flag(m_debug, "Flag");
c_flag
.def("name", &Debug::Flag::name)
.def("desc", &Debug::Flag::desc)
.def("kids", &Debug::Flag::kids)
.def_property_readonly("name", &Debug::Flag::name)
.def_property_readonly("desc", &Debug::Flag::desc)
.def("enable", &Debug::Flag::enable)
.def("disable", &Debug::Flag::disable)
.def("sync", &Debug::Flag::sync)
;
py::class_<Debug::SimpleFlag>(m_debug, "SimpleFlag", c_flag);
py::class_<Debug::CompoundFlag>(m_debug, "CompoundFlag", c_flag);
py::class_<Debug::CompoundFlag>(m_debug, "CompoundFlag", c_flag)
.def("kids", &Debug::CompoundFlag::kids)
;
py::module m_trace = m_native.def_submodule("trace");