trace.cc (2665:a124942bacb8) trace.cc (2802:babfc298ac86)
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 233 unchanged lines hidden (view full) ---

242//
243// C-linkage functions for invoking from gdb
244//
245/////////////////////////////////////////////
246
247//
248// Dump trace buffer to specified file (cout if NULL)
249//
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 233 unchanged lines hidden (view full) ---

242//
243// C-linkage functions for invoking from gdb
244//
245/////////////////////////////////////////////
246
247//
248// Dump trace buffer to specified file (cout if NULL)
249//
250extern "C"
251void
252dumpTrace(const char *filename)
253{
254 if (filename != NULL) {
255 ofstream out(filename);
256 Trace::theLog.dump(out);
257 out.close();
258 }

--- 5 unchanged lines hidden (view full) ---

264
265//
266// Turn on/off trace output to cerr. Typically used when trace output
267// is only going to circular buffer, but you want to see what's being
268// sent there as you step through some code in gdb. This uses the
269// same facility as the "trace to file" feature, and will print error
270// messages rather than clobbering an existing ostream pointer.
271//
250void
251dumpTrace(const char *filename)
252{
253 if (filename != NULL) {
254 ofstream out(filename);
255 Trace::theLog.dump(out);
256 out.close();
257 }

--- 5 unchanged lines hidden (view full) ---

263
264//
265// Turn on/off trace output to cerr. Typically used when trace output
266// is only going to circular buffer, but you want to see what's being
267// sent there as you step through some code in gdb. This uses the
268// same facility as the "trace to file" feature, and will print error
269// messages rather than clobbering an existing ostream pointer.
270//
272extern "C"
273void
274echoTrace(bool on)
275{
276 if (on) {
277 if (Trace::dprintf_stream != NULL) {
278 cerr << "Already echoing trace to a file... go do a 'tail -f'"
279 << " on that file instead." << endl;
280 } else {
281 Trace::dprintf_stream = &cerr;
282 }
283 } else {
284 if (Trace::dprintf_stream != &cerr) {
285 cerr << "Not echoing trace to cerr." << endl;
286 } else {
287 Trace::dprintf_stream = NULL;
288 }
289 }
290}
291
271void
272echoTrace(bool on)
273{
274 if (on) {
275 if (Trace::dprintf_stream != NULL) {
276 cerr << "Already echoing trace to a file... go do a 'tail -f'"
277 << " on that file instead." << endl;
278 } else {
279 Trace::dprintf_stream = &cerr;
280 }
281 } else {
282 if (Trace::dprintf_stream != &cerr) {
283 cerr << "Not echoing trace to cerr." << endl;
284 } else {
285 Trace::dprintf_stream = NULL;
286 }
287 }
288}
289
292extern "C"
293void
294printTraceFlags()
295{
296 using namespace Trace;
297 for (int i = 0; i < numFlagStrings; ++i)
298 if (flags[i])
299 cprintf("%s\n", flagStrings[i]);
300}

--- 32 unchanged lines hidden (view full) ---

333
334 cprintf("flag %s was %s\n", string, value ? "set" : "cleared");
335 return;
336 }
337
338 cprintf("could not find flag %s\n", string);
339}
340
290void
291printTraceFlags()
292{
293 using namespace Trace;
294 for (int i = 0; i < numFlagStrings; ++i)
295 if (flags[i])
296 cprintf("%s\n", flagStrings[i]);
297}

--- 32 unchanged lines hidden (view full) ---

330
331 cprintf("flag %s was %s\n", string, value ? "set" : "cleared");
332 return;
333 }
334
335 cprintf("could not find flag %s\n", string);
336}
337
341extern "C"
342void
343setTraceFlag(const char *string)
344{
345 tweakTraceFlag(string, true);
346}
347
338void
339setTraceFlag(const char *string)
340{
341 tweakTraceFlag(string, true);
342}
343
348extern "C"
349void
350clearTraceFlag(const char *string)
351{
352 tweakTraceFlag(string, false);
353}
344void
345clearTraceFlag(const char *string)
346{
347 tweakTraceFlag(string, false);
348}