diff options
author | Nathan Binkert <binkertn@umich.edu> | 2004-02-29 19:31:58 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2004-02-29 19:31:58 -0500 |
commit | a574c260e35d99eedfe4927b21f8d3e5ca5ce3f5 (patch) | |
tree | 3157c800272b198f1142072b1b1c4d276506eb00 | |
parent | 31f82cef41962fb57d343f4a8cd468c87d8204dc (diff) | |
parent | 45f377bcd8c07b100aacc2de07023c836af04174 (diff) | |
download | gem5-a574c260e35d99eedfe4927b21f8d3e5ca5ce3f5.tar.xz |
Merge zizzer.eecs.umich.edu:/bk/m5
into ziff.eecs.umich.edu:/z/binkertn/research/m5/latest
--HG--
extra : convert_revision : 48e5262fc37a5774b10a83e4c36a89c0ef2c8f15
-rw-r--r-- | base/trace.cc | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/base/trace.cc b/base/trace.cc index cca58d669..e56bdb11b 100644 --- a/base/trace.cc +++ b/base/trace.cc @@ -319,3 +319,66 @@ echoTrace(bool on) } } } + +extern "C" +void +printTraceFlags() +{ + using namespace Trace; + for (int i = 0; i < numFlagStrings; ++i) + if (flags[i]) + cprintf("%s\n", flagStrings[i]); +} + +void +tweakTraceFlag(const char *string, bool value) +{ + using namespace Trace; + std::string str(string); + + for (int i = 0; i < numFlagStrings; ++i) { + if (str != flagStrings[i]) + continue; + + int idx = i; + + if (idx < NumFlags) { + flags[idx] = value; + } else { + idx -= NumFlags; + if (idx >= NumCompoundFlags) { + ccprintf(cerr, "Invalid compound flag"); + return; + } + + const Flags *flagVec = compoundFlags[idx]; + + for (int j = 0; flagVec[j] != -1; ++j) { + if (flagVec[j] >= NumFlags) { + ccprintf(cerr, "Invalid compound flag"); + return; + } + flags[flagVec[j]] = value; + } + } + + cprintf("flag %s was %s\n", string, value ? "set" : "cleared"); + return; + } + + cprintf("could not find flag %s\n", string); +} + +extern "C" +void +setTraceFlag(const char *string) +{ + tweakTraceFlag(string, true); +} + +extern "C" +void +clearTraceFlag(const char *string) +{ + tweakTraceFlag(string, false); +} |