Deleted Added
sdiff udiff text old ( 8640:cb8a72779f7e ) new ( 10292:933dfb9d8279 )
full compact
1/*
2 * Copyright (c) 2001-2006 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;

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

33#include <fstream>
34#include <iostream>
35#include <string>
36
37#include "base/misc.hh"
38#include "base/output.hh"
39#include "base/str.hh"
40#include "base/trace.hh"
41
42using namespace std;
43
44namespace Trace {
45
46const string DefaultName("global");
47bool enabled = false;
48

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

64{
65 dprintf_stream = simout.find(filename);
66 if (!dprintf_stream)
67 dprintf_stream = simout.create(filename);
68}
69
70ObjectMatch ignore;
71
72
73bool
74__dprintf_prologue(Tick when, const std::string &name)
75{
76 if (!name.empty() && ignore.match(name))
77 return false;
78
79 std::ostream &os = *dprintf_stream;
80
81 if (when != MaxTick)
82 ccprintf(os, "%7d: ", when);
83
84 if (!name.empty())
85 os << name << ": ";
86
87 return true;
88}
89
90void
91dump(Tick when, const std::string &name, const void *d, int len)
92{
93 const char *data = static_cast<const char *>(d);
94 std::ostream &os = *dprintf_stream;
95 int c, i, j;
96
97 for (i = 0; i < len; i += 16) {
98 if (!__dprintf_prologue(when, name))
99 return;
100
101 ccprintf(os, "%08x ", i);
102 c = len - i;
103 if (c > 16) c = 16;
104
105 for (j = 0; j < c; j++) {
106 ccprintf(os, "%02x ", data[i + j] & 0xff);
107 if ((j & 0xf) == 7 && j > 0)
108 ccprintf(os, " ");

--- 19 unchanged lines hidden ---