summaryrefslogtreecommitdiff
path: root/src/base/trace.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2007-02-09 14:39:56 -0800
committerNathan Binkert <binkertn@umich.edu>2007-02-09 14:39:56 -0800
commita24ccc1ef21a5b6bb74f2ef1358a99cffc72c434 (patch)
tree8c941c0f287ba5ad633033cf900b937bbed541cf /src/base/trace.cc
parent27c2138882ac54b1ba51583d9fd52ca2303e8fc8 (diff)
downloadgem5-a24ccc1ef21a5b6bb74f2ef1358a99cffc72c434.tar.xz
Get rid of the Trace ParamContext and give python direct
access to enabling/disabling tracing. Command line is unchanged except for the removal of --trace-cycle since it's not so clear what that means. --HG-- extra : convert_revision : c0164d92d3615d76d0c6acaabaafd92a9278212a
Diffstat (limited to 'src/base/trace.cc')
-rw-r--r--src/base/trace.cc123
1 files changed, 1 insertions, 122 deletions
diff --git a/src/base/trace.cc b/src/base/trace.cc
index 6e9838456..efa76b044 100644
--- a/src/base/trace.cc
+++ b/src/base/trace.cc
@@ -46,6 +46,7 @@ using namespace std;
namespace Trace {
const string DefaultName("global");
FlagVec flags(NumFlags, false);
+bool enabled = true;
//
// This variable holds the output stream for debug information. Other
@@ -223,125 +224,3 @@ DataRecord::dump(ostream &os)
}
}
} // namespace Trace
-
-//
-// Returns the current output stream for debug information. As a
-// wrapper around Trace::dprintf_stream, this handles cases where debug
-// information is generated in the process of parsing .ini options,
-// before we process the option that sets up the debug output stream
-// itself.
-//
-std::ostream &
-DebugOut()
-{
- return *Trace::dprintf_stream;
-}
-
-/////////////////////////////////////////////
-//
-// C-linkage functions for invoking from gdb
-//
-/////////////////////////////////////////////
-
-//
-// Dump trace buffer to specified file (cout if NULL)
-//
-void
-dumpTrace(const char *filename)
-{
- if (filename != NULL) {
- ofstream out(filename);
- Trace::theLog.dump(out);
- out.close();
- }
- else {
- Trace::theLog.dump(cout);
- }
-}
-
-
-//
-// Turn on/off trace output to cerr. Typically used when trace output
-// is only going to circular buffer, but you want to see what's being
-// sent there as you step through some code in gdb. This uses the
-// same facility as the "trace to file" feature, and will print error
-// messages rather than clobbering an existing ostream pointer.
-//
-void
-echoTrace(bool on)
-{
- if (on) {
- if (Trace::dprintf_stream != NULL) {
- cerr << "Already echoing trace to a file... go do a 'tail -f'"
- << " on that file instead." << endl;
- } else {
- Trace::dprintf_stream = &cerr;
- }
- } else {
- if (Trace::dprintf_stream != &cerr) {
- cerr << "Not echoing trace to cerr." << endl;
- } else {
- Trace::dprintf_stream = NULL;
- }
- }
-}
-
-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);
-}
-
-void
-setTraceFlag(const char *string)
-{
- tweakTraceFlag(string, true);
-}
-
-void
-clearTraceFlag(const char *string)
-{
- tweakTraceFlag(string, false);
-}