Make the DDUMP tracing feature output the cycle number and

the object name on every line.
This makes grep a bit more effective.

kern/tru64/dump_mbuf.cc:
    use the new data dump format that trace.hh now provides

--HG--
extra : convert_revision : 179efa96aaff9da710baae13c9e981975d2abdc1
This commit is contained in:
Nathan Binkert 2004-07-30 10:18:04 -04:00
parent b1fa4e9f0a
commit 41988a86b5
3 changed files with 18 additions and 18 deletions

View file

@ -184,7 +184,6 @@ PrintfRecord::~PrintfRecord()
delete &args; delete &args;
} }
void void
PrintfRecord::dump(ostream &os) PrintfRecord::dump(ostream &os)
{ {
@ -206,29 +205,26 @@ PrintfRecord::dump(ostream &os)
os.flush(); os.flush();
} }
DataRecord::DataRecord(Tick _cycle, const string &_name,
const void *_data, int _len)
RawDataRecord::RawDataRecord(Tick _cycle, const void *_data, int _len) : Record(_cycle), name(_name), len(_len)
: Record(_cycle), len(_len)
{ {
data = new uint8_t[len]; data = new uint8_t[len];
memcpy(data, _data, len); memcpy(data, _data, len);
} }
DataRecord::~DataRecord()
RawDataRecord::~RawDataRecord()
{ {
delete [] data; delete [] data;
} }
void void
RawDataRecord::dump(ostream &os) DataRecord::dump(ostream &os)
{ {
int c, i, j; int c, i, j;
for (i = 0; i < len; i += 16) { for (i = 0; i < len; i += 16) {
ccprintf(os, "%08x ", i); ccprintf(os, "%d: %s: %08x ", cycle, name, i);
c = len - i; c = len - i;
if (c > 16) c = 16; if (c > 16) c = 16;

View file

@ -69,7 +69,7 @@ namespace Trace {
class Record class Record
{ {
protected: protected:
Tick cycle; Tick cycle;
Record(Tick _cycle) Record(Tick _cycle)
: cycle(_cycle) : cycle(_cycle)
@ -101,15 +101,17 @@ namespace Trace {
virtual void dump(std::ostream &); virtual void dump(std::ostream &);
}; };
class RawDataRecord : public Record class DataRecord : public Record
{ {
private: private:
const std::string &name;
uint8_t *data; uint8_t *data;
int len; int len;
public: public:
RawDataRecord(Tick cycle, const void *_data, int _len); DataRecord(Tick cycle, const std::string &name,
virtual ~RawDataRecord(); const void *_data, int _len);
virtual ~DataRecord();
virtual void dump(std::ostream &); virtual void dump(std::ostream &);
}; };
@ -149,9 +151,9 @@ namespace Trace {
} }
inline void inline void
rawDump(const void *data, int len) dataDump(Tick cycle, const std::string &name, const void *data, int len)
{ {
theLog.append(new Trace::RawDataRecord(curTick, data, len)); theLog.append(new Trace::DataRecord(cycle, name, data, len));
} }
extern const std::string DefaultName; extern const std::string DefaultName;
@ -180,7 +182,7 @@ std::ostream &DebugOut();
#define DDUMP(x, data, count) \ #define DDUMP(x, data, count) \
do { \ do { \
if (Trace::IsOn(Trace::x)) \ if (Trace::IsOn(Trace::x)) \
Trace::rawDump(data, count); \ Trace::dataDump(curTick, name(), data, count); \
} while (0) } while (0)
#define __dprintf(cycle, name, format, args...) \ #define __dprintf(cycle, name, format, args...) \

View file

@ -31,6 +31,7 @@
#include "base/cprintf.hh" #include "base/cprintf.hh"
#include "base/trace.hh" #include "base/trace.hh"
#include "cpu/exec_context.hh"
#include "kern/tru64/mbuf.hh" #include "kern/tru64/mbuf.hh"
#include "sim/host.hh" #include "sim/host.hh"
#include "targetarch/arguments.hh" #include "targetarch/arguments.hh"
@ -58,7 +59,8 @@ DumpMbuf(AlphaArguments args)
addr, m.m_data, m.m_len); addr, m.m_data, m.m_len);
char *buffer = new char[m.m_len]; char *buffer = new char[m.m_len];
CopyOut(xc, buffer, m.m_data, m.m_len); CopyOut(xc, buffer, m.m_data, m.m_len);
Trace::rawDump((uint8_t *)buffer, m.m_len); Trace::dataDump(curTick, xc->system->name(), (uint8_t *)buffer,
m.m_len);
delete [] buffer; delete [] buffer;
count -= m.m_len; count -= m.m_len;