scons: Separate debug flags from debug-format flags

Debug flags are flags that aid with debugging by printing
relevant information when enabled. Debug-formatting flags
define how the debug flags will print the information.

Although a viability, this patch does not support declaring
compound format flags.

As a side effect, now debug flags and debug-formatting flags
are printed in different lists, when using --debug-help.

Change-Id: Ieae68745276218cf4e9c1d37d7bf3bd1f19709ae
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39076
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:
Daniel R. Carvalho
2021-01-13 20:58:47 -03:00
committed by Daniel Carvalho
parent 58ccc6287e
commit 4ff5fa567b
6 changed files with 54 additions and 15 deletions

View File

@@ -81,18 +81,31 @@ class Flag
class SimpleFlag : public Flag
{
protected:
/** Whether this flag changes debug formatting. */
const bool _isFormat = false;
bool _tracing = false; // tracing is enabled and flag is on
bool _enabled = false; // flag enablement status
void sync() override { _tracing = _globalEnable && _enabled; }
public:
SimpleFlag(const char *name, const char *desc) : Flag(name, desc) {}
SimpleFlag(const char *name, const char *desc, bool is_format=false)
: Flag(name, desc), _isFormat(is_format)
{}
bool enabled() const override { return _tracing; }
void enable() override { _enabled = true; sync(); }
void disable() override { _enabled = false; sync(); }
/**
* Checks whether this flag is a conventional debug flag, or a flag that
* modifies the way debug information is printed.
*
* @return True if this flag is a debug-formatting flag.
*/
bool isFormat() const { return _isFormat; }
};
class CompoundFlag : public Flag